Repository navigation
feat!: Report operators that lead a wrapped line (NOTA0002) - #1
Closed
henrikottesorensen wants to merge 7 commits into
Closed
henrikottesorensen wants to merge 7 commits into
henrikottesorensen wants to merge 7 commits into
Conversation
Ship the byte order mark removal script
MinVer computes Version from the nearest git tag (v-prefixed, per Directory.Build.props) plus commit height, so packing by hand and CI publishing can no longer disagree, and the workflow's own "take the version from the tag" step is now unnecessary. verify-package.sh switches from -p:Version to -p:MinVerVersionOverride: MinVer recalculates and overwrites Version itself, so -p:Version was silently ignored and every verification run would have collided on the same package version - the exact bug that comment already warns about. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The "Working on this repository" section still described the version living in the tag and a local-default <Version> in the csproj - true before this change, wrong after it now that MinVer computes Version from the tag on every build and the property is gone. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…sen-add-minver-versioning feat: Version the package with MinVer instead of a manual CI step
dotnet_sort_system_directives_first and dotnet_separate_import_directive_groups are gone from the globalconfig. Not set to false - absent. Their presence at any value arms the organize-imports stage of "dotnet format style", which reports as "error IMPORTS: Fix imports ordering" and sorts flat-alphabetically after System, putting Nota above the vendors. That is the inverse of what UA1000 requires. The result is a loop rather than a wrong file. The style stage reorders, the analyzers stage puts it back, the file on disk never changes - so dotnet format reports nothing to do while dotnet format --verify-no-changes exits 2 forever, and a consuming repository cannot make CI green by any means available to it. The old note here reasoned that the per-vendor grouping was "checked by IDE0055 only, which is off here, so nothing reports it". That is true and beside the point: the imports stage is not a diagnostic, has no severity, and setting dotnet_diagnostic.IDE0055.severity = none does not reach it. It checked what reports, not what enforces. Rider is unaffected, which is why this only ever showed up for whoever formats from the command line. Measured against a real consumer with both of its .editorconfig files, not reasoned about: as shipped, three consecutive runs left the file byte-identical and --verify-no-changes exited 2 every time; with the keys removed, one pass produces the canonical layout and it exits 0. verify.sh asserted SA1516 for the blank line after the System group, and that only worked because the key was set - so removing it broke the suite, which is the suite doing its job. UA1001 makes that check now, and knows first party from vendor where SA1516 only ever saw first-level namespaces. Samples/Unseparated.cs carries both faults so SA1516 stays asserted on member separation, which was always its own job. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…at-imports-loop Drop the two import keys that wedge dotnet format
A new analyser, a code fix that moves only the operator, and their unit tests. Both assemblies ship inside the package under analyzers/dotnet/cs, built against Roslyn 4.8 so SDK 8 consumers do not skip them with CS9057. The convention flips to match: dotnet_style_operator_placement_when_wrapping is end_of_line, and Rider's three csharp_wrap_before_* keys are set the same way. IDE0024 is also raised to a warning, so operator overloads get block bodies. Breaking: existing leading operators and expression-bodied operators become warnings. dotnet format converts both; the README's upgrade section has the commands. verify.sh and verify-package.sh now assert NOTA0002 reports, and that nothing reports the trailing form the fix produces. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
henrikottesorensen
force-pushed
the
claude/homespool-hs0002-rule-6391b7
branch
from
October 7, 2026 17:24
62aea59 to
f8dd79c
Compare
Owner
Author
|
Superseded by Notalib#15 |
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.
What
Adds
NOTA0002(warning): when an expression wraps, the operator ends the line and the next line starts with the operand.Nota.CodeAnalysis.Analysers+.CodeFixes: the analyser and a code fix that moves only the operator (whitespace-only, sodotnet formatcan bulk-convert). Both assemblies are packed intoanalyzers/dotnet/cs, and the package gains no dependencies. Built against Roslyn 4.8 so SDK 8 consumers don't skip them withCS9057.Nota.CodeAnalysis.Analysers.Test: 40 unit tests. CI now runsdotnet test.dotnet_style_operator_placement_when_wrappingflips frombeginning_of_linetoend_of_line.csharp_wrap_before_binary_opsign/_binary_pattern_op/_ternary_opsignsare set tofalse.csharp_style_expression_bodied_operatorsgoes fromfalse:silenttofalse:warning, soIDE0024reports at build.Breaking
Existing leading operators (
NOTA0002) and expression-bodied operator overloads (IDE0024) start warning. Repos withTreatWarningsAsErrorswill fail until converted. The README's new "Upgrading from 2.3" section has the commands:Suggest releasing this as v3.0.0.
Verification
verify.sh:NOTA0002must report onSamples/LeadingOperator.cs. The script also fails if anything reports on the trailing form the fix produces, so a StyleCop or IDE0055 rule can't start fighting the fix unnoticed.verify-package.sh:NOTA0002must reach a consumer installing the packed package, which proves the assemblies were packed.none, an extra diagnostic on the trailing form, analysers left out of the package), and each one failed as intended.dotnet formatwith the packed package cleared everyNOTA0002.dotnet format styleconverted anIDE0024case.Unverified
I haven't checked whether Rider reads the
csharp_wrap_before_*keys from a global analyzer config. If it doesn't, consumers need the three lines in their own.editorconfig. The README and a globalconfig comment both say so.🤖 Generated with Claude Code