Skip to content

fix: resolve SonarCloud and CodeQL code-quality issues - #37

Merged
Malcolmnixon merged 4 commits into
mainfrom
fix/code-quality-sonarcloud-codeql-issues
Aug 28, 2026
Merged

fix: resolve SonarCloud and CodeQL code-quality issues#37
Malcolmnixon merged 4 commits into
mainfrom
fix/code-quality-sonarcloud-codeql-issues

Conversation

@Malcolmnixon

Copy link
Copy Markdown
Member

Addresses 33 SonarCloud issues and 1 CodeQL issue flagged in CI run 33139770834:

  • CA1861 (21x): hoist repeated array literals to static readonly fields
  • CA1859 (7x): narrow declared types to concrete implementations where safe
  • CA1816: correct GC.SuppressFinalize usage in AppiumTestBase.Dispose
  • CA1822: make RollingFileLogger member static (no instance state used)
  • S107: reduce MainWindowShell constructor parameter count by introducing a MainWindowShellDependencies record, updating all call sites
  • S3011: avoid reflection-based accessibility bypass in SourceTextDocumentView
  • S1075: remove hardcoded URI in SourceTextDocumentView
  • CodeQL cs/useless-cast-to-self in MainWindowShellUiTests

Verified via code-review and formal-review (gpt-5.4-mini) across all affected review-sets with no findings. Build clean (0 warnings/errors); all 318 tests pass (9 UiTests + 283 Tests + 26 OtsSoftwareTests), matching the pre-change baseline exactly.

Malcolm Nixon and others added 4 commits August 28, 2026 00:11
Addresses 33 SonarCloud issues and 1 CodeQL issue flagged in CI run 33139770834:
- CA1861 (21x): hoist repeated array literals to static readonly fields
- CA1859 (7x): narrow declared types to concrete implementations where safe
- CA1816: correct GC.SuppressFinalize usage in AppiumTestBase.Dispose
- CA1822: make RollingFileLogger member static (no instance state used)
- S107: reduce MainWindowShell constructor parameter count by introducing
  a MainWindowShellDependencies record, updating all call sites
- S3011: avoid reflection-based accessibility bypass in SourceTextDocumentView
- S1075: remove hardcoded URI in SourceTextDocumentView
- CodeQL cs/useless-cast-to-self in MainWindowShellUiTests

Verified via code-review and formal-review (gpt-5.4-mini) across all
affected review-sets with no findings. Build clean (0 warnings/errors);
all 318 tests pass (9 UiTests + 283 Tests + 26 OtsSoftwareTests), matching
the pre-change baseline exactly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixes cspell CI failure on the NOSONAR suppression comments introduced
by the code-quality fix pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Changes BuildFolderChildren's return type from IReadOnlyList<WorkspaceTreeNode>
to List<WorkspaceTreeNode>, matching CA1859 guidance. Safe because the only
caller assigns it directly to WorkspaceSourceNode.Children (already typed
IReadOnlyList<WorkspaceTreeNode>, so the narrower concrete type still
satisfies it), and ToTreeNodes (which BuildFolderChildren delegates to
in the multi-file-per-folder case) already returns List<WorkspaceTreeNode>.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
CI's Test step passes --collect "XPlat Code Coverage;Format=opencover",
but no test project referenced coverlet.collector, so dotnet test
silently produced zero coverage files and SonarCloud always saw 0%
new-code coverage regardless of actual test coverage. This has been
the case since before this session's changes (confirmed via git log -S
across the whole repo history), not something introduced recently.

Adds coverlet.collector 10.0.1 to DemaConsulting.SysML2Workbench.Tests,
UiTests, and OtsSoftwareTests (the three in-process test tiers).
IntegrationTests is intentionally excluded: it drives the published
Desktop app externally via Appium/WebDriver with no ProjectReference,
so in-process code coverage collection does not apply to that tier.

Verified locally: dotnet test with the same --collect flag CI uses now
produces coverage.opencover.xml under each test project's results
folder (previously produced none); all 318 tests still pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Malcolmnixon
Malcolmnixon merged commit f1c8eec into main Aug 28, 2026
7 checks passed
@Malcolmnixon
Malcolmnixon deleted the fix/code-quality-sonarcloud-codeql-issues branch August 28, 2026 05:12
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