Skip to content

fix: resolve SonarQube reliability and maintainability issues#555

Merged
rygel merged 16 commits intodevelopfrom
feat/sonarqube-local
Apr 16, 2026
Merged

fix: resolve SonarQube reliability and maintainability issues#555
rygel merged 16 commits intodevelopfrom
feat/sonarqube-local

Conversation

@rygel
Copy link
Copy Markdown
Owner

@rygel rygel commented Apr 16, 2026

Summary

  • Resolve all reliability-impacting issues (S6966, S7781) to achieve 0 open reliability bugs
  • Fix 43 SonarQube issues across blocker, critical, and medium severities covering dead code removal, unused parameters, nested ternaries, incorrect assertions, and exception handling
  • Remove hardcoded API token from sonar-issues.ps1 utility script, now reads from environment variable

Changes by category

Rule Count Description
S2699 5 Added explicit assertions to blocker tests
S2701 5 Replaced Assert.Equal(true/false) with Assert.True/False
S6966 2 Used await RunAsync/CloseAndFlushAsync
S1144 13 Removed unused private methods, fields, setters
S1172 10 Removed unused method parameters
S3358 11 Extracted nested ternaries to if/else
S112 9 Replaced System.Exception with specific types
S108 5 Documented intentional empty catch blocks
S4144 1 Removed duplicate method
S1854 1 Removed useless assignment
S2971 1 Simplified LINQ
S4487 1 Removed unread field
S1186 1 Removed empty method
S2365 1 Removed unused property
S1118 2 Added protected constructors
S3881 2 Fixed IDisposable pattern
S6580 2 Used CultureInfo for date parsing
S6562 2 Specified DateTimeKind
S3010 1 Moved static field init

Test plan

  • All 1360 tests pass (1166 + 148 + 46 across 3 test projects)
  • Build succeeds with 0 errors
  • SonarQube scan shows 0 open reliability issues, 0 vulnerabilities

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Large PR Detected

This PR contains 1839 lines changed across 16 files.

Details:

  • 📁 Files changed: 16
  • ➕ Insertions: 1837
  • ➖ Deletions: 2
  • 📊 Total: 1839 lines

Recommendation:
Consider splitting this PR into smaller, focused changes to make review easier and faster. PRs under 500 lines are ideal for thorough code review.


This is an automated message. Feel free to ignore if this PR is intentionally large.

@rygel rygel force-pushed the feat/sonarqube-local branch from 493fe13 to a8eab0c Compare April 16, 2026 05:52
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Large PR Detected

This PR contains 1847 lines changed across 17 files.

Details:

  • 📁 Files changed: 17
  • ➕ Insertions: 1845
  • ➖ Deletions: 2
  • 📊 Total: 1847 lines

Recommendation:
Consider splitting this PR into smaller, focused changes to make review easier and faster. PRs under 500 lines are ideal for thorough code review.


This is an automated message. Feel free to ignore if this PR is intentionally large.

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Large PR Detected

This PR contains 1855 lines changed across 20 files.

Details:

  • 📁 Files changed: 20
  • ➕ Insertions: 1849
  • ➖ Deletions: 6
  • 📊 Total: 1855 lines

Recommendation:
Consider splitting this PR into smaller, focused changes to make review easier and faster. PRs under 500 lines are ideal for thorough code review.


This is an automated message. Feel free to ignore if this PR is intentionally large.

@rygel rygel force-pushed the feat/sonarqube-local branch from b612678 to 41f7a5e Compare April 16, 2026 06:08
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Large PR Detected

This PR contains 6192 lines changed across 59 files.

Details:

  • 📁 Files changed: 59
  • ➕ Insertions: 6186
  • ➖ Deletions: 6
  • 📊 Total: 6192 lines

Recommendation:
Consider splitting this PR into smaller, focused changes to make review easier and faster. PRs under 500 lines are ideal for thorough code review.


This is an automated message. Feel free to ignore if this PR is intentionally large.

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Large PR Detected

This PR contains 1857 lines changed across 21 files.

Details:

  • 📁 Files changed: 21
  • ➕ Insertions: 1851
  • ➖ Deletions: 6
  • 📊 Total: 1857 lines

Recommendation:
Consider splitting this PR into smaller, focused changes to make review easier and faster. PRs under 500 lines are ideal for thorough code review.


This is an automated message. Feel free to ignore if this PR is intentionally large.

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Large PR Detected

This PR contains 6194 lines changed across 59 files.

Details:

  • 📁 Files changed: 59
  • ➕ Insertions: 6187
  • ➖ Deletions: 7
  • 📊 Total: 6194 lines

