Skip to content

fix: scope CodeQL to real source and remove redundant cast - #61

Merged
Malcolmnixon merged 1 commit into
mainfrom
fix/codeql-scope-and-redundant-cast
Aug 28, 2026
Merged

fix: scope CodeQL to real source and remove redundant cast#61
Malcolmnixon merged 1 commit into
mainfrom
fix/codeql-scope-and-redundant-cast

Conversation

@Malcolmnixon

Copy link
Copy Markdown
Member

CI run 32755201459's "Display CodeQL Quality Report" step reported 745 cs/useless-cast-to-self findings. Filtering that report showed 744 of 745 were in obj//generated/ files (System.Text.Json source-generator output for AstSerializerContext/QueryResultSerializerContext), which are build outputs, not hand-written source, and are already excluded from lint/review per this repo's scope-discipline rules. CodeQL's default scan was not excluding obj/, so every generated file's redundant self-casts (an artifact of the source generator's own template, not something this repo controls) were reported repeatedly.

Adds "/obj/" and "/bin/" to codeql-config.yml's paths-ignore, alongside the existing ANTLR4-generated-parser exclusion, so CodeQL only analyzes real source going forward.

The one remaining genuine finding - a redundant
(IReadOnlyList) cast on the empty-array literal in InterconnectionViewLayoutStrategy.MakePartBox - is fixed directly: removed the explicit cast since the ternary's other branch (TranslateNodes(...)) already returns IReadOnlyList, so the compiler infers the same type for the empty-array branch without it.

Verified: build succeeds (0 errors) with the cast removed.

CI run 32755201459's "Display CodeQL Quality Report" step reported 745
cs/useless-cast-to-self findings. Filtering that report showed 744 of
745 were in obj/**/generated/** files (System.Text.Json
source-generator output for AstSerializerContext/QueryResultSerializerContext),
which are build outputs, not hand-written source, and are already
excluded from lint/review per this repo's scope-discipline rules.
CodeQL's default scan was not excluding obj/, so every generated file's
redundant self-casts (an artifact of the source generator's own
template, not something this repo controls) were reported repeatedly.

Adds "**/obj/**" and "**/bin/**" to codeql-config.yml's paths-ignore,
alongside the existing ANTLR4-generated-parser exclusion, so CodeQL
only analyzes real source going forward.

The one remaining genuine finding - a redundant
(IReadOnlyList<LayoutNode>) cast on the empty-array literal in
InterconnectionViewLayoutStrategy.MakePartBox - is fixed directly:
removed the explicit cast since the ternary's other branch
(TranslateNodes(...)) already returns IReadOnlyList<LayoutNode>, so the
compiler infers the same type for the empty-array branch without it.

Verified: build succeeds (0 errors) with the cast removed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Malcolmnixon
Malcolmnixon merged commit 0f616e6 into main Aug 28, 2026
9 checks passed
@Malcolmnixon
Malcolmnixon deleted the fix/codeql-scope-and-redundant-cast branch August 28, 2026 13:20
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