Enforce full analyzer set with warnings as errors - #17
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## develop #17 +/- ##
========================================
Coverage 44.96% 44.96% ========================================
Files 25 25 Lines 3398 3398 Branches 259 259 ========================================
Hits 1528 1528 Misses 1824 1824 Partials 46 46 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR tightens build-time code quality enforcement across the solution by enabling the full .NET analyzer set and treating warnings as errors, then updating projects/tests/benchmarks to comply (notably xUnit v3 cancellation support and benchmark analyzer relaxations).
Changes:
- Add
Directory.Build.propsto centralize common project properties and enable full analyzers with warnings-as-errors; remove the.editorconfiganalyzer downgrade. - Update the xUnit test suite to pass
TestContext.Current.CancellationTokenthrough async call chains and remove a stray.ConfigureAwait(false)in a test. - Fix benchmark code to satisfy analyzer requirements (non-null
sha1, implementIAsyncDisposable) and add a benchmarks-specific.editorconfigto relax structurally incompatible rules.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
Directory.Build.props | Centralizes analyzer + common MSBuild properties (TFM, nullable, WAE, analysis mode/level). |
.editorconfig | Removes global analyzer severity downgrade to allow full enforcement. |
PhotoCleaner/PhotoCleaner.csproj | Removes duplicated analyzer/common properties now provided by Directory.Build.props. |
PhotoCleanerTests/PhotoCleanerTests.csproj | Removes duplicated common properties now provided by Directory.Build.props. |
PhotoCleanerBenchmarks/PhotoCleanerBenchmarks.csproj | Removes duplicated common properties now provided by Directory.Build.props. |
PhotoCleanerBenchmarks/.editorconfig | Per-project relaxations for benchmark harness constraints (CA1515/CA2007). |
PhotoCleanerBenchmarks/MediaBenchmarks.cs | Avoids null sha1 inserts and adds async disposal to satisfy analyzer requirements. |
PhotoCleanerTests/UndoTaskTests.cs | Passes xUnit cancellation token into UndoTask.Execute(...) calls. |
PhotoCleanerTests/TrashDatabaseTests.cs | Threads xUnit cancellation token through Trash DB async calls. |
PhotoCleanerTests/TrashCommandTests.cs | Threads xUnit cancellation token through Trash DB verification calls. |
PhotoCleanerTests/ProcessTaskTests.cs | Adds xUnit cancellation token to async I/O + DB/trash DB calls in tests. |
PhotoCleanerTests/IndexTaskTests.cs | Threads xUnit cancellation token through index-task and DB calls. |
PhotoCleanerTests/ImportTaskTests.cs | Threads xUnit cancellation token through hashing/DB/exiftool calls. |
PhotoCleanerTests/DatabaseTests.cs | Threads xUnit cancellation token through DB and file I/O calls. |
PhotoCleanerTests/CommandLineTests.cs | Reworks the unreadable-key-file test to use a platform guard analyzers can understand. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
* Enforce full analyzer set with warnings as errors ProjectTemplate#353 downstream (issue #14 item 2): - Remove the dotnet_analyzer_diagnostic.severity = suggestion downgrade from .editorconfig. - Add Directory.Build.props with the fleet-standard analyzer block (TreatWarningsAsErrors, AnalysisMode All, AnalysisLevel latest-all) and hoist the common properties out of the three csproj files. - Pass TestContext.Current.CancellationToken at all 180 xUnit1051 call sites (named argument where calls have other arguments); remove a stray ConfigureAwait in a test (xUnit1030). - Fix CS8625 in benchmarks by using real sha1 values instead of null. - MediaBenchmarks implements IAsyncDisposable (CA1001/CA1816); BenchmarkDotNet requires the class stay unsealed (BDN1002). - Restructure the unreadable-key-file test to a platform guard the CA1416 flow analysis recognizes; behavior unchanged. - Add PhotoCleanerBenchmarks/.editorconfig relaxing CA2007/CA1515, mirroring the tests project pattern (harness code, BenchmarkDotNet public-class requirement). Build is zero-warning/zero-error under full enforcement; 324 tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Address Copilot review: guarded cleanup, idempotent dispose, lambda tokens - MediaBenchmarks.Cleanup guards the temp-dir delete (setup may fail before the directory exists) and DisposeAsync is idempotent (null check, field cleared after dispose). - Pass TestContext.Current.CancellationToken to the two InitializeAsync idempotency assertions wrapped in Func<Task> lambdas, which the xUnit1051 analyzer does not traverse; swept the suite for sibling lambda call sites (none). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Pass cancellation token in remaining lambda-wrapped async test calls Sweep of every lambda-wrapped async call missing the token: the two duplicate-insert assertions Copilot flagged plus the two concurrent Select(...) read sites of the same class. The suite grep is now clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Adopt central package management and LangVersion Issue #14 round-2 step 2 residual (the analyzer enforcement itself landed in #17): - Directory.Packages.props: every dependency version declared once as a PackageVersion item (18 packages, no cross-project skew). - Directory.Build.props: add ManagePackageVersionsCentrally and LangVersion. - All csproj PackageReference items are versionless; PrivateAssets and IncludeAssets metadata unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Move ManagePackageVersionsCentrally into Directory.Packages.props CODESTYLE names Directory.Packages.props as the file that enables central package management; keep the whole CPM configuration in one file. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Update SQLite bundle comments for central package management The direct reference overrides the vulnerable transitive; the version itself lives in Directory.Packages.props. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary
ProjectTemplate#353 downstream - the dedicated analyzer PR of the issue #14 convergence sequence (item 2 of the curated addendum).
dotnet_analyzer_diagnostic.severity = suggestiondowngrade from.editorconfig.Directory.Build.propswith the fleet-standard analyzer block (TreatWarningsAsErrors=true,AnalysisMode=All,AnalysisLevel=latest-all,EnableNETAnalyzers), and dedupe the hoisted common properties from the three csproj files.TestContext.Current.CancellationToken, so xUnit v3 can cancel a stalled test. Passed as a named argument where calls carry other arguments (several target methods have intermediate optional parameters). Two sites that already passeddefaultpositionally were converted rather than appended..ConfigureAwait(false)removed from a test.nullfor the non-nullable sha1 column - fixed with real hash values (computed for the seed record, synthesized for the insert loop), not a null-forgiving operator.MediaBenchmarksimplementsIAsyncDisposable(CA1001/CA1816) and stays unsealed (BDN1002); the unreadable-key-file test uses a platform guard CA1416's flow analysis recognizes (Assert.SkipWhenis invisible to it), behavior unchanged.PhotoCleanerBenchmarks/.editorconfigfor CA2007 (harness code, no sync context - same rationale as the tests project) and CA1515 (BenchmarkDotNet requires public, unsealed classes).Testing
dotnet format style --verify-no-changes: clean. editorconfig-checker: exit 0.🤖 Generated with Claude Code