Skip to content

Add the analyzer and package-reference checks - #185

Merged
milten89 merged 1 commit into
developfrom
chore/code-checks
Oct 30, 2026
Merged

milten89 merged 1 commit into
developfrom
chore/code-checks

Conversation

@milten89

Copy link
Copy Markdown
Owner

Closes #110

What

  • src/.editorconfig (new, src/ only): CA1031 (no general catch) and CA2007 (ConfigureAwait) are warnings; CI's TreatWarningsAsErrors makes them errors. src/ had no violations, so CA2007 is on (the issue's "if src is clean").
  • src/Directory.Build.targets: CheckPackageReferenceAllowList runs before each inner build's compile and fails when a src/ project references a package its allow-list (OpenUrzednikAllowedPackageReferences) doesn't name. SDK-implied references (IsImplicitlyDefined) and build-only ones (PrivateAssets="all", NBGV) are skipped.
    • Default (Core and providers): nothing on the .NET targets; System.Text.Json, System.Net.Http.Json, Microsoft.Bcl.TimeProvider, Microsoft.Bcl.HashCode on netstandard2.0.
    • OpenUrzednik.Diagnostics: System.Diagnostics.DiagnosticSource on netstandard2.0 only.
    • OpenUrzednik.Nbp.DependencyInjection: Microsoft.Extensions.Http, Microsoft.Extensions.Options, Polly.Core.
    • OpenUrzednik.Extensions.Logging: Microsoft.Extensions.Logging.Abstractions.
  • The check covers every src/ project, not only Core and Nbp as the issue says (maintainer decision).
  • ADR-0002 and ADR-0004: the Confirmation names the checks, each with a dated 2026-10-30 note. CLAUDE.md (catch, PackageReference, ConfigureAwait rules) and reviewer.md point to them.

Checks

  • CA1031 and CA2007 fire: a temporary probe file in Core with a general catch and an await without ConfigureAwait produced both warnings (file deleted).
  • The package check fails as intended: a temporary unconditional System.Text.Json reference in Core failed net8.0 and net10.0 with the new error and passed netstandard2.0 (csproj restored).
  • dotnet build OpenUrzednik.slnx: 0 warnings, 0 errors.
  • Tests -f net10.0 and -f net472: all projects pass (21 explicit real-API tests not run).
  • dotnet format --verify-no-changes: clean.
  • dotnet pack OpenUrzednik.Packages.slnf -c Release -p:ContinuousIntegrationBuild=true: pass.
  • reviewer agent: no blocking findings; its corrections (the editorconfig comment named the wrong MSBuild property; ADR-0004 wording on the lists being an approved subset of the table) are applied.

🤖 Generated with Claude Code

CA1031 (no general catch) and CA2007 (ConfigureAwait) are warnings in
src/, errors in CI; src/ had no violations. A target in
src/Directory.Build.targets fails the build when a src/ project
references a package its allow-list doesn't name: by default the Core
and provider list from ADR-0004 (BCL packages on netstandard2.0 only);
Diagnostics and the integration packages set theirs in the csproj.
ADR-0002 and ADR-0004 name the checks in their Confirmation; CLAUDE.md
and reviewer.md point to them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@milten89 milten89 added the ci CI workflows and tooling label Oct 30, 2026
@milten89
milten89 merged commit 8f63b72 into develop Oct 30, 2026
10 of 11 checks passed
@milten89
milten89 deleted the chore/code-checks branch October 30, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci CI workflows and tooling

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add the analyzer and package-reference checks

1 participant