Skip to content

Codeql rollout - #698

Open
ANegm-ETAS wants to merge 6 commits into
eclipse-score:mainfrom
etas-contrib:codeql-rollout
Open

ANegm-ETAS wants to merge 6 commits into
eclipse-score:mainfrom
etas-contrib:codeql-rollout

Conversation

@ANegm-ETAS

@ANegm-ETAS ANegm-ETAS commented Sep 24, 2026 •

Copy link
Copy Markdown

Introduction of codeql nightly workflow

- you are bumping the CodeQL bundle or the coding-standards pack version.

## The pipeline in one picture
`bazel run //quality/static_analysis:codeql_lint -- --target //score/message_passing //score/mw/com`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Target names are from mw::com and do not fit to lifecycle


### 4. Diagnosing local-vs-CI divergence: check the published number's provenance FIRST
CI publishes its results to GitHub Pages (no auth needed):
`https://eclipse-score.github.io/communication/latest/quality/codeql_findings.sarif` (full SARIF) and

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link to com repo

bazel run //quality/static_analysis:codeql_lint -- \
--build-config qnx \
--output-dir /tmp/codeql-results/qnx --output-prefix codeql-nightly-qnx \
--target //score/message_passing //score/mw/com

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

com targets

CPP_CODE_SCANNING_SPEC = "codeql/cpp-queries:codeql-suites/cpp-code-scanning.qls"
ALERT_SUPPRESSION_SPEC = "codeql/cpp-queries:AlertSuppression.ql"

# Local, uncompiled query pack (ported from vsps_quality_packages//tools/codeql/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess any references to internal repos shall be removed

bazel run --config=x86_64-linux //quality/static_analysis:codeql_lint -- \
--output-dir /tmp/codeql-results/linux \
--output-prefix codeql-nightly \
--target //score/...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not have "--report" - if I understood correctly - it runs only the misra checks, is this intended?

# to apply those patches back to the workspace.
build:clang-tidy-fix --config=clang-tidy
build:clang-tidy-fix --@aspect_rules_lint//lint:fix
build:clang-tidy-fix --output_groups=+rules_lint_patch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a lot of other stuff in here unrelated to codeql which is partially conflicting to this repo (e.g. different clang-tidy setup).

I would recommend to only keep the codeql part here for this PR

@@ -0,0 +1,203 @@
# MISRA C++:2023 Guideline Enforcement Plan (GEP)

This is the guideline enforcement plan for S-CORE communication for MISRA C++:2023.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems specific to communication repo. I would prefer to remove it

