Skip to content

fix: resolve ~400 SonarQube maintainability and Roslyn analyzer issues#560

Merged
rygel merged 1 commit intodevelopfrom
fix/sonarqube-maintainability-roslyn
Apr 16, 2026
Merged

fix: resolve ~400 SonarQube maintainability and Roslyn analyzer issues#560
rygel merged 1 commit intodevelopfrom
fix/sonarqube-maintainability-roslyn

Conversation

@rygel
Copy link
Copy Markdown
Owner

@rygel rygel commented Apr 16, 2026

Summary

Fixes ~400 SonarQube maintainability issues across 68 files, including:

High-impact fixes:

  • MA0076 (136): Add CultureInfo.InvariantCulture to interpolated strings to avoid culture-sensitive ToString() calls
  • CA1860 (16): Replace .Any() with .Count > 0 for collections with Count property
  • CA1859 (15): Use concrete return types instead of interface return types
  • CA1861 (14): Extract inline arrays to static readonly fields
  • CA1869 (11): Cache JsonSerializerOptions as static readonly fields
  • MA0159 (12): Use Order() instead of OrderBy()
  • MA0089 (18): Use char overloads instead of single-char strings
  • MA0020 (13): Replace .All() with .TrueForAll() for List<T>

Reliability fixes:

  • S6677 (1): Make log template placeholders unique
  • S108 (4): Fill empty catch blocks in notification services
  • S1118 (1): Make ProviderRefreshConfigSelector a static class
  • S4487 (1): Remove unread private field _configSelector
  • S2139 (1): Pass exception to logger with context

Code quality:

  • xUnit1030 (23): Remove ConfigureAwait(false) from test methods
  • CA1816 (5): Add GC.SuppressFinalize to Dispose methods
  • MA0042 (5): Use await using for IAsyncDisposable
  • MA0053 (5): Seal internal/private classes
  • SYSLIB1054 (1): Use LibraryImport instead of DllImport
  • CA1822 (3): Make non-instance methods static
  • CA1835 (2): Use Memory<byte> overloads
  • CA1845 (1): Use AsSpan + string.Concat
  • SA1210, SA1502: Style/Formatting fixes

Note: 54 VSTHRD111 (ConfigureAwait) issues in test code are intentionally skipped - they conflict with xUnit1030.

Test plan

  • dotnet build - 0 errors, 0 warnings
  • All 1,491 tests pass across 3 test projects
  • SonarQube scan to verify issue reduction

- MA0076 (136): Add CultureInfo.InvariantCulture to interpolated strings
- VSTHRD111 (54): False positives in test code - conflict with xUnit1030
- MA0003 (28): Use named parameters for clarity
- MA0020 (13): Replace All() with TrueForAll() for List<T>
- CA1860 (16): Prefer Count > 0 over Any()
- IDE0028 (35): Simplify collection initialization
- CA1859 (15): Use concrete return types instead of interfaces
- CA1861 (14): Extract inline arrays to static readonly fields
- MA0089 (18): Use char overloads instead of single-char strings
- CA1869 (11): Cache JsonSerializerOptions as static readonly
- MA0159 (12): Use Order instead of OrderBy
- xUnit1030 (23): Remove ConfigureAwait(false) from test methods
- IDE0055 (8): Fix formatting
- CA1816 (5): Add GC.SuppressFinalize to Dispose methods
- CA1822 (3): Make non-instance methods static
- MA0042 (5): Use await using for IAsyncDisposable
- MA0053 (5): Seal internal classes
- MA0006 (6): Use string.Equals for string comparisons
- MA0075 (1): Fix implicit culture-sensitive ToString
- MA0078 (1): Use Cast<> instead of Select
- MA0071 (1): Remove redundant else
- MA0160 (2): Use ContainsKey instead of TryGetValue
- MA0031 (2): Replace Count() > 1 with Skip(1).Any()
- S6677 (1): Make log template placeholders unique
- S108 (4): Fill empty catch blocks
- S1118 (1): Make ProviderRefreshConfigSelector static
- S1133 (1): Add removal date to obsolete attribute
- S4487 (1): Remove unread private field
- S2139 (1): Pass exception to logger
- SYSLIB1054 (1): Use LibraryImport instead of DllImport
- SA1210 (1): Reorder using directives
- SA1502 (1): Expand single-line element
- CA1835 (2): Use Memory<byte> overloads for ReadAsync/WriteAsync
- CA1845 (1): Use AsSpan + string.Concat
@rygel rygel merged commit 0bcab9c into develop Apr 16, 2026
19 checks passed
@rygel rygel deleted the fix/sonarqube-maintainability-roslyn branch April 16, 2026 17:32
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.

2 participants