Skip to content

POC: static analysis findings (CodeQL, clang-tidy, clippy, ruff) in module verification reports - DO NOT MERGE - #502

Draft
antonkri wants to merge 35 commits into
mainfrom
poc/static-analysis-codeql
Draft

antonkri wants to merge 35 commits into
mainfrom
poc/static-analysis-codeql

Conversation

@antonkri

@antonkri antonkri commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Proof of concept, do not merge. Static analysis findings (CodeQL MISRA C++, clang-tidy, clippy, ruff) of every target_sw module in the module verification reports, handled like coverage.

Related PRs

PR Provides Used here
eclipse-score/tools#79 codeql_analysis macro (@score_tools//codeql:defs.bzl): traced CodeQL build, coding-standards packs, SARIF + integrity report known_good.json pins score_tools to 31427b6d
eclipse-score/docs-as-code#1072 Static analysis section in module verification reports: reads static-analysis-report/, strips Bazel paths, maps _virtual_includes, assigns findings to components, one entry per tool known_good.json pins score_docs_as_code to dfbfeebd (#1072 backported onto v9.1.1, branch poc/static-analysis-report-v9.1.1)
eclipse-score/score_cpp_policies#52 make_clang_tidy_aspect applies the S-CORE baseline known_good.json pins score_cpp_policies to c8fb812e

Module contract (patches, to be upstreamed)

Contract Content
//quality/static_analysis:codeql (C++ modules) codeql_analysis(targets, coding_standards_config, exclude_testonly = True, keep_going = True)
build:lint clang-tidy, clippy, ruff aspects of the central policies; SARIF parser toolchain
build:lint_sarif --config=lint, --output_groups=rules_lint_machine, fail_on_violation=false
Patch Content
patches/baselibs/004-static-analysis-contract.patch score_tools dev dep, SARIF parser, lint_sarif, codeql target
patches/communication/003-static-analysis-contract.patch build:lint = clang-tidy + clippy + ruff, lint_sarif, score_tools dev dep, codeql target
patches/config_management/007-static-analysis-contract.patch score_cpp_policies dev dep, tools/lint/ with make_clang_tidy_aspect + ruff, build:lint, lint_sarif, codeql target
patches/kyron/001-static-analysis-contract.patch build:lint with clippy, lint_sarif
patches/lifecycle/008-static-analysis-contract.patch tools/lint/, build:lint with clippy, lint_sarif, SARIF parser, .clang-tidy export, codeql target
patches/logging/008-static-analysis-contract.patch baseline instead of local .clang-tidy, ruff, build:lint, lint_sarif, codeql target
patches/persistency/006-static-analysis-contract.patch SARIF parser, lint_sarif, codeql target
patches/time/008-static-analysis-contract.patch ruff, build:lint, lint_sarif, codeql target

RI changes

Coverage (existing) Static analysis (this PR)
COVERAGE_MODULES STATIC_ANALYSIS_MODULES: the 8 modules with a contract patch; CodeQL only for C++ modules
run <module>: module's --config=llvm_cov + @score_coverage//:generate_coverage_html codeql <module>: bazel run //quality/static_analysis:codeql; lint <module>: bazel build --config=lint_sarif on all cc_/rust_/py_ targets below code_root_path that are neither testonly nor manual
result.json codeql_result.json, lint_result.json (exit code, findings)
report: coverage_summary.md, coverage-report/coverage_report.dat report: static_analysis_summary.md (module, status, codeql, lint), static-analysis-report/<module>+/
module_tests.yml job Test <module> module_tests.yml jobs CodeQL <module>, Lint <module> (matrix from module_tests.py static-analysis-modules)
test_and_docs.yml downloads module-tests-* downloads module-* (tests, codeql, lint)

Files:

  • scripts/module_tests.py, scripts/tests/test_module_tests.py
  • .github/workflows/module_tests.yml, .github/workflows/test_and_docs.yml
  • docs/verification_report/static_analysis_summary.md (placeholder, like coverage_summary.md), linked in platform_verification_report.rst
  • known_good.json: contract patches in bazel_patches; score_tools, score_docs_as_code, score_cpp_policies pinned (see above). Regenerated bazel_common/score_modules_target_sw.MODULE.bazel, bazel_common/score_modules_tooling.MODULE.bazel, MODULE.bazel.lock.
  • .github/workflows/static_analysis_preview.yml (temporary): on push to this branch, calls this branch's module_tests.yml, then runs report and builds the docs (artifact static-analysis-preview-docs). Needed because PR runs of test_and_docs.yml use main's workflows (pull_request_target).

CI

  • Run 45619275548 (87d00395): all CodeQL, lint and docs jobs green. Lint of logging, time and config_management ran without the clang-tidy baseline (RI's --override_module pinned score_cpp_policies 0.1.2 over the patches' git_override), fixed by pinning score_cpp_policies in known_good.json.
  • Run 45630745091 (6d5a4b16, module_tests.yml integration + score_cpp_policies pin): all 25 jobs green (8 Test, 7 CodeQL, 8 Lint, docs). clang-tidy findings with the baseline: time 1761, logging 2502, config_management 5871. static_analysis_summary.md in the platform verification report; findings in the module verification reports of baselibs, lifecycle, persistency (logging and time components have no code_targets yet). CodeQL jobs take up to ~60 min.

Open

  • Upstream the module patches; add each module to STATIC_ANALYSIS_MODULES upstream state instead of a patch.
  • Merge and release tools#79, docs-as-code#1072, score_cpp_policies#52; replace the pinned commits with releases.
  • Delete static_analysis_preview.yml.

@github-actions

Copy link
Copy Markdown

The created documentation from the pull request is available at: docu-html

Replaces the analysis of the integrated modules from ref_int's root (which needed the
score_tools patch for external sources and the source root) with one CodeQL run per
C++ module, set up like module_tests.py run: the module as root workspace with
ref_int's resolved versions pinned. Its code-scanning.sarif is rebased into ref_int's
external/<module>+/ namespace (as normalize_lcov) and fed to the docs build.
docs-as-code: v9.1.1 + POC commits (poc/static-analysis-report-v9.1.1).
…olicies

Each module is linted as root workspace with ref_int's versions, like the
CodeQL analysis: score_cpp_policies' clang-tidy baseline (plus the module's
own .clang-tidy), score_rust_policies' clippy_strict and ruff, all through
aspect_rules_lint with SARIF output. The SARIF files go into the module
verification reports next to the CodeQL findings; docs-as-code with
de-duplication and per-tool classification.
…d configs

Each module gets a patch (patches/<module>/*-static-analysis-contract.patch) with what it should
carry itself later, like its llvm_cov config for coverage: a //quality/static_analysis:codeql
target (score_tools codeql_analysis) and a --config=lint with the central clang-tidy/clippy/ruff
policies and the SARIF parser. module_tests.py only runs them with ref_int's versions and
platform and rebases the SARIF.
docs-as-code now reads static-analysis-report/<repository>/ as that repository's
workspace (Bazel path cleanup, virtual includes, out-of-repository findings, per-target
rules_lint reports), so module_tests.py only copies the reports.
…t flags

build:lint_sarif = --config=lint plus SARIF output (rules_lint_machine) without failing
on findings, so the modules' own CI can use it as well.
@antonkri antonkri changed the title POC: CodeQL findings in module verification reports - DO NOT MERGE POC: static analysis findings (CodeQL, clang-tidy, clippy, ruff) in module verification reports - DO NOT MERGE Nov 25, 2026
…odeql

# Conflicts:
#	MODULE.bazel.lock
#	bazel_common/score_modules_target_sw.MODULE.bazel
#	known_good.json

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant