Skip to content

Clear two analyzer warnings on dev (CA1068 in DarlingAgReader, CA2249 in FactAdvice) - #4491

Merged
erikdarlingdata merged 1 commit into
devfrom
fix/dev-two-analyzer-warnings
Sep 27, 2026
Merged

erikdarlingdata merged 1 commit into
devfrom
fix/dev-two-analyzer-warnings

Conversation

@erikdarlingdata

Copy link
Copy Markdown
Owner

REPORT: branch fix/dev-two-analyzer-warnings @ 11bb395, off origin/dev @ d909622. macOS build (Release, EnableWindowsTargeting=true): Darling.Tests 0 Warning(s) / 0 Error(s); Lite.Tests 0 Warning(s) / 0 Error(s). No CA1068/CA2249 lines in either build's output.

Why

dev's Windows CI build job went from 0 warnings to 2 after recent merges: CA1068 (DarlingAgReader.GetAgHealthAsync put an optional limit parameter after the CancellationToken) and CA2249 (FactAdvice.IsVowel used "aeiouAEIOU".IndexOf(c) >= 0 where .Contains(c) says the same thing more directly). The release needs a zero-warning Windows build.

What changes

  • DarlingAgReader.GetAgHealthAsync: moved the int? limit = null parameter to sit before CancellationToken cancellationToken = default, matching the analyzer's required parameter order. Updated every caller that passed the token positionally (three test files) to name the token (cancellationToken: ct) so the argument still lands on the right parameter; the one production caller in DarlingMcpAgTools.cs already used named arguments and needed no change. The /api/ag endpoint caller in DarlingWebEndpoints.cs was passing the token positionally too and now names it.
  • FactAdvice.IsVowel: replaced "aeiouAEIOU".IndexOf(c) >= 0 with "aeiouAEIOU".Contains(c). Same result, no behavior change.
  • No suppressions were used for either warning.

Test plan

Pure signature reorder and a string-search rewrite; no behavior change, so no RED/GREEN pin is required here. The pin is the Windows CI build's Warning(s) count at this PR's head, which is read from the build log before review.

Ran locally on macOS (in-process, Microsoft.WindowsDesktop.App stripped from the runtimeconfig):

  • DarlingMcpAgToolsSurfaceTests: 6/6 passed.
  • DarlingMcpAgToolsLivePostgresTests: 8 total, 8 skipped (no rig on this machine).
  • AvailabilityGroupCountReadTests: 2 total, 1 skipped (live, no rig).
  • DarlingAgStatesReaderLiveEqualityTests: 2 total, 2 skipped (live, no rig).
  • FactAdvicePluralTests: 4/4 passed.
  • FactAdvicePluralWiringTests: 2/2 passed.
  • DocCommentHygieneTests: 77/77 passed.

Also built Darling.Tests.csproj and Lite.Tests.csproj in Release with -p:EnableWindowsTargeting=true, grepping for warning CA1068|warning CA2249|Warning\(s\): both projects report 0 Warning(s) / 0 Error(s). Darling.Tests/Lite.Tests target net10.0-windows and build here but cannot run their WPF-touching members on macOS; none of the classes run above touch PresentationFramework, so all listed results are real runs, not skips-for-platform-reasons.

Grepped for any source-text pin on the GetAgHealthAsync signature or call shape across the census/source test files; found none, so no additional test needed updating.

CHANGELOG

None: an analyzer cleanup (a parameter reorder, IndexOf → Contains); no user-visible change.

CA1068 in DarlingAgReader.GetAgHealthAsync (limit was after the CancellationToken;
moved before it and updated callers to name the token). CA2249 in FactAdvice.IsVowel
(IndexOf(c) >= 0 replaced with Contains(c)). No behavior change.
@erikdarlingdata
erikdarlingdata marked this pull request as ready for review September 27, 2026 18:58
@erikdarlingdata
erikdarlingdata merged commit 672b967 into dev Sep 27, 2026
15 of 16 checks passed
@erikdarlingdata
erikdarlingdata deleted the fix/dev-two-analyzer-warnings branch September 27, 2026 18:58
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