Skip to content

Update CodeQL config to exclude generated code and documented catches - #24

Merged
Malcolmnixon merged 1 commit into
mainfrom
chore/codeql-config-remaining-findings
Jul 25, 2026
Merged

Update CodeQL config to exclude generated code and documented catches#24
Malcolmnixon merged 1 commit into
mainfrom
chore/codeql-config-remaining-findings

Conversation

@Malcolmnixon

Copy link
Copy Markdown
Member

This pull request introduces improvements to static analysis configuration and a minor test code update. The most significant changes are the addition of global ignores and targeted query suppressions in the CodeQL configuration, which help reduce noise from generated code and intentional design decisions, and a refinement to a unit test assertion.

CodeQL configuration improvements:

  • Added a paths-ignore section to .github/codeql-config.yml to globally exclude build output and generated files (e.g., obj/ and bin/ folders) from analysis.
  • Introduced query-filters in .github/codeql-config.yml to:
    • Suppress the cs/missed-ternary-operator warning in xUnit-generated files under obj/.
    • Suppress the cs/catch-of-all-exceptions warning in specific files where broad exception handling is intentional and documented, per project policy.

Test code update:

  • Updated the assertion in RestoreDockable_ReopensClosedToolInOriginalDock in DockTests.cs to use Assert.IsType<IToolDock>(..., exactMatch: false) for more precise type checking.

- Add paths-ignore for obj/bin build output to .github/codeql-config.yml.
- Exclude cs/missed-ternary-operator for xUnit-generated entry-point files
  under obj/, which cannot be hand-modified.
- Exclude cs/catch-of-all-exceptions for 7 files whose broad catches were
  already reviewed and documented as intentional UI event-handler/
  drag-drop/best-effort boundaries in the prior CodeQL cleanup (narrowing
  them would contradict their documented never-crash contracts). Mirrors
  the established pattern in ApiMark's .github/codeql-config.yml.
- Fix xUnit2032 in DockTests.cs: Assert.IsAssignableFrom -> Assert.IsType
  with exactMatch: false (functionally identical, clearer intent).

Validated: dotnet build (0 warnings/errors), build.ps1 -Test (290/290
passed), dotnet reqstream --lint (clean). Reviewed via a code-review agent
which confirmed all excluded catch sites are the documented intentional
ones with no mixed/undocumented sites.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Malcolmnixon
Malcolmnixon merged commit 1b6f1f7 into main Jul 25, 2026
7 checks passed
@Malcolmnixon
Malcolmnixon deleted the chore/codeql-config-remaining-findings branch July 25, 2026 01:16
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