Repository navigation
Fix every Roslyn and Roslynator finding, or suppress it in source with its reason - #318
Merged
Merged
Conversation
Two files in Core had a using directive that no code in them uses on any target framework (CaptureNames and the output-parameter part of ExpressiveCommandBase). Two more (ChunkChain and PooledArray) use System.Runtime.InteropServices only for CollectionsMarshal, which exists from .NET 8, so on the netstandard targets the directive was unused there; it is now inside the same #if NET8_0_OR_GREATER that guards its use. No behavior change and no public API change. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Redundant casts (IDE0004) and an unnecessary null-forgiving operator (IDE0370) are removed in Core.Tests, Generator.Tests and the docs sample, together with the sample comment that described the cast. A test that used the legacy package's extension class by name now calls the extension as an instance method (RCS1196), and its unused alias is gone. A fake transaction is disposed with await using in an async test (RCS1261). The docs sample compares a string with Length instead of with "" (RCS1156). Where the finding cannot be fixed without changing what the test checks, it is suppressed in source with the reason beside it: block-bodied discard lambdas passed to Assert.Throws (an expression body would bind to the Func<Task> overload that xUnit rejects, RCS1021), a property over an initialized backing field and a retired parameter that are the cases under test (RCS1085, RCS1163). Tests only; no test asserts anything different. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The benchmarks keep the synchronous dispose of the data reader, a static member the benchmark class has to own for BenchmarkDotNet, and the single field of an inline array. Each Roslynator finding about them (RCS1261, RCS1158, RCS1213, RCS1169) is suppressed in source around exactly that code, with the reason beside it. Changing any of them would change what the benchmarks measure or whether they compile. No code change. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Suppression is now at method level, with each reason written once. - RCS1021 (block-bodied discard lambdas passed to Assert.Throws): the file-level pragmas in three test files are gone. The 14 test methods that need a block body carry [SuppressMessage] with one shared reason constant. - RCS1261 (await using) in the benchmarks: the two block pragmas over the async sections are replaced by [SuppressMessage] on each of the 12 benchmark methods, with one shared reason constant. The reader still disposes synchronously, so what the benchmarks measure is unchanged. - RCS1158 (static member in a generic type) is fixed, not suppressed: the variant names move to non-generic holders (the checks read them from there) and the ParamsSource member becomes an instance method, which BenchmarkDotNet resolves on the concrete benchmark type. - One reason names both IDE0032 and RCS1085, and a test with two long lines and a split call is wrapped. No test asserts anything different and no benchmark body changed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…olders Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every finding the Roslyn tools report at any severity, in every project, now fixed at its root or suppressed in source at the narrowest level with its reason beside it. No behavior change and no public API change.
System.Runtime.InteropServicesin ChunkChain and PooledArray is used only for CollectionsMarshal, which exists from .NET 8, so it now sits inside the same#if NET8_0_OR_GREATERthat guards its use.await usingin an async test (RCS1261). The docs sample compares withLengthinstead of""(RCS1156) and loses a comment that described the removed cast.Func<Task>overload that xUnit rejects, RCS1021): 14 test methods carry[SuppressMessage]with one shared reason constant. In the benchmarks the reader keeps its synchronous dispose, because the published numbers measure that call (RCS1261): 12 methods, one shared reason constant. A property over an initialized backing field and a retired parameter are the cases under test (RCS1085, RCS1163).ParamsSourcemember becomes an instance method, which BenchmarkDotNet resolves on the concrete benchmark type. Checked by listing the benchmarks and by a negative control that names a missing member and fails as it should.Left on purpose: 29 findings that only some target frameworks of Core report (IDE0370, IDE0390), because fixing them for one framework breaks another.
Counts (before → after). Roslyn scan with every style rule as a warning, per project and target framework: 10 actionable → 0. Roslynator, all severities, 14 projects: 48 sites → 0.
dotnet formatstyle and analyzers at info, 14 projects: 0 → 0 (it was blind to these: it reports only rules that have a code fix).Verification: solution Release build with no incremental state 0 warnings, 0 errors; Visual Studio's MSBuild on the whole solution, Debug and Release, 0 errors; Core.Tests Release 16231 passed, Debug 16210 passed and 16 self-skipped; generator tests 189 passed; 267 sample checks; docfx 0 warnings; Benchmarks and Benchmarks.Generated Release builds 0 warnings; style scan clean; no PublicAPI diff.
🤖 Generated with Claude Code