Recommendation:
Consider splitting this PR into smaller, focused changes to make review easier and faster. PRs under 500 lines are ideal for thorough code review.


This is an automated message. Feel free to ignore if this PR is intentionally large.

@rygel rygel force-pushed the feat/sonarqube-local branch from 33aff31 to 3737ad3 Compare April 16, 2026 06:12
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Large PR Detected

This PR contains 1860 lines changed across 22 files.

Details:

  • 📁 Files changed: 22
  • ➕ Insertions: 1853
  • ➖ Deletions: 7
  • 📊 Total: 1860 lines

Recommendation:
Consider splitting this PR into smaller, focused changes to make review easier and faster. PRs under 500 lines are ideal for thorough code review.


This is an automated message. Feel free to ignore if this PR is intentionally large.

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Large PR Detected

This PR contains 1892 lines changed across 22 files.

Details:

  • 📁 Files changed: 22
  • ➕ Insertions: 1874
  • ➖ Deletions: 18
  • 📊 Total: 1892 lines

Recommendation:
Consider splitting this PR into smaller, focused changes to make review easier and faster. PRs under 500 lines are ideal for thorough code review.


This is an automated message. Feel free to ignore if this PR is intentionally large.

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Large PR Detected

This PR contains 1952 lines changed across 23 files.

Details:

  • 📁 Files changed: 23
  • ➕ Insertions: 1907
  • ➖ Deletions: 45
  • 📊 Total: 1952 lines

Recommendation:
Consider splitting this PR into smaller, focused changes to make review easier and faster. PRs under 500 lines are ideal for thorough code review.


This is an automated message. Feel free to ignore if this PR is intentionally large.

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Large PR Detected

This PR contains 1957 lines changed across 23 files.

Details:

  • 📁 Files changed: 23
  • ➕ Insertions: 1911
  • ➖ Deletions: 46
  • 📊 Total: 1957 lines

Recommendation:
Consider splitting this PR into smaller, focused changes to make review easier and faster. PRs under 500 lines are ideal for thorough code review.


This is an automated message. Feel free to ignore if this PR is intentionally large.

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Large PR Detected

This PR contains 1975 lines changed across 24 files.

Details:

  • 📁 Files changed: 24
  • ➕ Insertions: 1928
  • ➖ Deletions: 47
  • 📊 Total: 1975 lines

Recommendation:
Consider splitting this PR into smaller, focused changes to make review easier and faster. PRs under 500 lines are ideal for thorough code review.


This is an automated message. Feel free to ignore if this PR is intentionally large.

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Large PR Detected

This PR contains 1983 lines changed across 24 files.

Details:

  • 📁 Files changed: 24
  • ➕ Insertions: 1936
  • ➖ Deletions: 47
  • 📊 Total: 1983 lines

Recommendation:
Consider splitting this PR into smaller, focused changes to make review easier and faster. PRs under 500 lines are ideal for thorough code review.


This is an automated message. Feel free to ignore if this PR is intentionally large.

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Large PR Detected

This PR contains 1985 lines changed across 25 files.

Details:

  • 📁 Files changed: 25
  • ➕ Insertions: 1937
  • ➖ Deletions: 48
  • 📊 Total: 1985 lines

Recommendation:
Consider splitting this PR into smaller, focused changes to make review easier and faster. PRs under 500 lines are ideal for thorough code review.


This is an automated message. Feel free to ignore if this PR is intentionally large.

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Large PR Detected

This PR contains 2002 lines changed across 25 files.

Details:

  • 📁 Files changed: 25
  • ➕ Insertions: 1954
  • ➖ Deletions: 48
  • 📊 Total: 2002 lines

Recommendation:
Consider splitting this PR into smaller, focused changes to make review easier and faster. PRs under 500 lines are ideal for thorough code review.


This is an automated message. Feel free to ignore if this PR is intentionally large.

@rygel
Copy link
Copy Markdown
Owner Author

rygel commented Apr 16, 2026

PR Grade: B+ (provisionally A- once CI is green)

Rationale:

  • Scope is focused and directly addresses the Sonar blockers and local scanner reliability.
  • Validation was run locally (pre-commit-check and end-to-end Sonar upload).
  • Remaining risk is CI status: multiple required checks are still pending at this moment.

Promotion criteria to A:

  • All required GitHub checks pass on commit 5ecce45a.

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Large PR Detected

This PR contains 2007 lines changed across 25 files.

Details:

  • 📁 Files changed: 25
  • ➕ Insertions: 1959
  • ➖ Deletions: 48
  • 📊 Total: 2007 lines