# it runs standalone. `data = glob(["**"])` keeps its (unused but harmless)
# companion files (*.pdb, *.xml, *.dll.config) alongside it in runfiles, in
# case of any relative-path lookups.
sh_binary(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this just go into the BUILD file (which is currently empty)?

Comment thread MODULE.bazel
# union). Fetched by pinned URL + sha256 (like codeql_bundle above) rather
# than via `npx` at runtime, so the merge step needs no network access and is
# fully reproducible.
http_archive(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to remove the overly detailed comments from the file

@@ -0,0 +1,315 @@
---

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot really judge the content due to lack of experience with codeql.

I wonder if we shall keep this PR minimal and only take over additional stuff on demand.
I would be in favor of removing the .github/skills/codeql-analysis for now and first getting some experience with the new tool

@NicolasFussberger

Copy link
Copy Markdown
Contributor

When running the following locally I get the following error:

bazel run --config=x86_64-linux //quality/static_analysis:codeql_lint --   --output-dir ./_SCA/codeql-results/linux   --target //score/...

Error:

Shutting down query evaluator.
Interpreting results.
CodeQL scanned 229 out of 596 C/C++ files in this invocation. Typically CodeQL is configured to analyze a single CodeQL language per invocation, so check other invocations to determine overall coverage information.
 Generating MISRA/CERT compliance reports...
 Resolved CodeQL bin dir: /var/cache/bazel/625205d1e0aa59ca514fd964120d6a8a/external/+_repo_rules2+codeql_bundle/codeql
 CodeQL bin dir exists: True
 PATH for analysis_report: /var/cache/bazel/625205d1e0aa59ca514fd964120d6a8a/external/+_repo_rules2+codeql_bundle/codeql:/home/vscode/.cache/bazelisk/downloads/sha256/d7606e679b78067c811096fb3d6cf135225b528835ca396e3a4dddf957859544/bin:/home/vscode/.vscode-server/data/User/globalStorage/github.copilot-chat/debugCommand:/home/vscode/.vscode-server/data/User/globalStorage/github.copilot-chat/copilotCli:/vscode/vscode-server/bin/linux-x64/2242ebbb54efeeb0129e08e919e7e8d43033cd83/bin/remote-cli:/home/vscode/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/vscode/.local/bin:/home/vscode/.vscode-server/extensions/ms-python.debugpy-2026.6.0-linux-x64/bundled/scripts/noConfigScripts
 [analysis_report stdout]: Running the diagnostic queries...
Decoding diagnostic query results
Running the deviation query...
 [analysis_report stderr]: /var/cache/bazel/625205d1e0aa59ca514fd964120d6a8a/execroot/_main/bazel-out/k8-fastbuild/bin/quality/static_analysis/codeql_lint.runfiles/+_repo_rules2+codeql_coding_standards/scripts/reports/utils.py:15: SyntaxWarning: invalid escape sequence '\d'
  return tuple(int(x) if x.isdigit() else x for x in filter(len, filter(None, re.split("(\d+)|-", rule_id))))
Error: Failed to run deviation query
==== reason ====
Unable to run queries: /var/cache/bazel/625205d1e0aa59ca514fd964120d6a8a/execroot/_main/bazel-out/k8-fastbuild/bin/quality/static_analysis/codeql_lint.runfiles/+_repo_rules2+codeql_coding_standards/cpp/common/src/codingstandards/cpp/deviations/ListDeviationRecords.ql,/var/cache/bazel/625205d1e0aa59ca514fd964120d6a8a/execroot/_main/bazel-out/k8-fastbuild/bin/quality/static_analysis/codeql_lint.runfiles/+_repo_rules2+codeql_coding_standards/cpp/common/src/codingstandards/cpp/deviations/InvalidDeviationRecords.ql,/var/cache/bazel/625205d1e0aa59ca514fd964120d6a8a/execroot/_main/bazel-out/k8-fastbuild/bin/quality/static_analysis/codeql_lint.runfiles/+_repo_rules2+codeql_coding_standards/cpp/common/src/codingstandards/cpp/deviations/ListDeviationPermits.ql,/var/cache/bazel/625205d1e0aa59ca514fd964120d6a8a/execroot/_main/bazel-out/k8-fastbuild/bin/quality/static_analysis/codeql_lint.runfiles/+_repo_rules2+codeql_coding_standards/cpp/common/src/codingstandards/cpp/deviations/InvalidDeviationPermits.ql!
==== returncode ====
2
   analysis_report exited with code 1

@NicolasFussberger

Copy link
Copy Markdown
Contributor

From the codeql output:

CodeQL scanned 229 out of 596 C/C++ files in this invocation. Typically CodeQL is configured to analyze a single CodeQL language per invocation, so check other invocations to determine overall coverage information.

We have rust and C++ code in the repo. Do we need to handle them separately in codeql?

bazel run --config=x86_64-linux //quality/static_analysis:codeql_lint -- \
--output-dir /tmp/codeql-results/linux \
--output-prefix codeql-nightly \
--target //score/...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this does the analysis as well for test code, is this intended?

| `cpp-code-scanning` | CodeQL security/quality suite (`cpp-code-scanning.qls`) | 57 |
| `cert-cpp-l1` | CERT C++ L1 (`cert-cpp-l1.qls`) | 23 |
| `cert-c-l1` | CERT C L1 (`cert-c-l1.qls`) | 18 |
| `code-complexity` | local metrics pack (`code-complexity-queries:suites/thresholds.qls`) | 6 |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this list up to date?

codeql_lint.py: error: argument --report: invalid choice: 'cert-cpp-l1' (choose from default, codeql-report-complexity)

# Optional record fields: `raised-by` / `approved-by` (name + date) and
# `permit-id` (see `deviation-permits`).
# -----------------------------------------------------------------------------
deviations: []

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do direct inline suppressions in the code also work without any reference to a deviation in this yaml file?

This branch is waiting to be deployed

1 waiting deployment
workflow-approval — 819897e7 Waiting Sep 25, 2026 by ANegm-ETAS via Build and test arm64-qnx / approval #1037
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants