Skip to content

docs(backlog): the CodeQL generated-code noise recurred under a new rule - #295

Merged
thiagoluga merged 1 commit into
masterfrom
docs/codeql-generated-code-recurrence
Aug 19, 2026
Merged

docs(backlog): the CodeQL generated-code noise recurred under a new rule#295
thiagoluga merged 1 commit into
masterfrom
docs/codeql-generated-code-recurrence

Conversation

@thiagoluga

Copy link
Copy Markdown
Owner

Docs only.

What happened

PR #292 excluded cs/nested-if-statements after it fired twice on System.Text.RegularExpressions source-generator output. The next master scan produced #310/#311cs/useless-assignment-to-local, the same generated file.

Alerts Rule Date
#157 / #158 cs/nested-if-statements 2026-07-16
#307 / #308 cs/nested-if-statements 2026-08-17
#310 / #311 cs/useless-assignment-to-local 2026-08-19

Four alerts, two rules, one cause: the C# extractor analyses compilation units from the build, so generated code has no checkout file for paths-ignore to match — and every maintainability rule in the suite is a candidate to fire on it. My own #292 fix treated the symptom.

What I am not doing

A third exclusion. That is whack-a-mole, and the pattern is now established well enough to say so.

The mechanism fix, left to you

queries: security-and-quality in .github/workflows/codeql.yml is what pulls in maintainability rules like these two. security-extended keeps every security query and drops the class entirely.

That fits how this repo already divides the work — SonarCloud owns quality (and analyses real source, not build output), CodeQL owns security.

Not doing it autonomously: it narrows what a security scanner reports, which is not a call to make quietly. The four alerts are dismissed with this reasoning meanwhile, so the repository's open-alert count stays at 0.

PR #292 excluded cs/nested-if-statements after it fired twice on regex
source-generator output. The next master scan produced #310/#311 —
cs/useless-assignment-to-local, same generated file. Four alerts, two
rules, one cause: the C# extractor analyses compilation units from the
build, so generated code has no checkout file for paths-ignore to match,
and every maintainability rule in the suite is a candidate.

Recording rather than adding a third exclusion. The mechanism fix is to
drop the quality half of the query suite (security-and-quality ->
security-extended), which fits how this repo already divides the work:
SonarCloud owns quality and analyses real source, CodeQL owns security.

Left to the maintainer because it narrows what a security scanner
reports. The four alerts are dismissed with that reasoning meanwhile, so
the repo's open count stays at 0.

Docs only.
@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

@thiagoluga
thiagoluga merged commit 7b660f8 into master Aug 19, 2026
5 of 6 checks passed
@thiagoluga
thiagoluga deleted the docs/codeql-generated-code-recurrence branch August 19, 2026 17:45
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