Skip to content

Code Quality

Leonard Ramminger edited this page Aug 10, 2026 · 2 revisions

Code Quality

Beez enforces style and safety through Makefile targets. CI runs the same pipeline as make all (see Submitting Changes).

Reports are written under report/:

Subdirectory Target Tooling
report/test/ test CTest
report/format/ format-check clang-format, cmake-format
report/lint/ lint clang-tidy, cmake-format
report/analyze/ analyze cppcheck, clang-tidy
report/security/ security clang-tidy security checks, cppcheck
report/coverage/ coverage gcovr HTML report
report/sanitize/ sanitize ASan/UBSan test run
report/fuzz/ fuzzer-smoke libFuzzer stats

Clear reports: make clean-reports.

Formatting

make format        # apply clang-format + cmake-format
make format-check  # CI mode (dry-run, fails on diff)

Formatted paths:

  • All *.cpp, *.hpp, *.h under src/, include/, tests/
  • Listed CMakeLists.txt files (root and subprojects)

Config files: .clang-format at repo root; cmake-format via cmakelang.

Lint

make lint              # full clang-tidy pass via scripts/lint.sh
make lint-stale        # incremental (changed or previously failed files)
make lint-stale-clean  # reset incremental cache
make tidy              # clang-tidy only, all files

Requires a configured build directory with compile_commands.json (make setup).

Static analysis

make analyze    # cppcheck + clang-tidy (scripts/analyze.sh)

Security analysis

make security   # security-focused clang-tidy + cppcheck rules

Coverage

make coverage

Configures a Debug build with BUILD_COVERAGE=ON, runs tests, generates HTML under report/coverage/.

Target: line coverage on src/ must be ≥ 85%. CI enforces this via scripts/coverage-report.sh (MIN_LINE_COVERAGE, default 85). The summary step checks src/ only; the HTML report also includes tests/.

# Local check before a PR
make coverage
# Open report/coverage/index.html

# Temporary lower threshold for experiments only
MIN_LINE_COVERAGE=80 make coverage

Sanitizers

make sanitize

Debug build with AddressSanitizer and UndefinedBehaviorSanitizer, then runs the full test suite.

Fuzzer smoke

make fuzzer-smoke

Builds fuzz_lua_dsl and runs against committed corpus seeds for FUZZER_TIME seconds (default 30).

Full pipeline

make all

Runs in order:

  1. build
  2. test
  3. format-check
  4. lint
  5. analyze
  6. security
  7. coverage
  8. sanitize
  9. fuzzer-smoke

Definition of done for features: make all exits zero and line coverage on src/ is at least 85%.

Local iteration tips

Goal Command
Quick compile check make build
Fast feedback on one file make lint-stale after make build
Format before commit make format
Reproduce CI locally STRICT_CI=1 ./scripts/ci.sh

Related pages

Clone this wiki locally