Skip to content

Share the build settings, enforce warnings everywhere, measure coverage - #5

Merged
Kentarohakase merged 1 commit into
mainfrom
build/shared-properties-and-coverage
Aug 12, 2026
Merged

Share the build settings, enforce warnings everywhere, measure coverage#5
Kentarohakase merged 1 commit into
mainfrom
build/shared-properties-and-coverage

Conversation

@Kentarohakase

Copy link
Copy Markdown
Owner

Stacked on #4. The build-infrastructure items from the improvement plan's low-priority list.

Shared build settings

Both project files declared TargetFramework, Nullable and ImplicitUsings separately, and the test project inherited neither AnalysisLevel nor EnforceCodeStyleInBuild nor the warning policy — its code was warning-free by omission rather than by rule. Those settings move into Directory.Build.props; each project file keeps only what is genuinely its own.

Warnings are errors everywhere, not only in Release

TreatWarningsAsErrors was set under Condition="'$(Configuration)' == 'Release'". A local dotnet build accepted what CI rejected, so a warning surfaced after the push rather than before it. Measured before changing it — both projects build clean in Debug and Release, and the test project builds clean with the analyzers and the warning policy applied:

dotnet build -c Debug                                        -> 0 warnings
dotnet build AudioQualityEnhancer.Tests.csproj -c Release \
  -p:TreatWarningsAsErrors=true -p:AnalysisLevel=latest \
  -p:EnforceCodeStyleInBuild=true                            -> 0 warnings

AnalysisMode stays off, deliberately

The plan noted that AnalysisMode is unset, so most CA rules sit at suggestion severity and never become warnings — and therefore never become errors under TreatWarningsAsErrors. I measured the blast radius before deciding:

AnalysisMode Analyzer warnings Dominated by
default 0
Recommended ~300 CA1305, CA1822, CA1859, CA1805
All ~1130 CA1515, CA2007, CA1031, CA1305

That is a cleanup in its own right. Switching it on inside a build file would block every later change until someone worked through it, so it stays at the default and the reasoning is recorded in Directory.Build.props rather than lost.

The same applies to .editorconfig: adding one that merely restates the defaults dotnet format already enforces would be noise, and adding one that changes severities is the same cleanup by another route.

Coverage is measured for the first time

coverlet.collector has been referenced by the test project all along, but ci.yml never collected anything. The test step now collects it and CI keeps the Cobertura report as an artifact.

Current state, measured locally:

Line rate:   49.1 %
Branch rate: 45.1 %

That number is mostly explained by MainViewModel — about 2,100 lines across eleven partials with no tests, for the reason described in #4.

SDK pinned

global.json pins the 10.0 feature band with rollForward: latestFeature, so a future major SDK cannot silently change the build. CI installs 10.0.x, which satisfies it.

No changelog entry

Nothing here changes behaviour for a user of the application, so the changelog is untouched.

Verification

dotnet format .\AudioQualityEnhancer.slnx --verify-no-changes   -> clean
dotnet build  .\AudioQualityEnhancer.slnx -c Debug              -> 0 warnings, 0 errors
dotnet build  .\AudioQualityEnhancer.slnx -c Release            -> 0 warnings, 0 errors
dotnet test   .\AudioQualityEnhancer.slnx -c Release            -> 239 passed, 0 failed

Coverage collection was run locally with the exact command CI now uses, and it produced coverage.cobertura.xml as expected.

@Kentarohakase
Kentarohakase force-pushed the tests/close-coverage-gaps branch from e894726 to e6c1686 Compare August 12, 2026 00:56
@Kentarohakase
Kentarohakase force-pushed the build/shared-properties-and-coverage branch from 876c30f to ad373ef Compare August 12, 2026 00:56
@Kentarohakase
Kentarohakase force-pushed the tests/close-coverage-gaps branch from e6c1686 to 90d55cd Compare August 12, 2026 01:03
Both projects declared TargetFramework, Nullable and ImplicitUsings themselves,
and the test project inherited neither the analyzers nor the warning policy, so
test code was warning free only by omission. The shared settings move into
Directory.Build.props and both project files keep just what is specific to them.

Warnings are errors in every configuration now, not only in Release. A local
Debug build accepted what the Release build in CI rejected, so a warning showed
up after the push instead of before it. Both projects build clean in Debug and
Release, so this costs nothing today.

AnalysisMode stays at its default on purpose. Raising it to Recommended surfaces
about 300 analyzer warnings and All about 1100, mostly CA1305, CA1822, CA2007
and CA1515. That is a cleanup in its own right and would only block every later
change if it were switched on here.

The SDK is pinned to the 10.0 feature band with rollForward so a future major
does not silently change the build.

Finally, coverlet was referenced but never used: the test run collects coverage
now and CI keeps the report as an artifact. The current line rate is 49 percent.
@Kentarohakase
Kentarohakase changed the base branch from tests/close-coverage-gaps to main August 12, 2026 01:06
@Kentarohakase
Kentarohakase force-pushed the build/shared-properties-and-coverage branch from ad373ef to ffc4ba1 Compare August 12, 2026 01:06
@Kentarohakase
Kentarohakase merged commit 92a1509 into main Aug 12, 2026
1 check passed
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