Recommendation:
Consider splitting this PR into smaller, focused changes to make review easier and faster. PRs under 500 lines are ideal for thorough code review.


This is an automated message. Feel free to ignore if this PR is intentionally large.

@rygel
Copy link
Copy Markdown
Owner Author

rygel commented Apr 16, 2026

Coverage update applied:

  • scripts/sonar.ps1 now collects coverage with dotnet test --collect:"XPlat Code Coverage;Format=opencover".
  • Sonar begin now uses sonar.cs.opencover.reportsPaths=TestResults/**/coverage.opencover.xml.
  • Verified local run imports coverage successfully (Coverage Report Statistics: 199 main files with coverage).
  • New-code Sonar issues remain at 0.

- Fix S2699: Add explicit assertions to 5 blocker tests
- Fix S2701: Replace Assert.Equal(true/false) with Assert.True/False
- Fix S6966: Use await RunAsync/CloseAndFlushAsync in Web Program.cs
- Fix S7781: Use replaceAll over replace in fix_resources.js
- Fix S1144: Remove unused private methods, fields, and setters
- Fix S1172: Remove unused method parameters and their call sites
- Fix S4144: Remove duplicate TryReadAuthDuplicate method
- Fix S1854: Remove useless assignment in OpenRouterProvider
- Fix S2971: Simplify LINQ .Where().FirstOrDefault() to .FirstOrDefault()
- Fix S3358: Extract 11 nested ternary operations into if/else chains
- Fix S112: Replace System.Exception throws with specific exception types
- Fix S108: Add comments to intentional empty catch blocks
- Fix S4487: Remove unread _debugMode field and SetDebugMode method
- Fix S1186: Remove empty Configure method from Web Program.cs
- Fix S2365/S3358: Remove unused MainWindowVisibilityItems property
- Fix S1118: Add protected constructors to Program classes
- Fix S3881: Fix IDisposable implementations to conform to dispose pattern
- Fix S6580: Use CultureInfo.InvariantCulture for date parsing
- Fix S6562: Specify DateTimeKind for DateTime creation
- Fix S3010: Move static field assignment to static method
- Add sonar-issues.ps1 utility script for querying SonarQube API
@rygel rygel force-pushed the feat/sonarqube-local branch from 1edfe85 to 024ade5 Compare April 16, 2026 10:55
@rygel rygel changed the title feat: add SonarQube local analysis setup fix: resolve SonarQube reliability and maintainability issues Apr 16, 2026
- ProviderDerivedModelAssignmentResolver: 15 tests (was 7.7%)
- MonitorLauncherProcessController: 20 tests (was 15.2%)
- GitHubAuthService: 15 tests (was 28.9%)
- GitHubUpdateChecker: 10 tests (was 33.3%)
- WebDatabaseService: 10 tests (was 46.8%)
- AntigravityProvider: 20 tests (was 47.2%)
- ConfigService: 11 tests (was 52.1%)
- ProviderManager: 15 tests (was 61.9%)
- Update sonar.ps1 to collect coverage from all test projects
- Update sonar-issues.ps1 for coverage-by-file queries
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Large PR Detected

This PR contains 2710 lines changed across 60 files.

Details:

  • 📁 Files changed: 60
  • ➕ Insertions: 2256
  • ➖ Deletions: 454
  • 📊 Total: 2710 lines

Recommendation:
Consider splitting this PR into smaller, focused changes to make review easier and faster. PRs under 500 lines are ideal for thorough code review.


This is an automated message. Feel free to ignore if this PR is intentionally large.

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Large PR Detected

This PR contains 2717 lines changed across 60 files.

Details:

  • 📁 Files changed: 60
  • ➕ Insertions: 2263
  • ➖ Deletions: 454
  • 📊 Total: 2717 lines

Recommendation:
Consider splitting this PR into smaller, focused changes to make review easier and faster. PRs under 500 lines are ideal for thorough code review.


This is an automated message. Feel free to ignore if this PR is intentionally large.

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Large PR Detected

This PR contains 2708 lines changed across 60 files.

Details:

  • 📁 Files changed: 60
  • ➕ Insertions: 2254
  • ➖ Deletions: 454
  • 📊 Total: 2708 lines

Recommendation:
Consider splitting this PR into smaller, focused changes to make review easier and faster. PRs under 500 lines are ideal for thorough code review.


This is an automated message. Feel free to ignore if this PR is intentionally large.

@rygel rygel merged commit ede4c9f into develop Apr 16, 2026
21 checks passed
@rygel rygel deleted the feat/sonarqube-local branch April 16, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants