-
Notifications
You must be signed in to change notification settings - Fork 510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update SA1515 to not let one range of trivia affect another #3529
Merged
sharwell
merged 1 commit into
DotNetAnalyzers:master
from
bjornhellander:feature/sa1515
Jun 22, 2022
Merged
Update SA1515 to not let one range of trivia affect another #3529
sharwell
merged 1 commit into
DotNetAnalyzers:master
from
bjornhellander:feature/sa1515
Jun 22, 2022
Conversation
This file contains 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
Codecov Report
@@ Coverage Diff @@
## master #3529 +/- ##
==========================================
- Coverage 93.25% 93.25% -0.01%
==========================================
Files 1070 1070
Lines 113394 113404 +10
Branches 4003 4003
==========================================
+ Hits 105749 105757 +8
- Misses 6618 6619 +1
- Partials 1027 1028 +1 |
bjornhellander
force-pushed
the
feature/sa1515
branch
from
June 19, 2022 17:38
4d76e73
to
8259cd6
Compare
sharwell
previously approved these changes
Jun 22, 2022
Comment on lines
169
to
170
var currentTrivia = triviaList[triviaIndex]; | ||
if (currentTrivia.IsKind(SyntaxKind.EndOfLineTrivia)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
var currentTrivia = triviaList[triviaIndex]; | |
if (currentTrivia.IsKind(SyntaxKind.EndOfLineTrivia)) | |
if (triviaList[triviaIndex].IsKind(SyntaxKind.EndOfLineTrivia)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
bjornhellander
force-pushed
the
feature/sa1515
branch
from
June 22, 2022 15:45
8259cd6
to
51e17c4
Compare
…ically reverts the analyzer change from commit 274493b and implements it in another way. DotNetAnalyzers#3481
bjornhellander
force-pushed
the
feature/sa1515
branch
from
June 22, 2022 18:11
51e17c4
to
bd21b58
Compare
sharwell
approved these changes
Jun 22, 2022
ThorstenSauter
referenced
this pull request
in ThorstenSauter/NoPlan
Jun 22, 2023
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [StyleCop.Analyzers](https://github.com/DotNetAnalyzers/StyleCopAnalyzers) | nuget | patch | `1.2.0-beta.435` -> `1.2.0-beta.507` | --- ### Release Notes <details> <summary>DotNetAnalyzers/StyleCopAnalyzers</summary> ### [`v1.2.0-beta.507`](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/releases/tag/1.2.0-beta.507) [Compare Source](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/compare/1.2.0-beta.435...1.2.0-beta.507) #### What's Changed - Update to StyleCop.Analyzers 1.2.0-beta.435 by [@​sharwell](https://github.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3499](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3499) - Add c# 11 test project to opencover-report.ps1 by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3506](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3506) - Use GetText instead of ToFullString by [@​sharwell](https://github.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3514](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3514) - Keep tracked nodes in a list by [@​sharwell](https://github.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3525](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3525) - Remove unnecessary nullable directives by [@​sharwell](https://github.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3530](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3530) - Remove hard-coded language versions in test projects for c# 8, 9 and 10 by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3528](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3528) - Update SA1515 to not let one range of trivia affect another by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3529](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3529) - Mentioned VS 2022 by [@​twojnarowski](https://github.com/twojnarowski) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3549](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3549) - Remove byte order mark from schema file by [@​martincostello](https://github.com/martincostello) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3562](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3562) - Update SA1012 to expect no space between a property pattern's opening brace and an enclosing list pattern's opening bracket by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3511](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3511) - Update Microsoft.CodeAnalysis.CSharp.Workspaces to version 4.4.0 for the c# 11 test project by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3580](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3580) - Update SA1008 to handle positional patterns inside property patterns by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3579](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3579) - Update SA1000 to trigger after keywords is, or, and, not by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3585](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3585) - Update SA1000.md by [@​Youssef1313](https://github.com/Youssef1313) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3563](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3563) - Update SA1313 to also allow incorrect names in explicitly implemented methods from interfaces by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3569](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3569) - Update SA1023 to not trigger first in line, inside a foreach without braces by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3543](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3543) - Update SA1400 to recognize access modifier "file" by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3590](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3590) - Update SA1206 to recognize modifier "file" by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3591](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3591) - Update SA1000 to handle checked operator declarations correctly by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3505](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3505) - Update SA1402 to handle records and record structs by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3570](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3570) - Bump Newtonsoft.Json from 12.0.3 to 13.0.2 in /StyleCop.Analyzers/StyleCop.Analyzers.Status.Generator by [@​dependabot](https://github.com/dependabot) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3584](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3584) - Update to the latest version of the testing library by [@​sharwell](https://github.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3601](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3601) - Update so that SA1600 tests will be run with the expected language version in test projects for c# 8 and above by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3614](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3614) - Update reading of file_header_template and stylecop.documentation.copyrightText to allow multiple lines by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3617](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3617) - Update SA1015 to require trailing space after an explicit generic return type in a lambda expression by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3625](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3625) - Update to Microsoft.CodeAnalysis.Analyzers 3.3.5-beta1.23205.2 by [@​sharwell](https://github.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3628](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3628) - Update SA1206 to handle c# 11 modifier "required" by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3535](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3535) - Preparations for SettingsHelper optimizations by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3635](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3635) - Correct SA1515 to not fire on the second line of a file header by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3633](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3633) - Update AnalyzersExtensions and SettingsHelper to use cached JsonValue objects where possible by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3642](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3642) - Update SA1010 to not trigger on list patterns by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3507](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3507) - Update NamingSettings and DocumentationSettings to keep one Regex instance instead of calling Regex.IsMatch by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3639](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3639) - Use ResxSourceGenerator for resource generation by [@​sharwell](https://github.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3343](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3343) - Make XmlCommentHelper faster by [@​ninedan](https://github.com/ninedan) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3651](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3651) - Update RenameToUpperCaseCodeFixProvider to not offer a code fix if the identifier only consists of underscores by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3637](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3637) - Don't emit SA1414 for interface implementations by [@​CollinAlpert](https://github.com/CollinAlpert) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3644](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3644) - Support file-scoped namespaces in SA1516 by [@​JakubLinhart](https://github.com/JakubLinhart) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3513](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3513) - Update SA1137 to also consider init accessors by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3669](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3669) - Update SA1500 to also consider init accessors by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3670](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3670) - Update SA1513 to not trigger before an init accessor by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3666](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3666) - Update SA1212 to also trigger for an init accessor before a getter by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3661](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3661) - Update SA1513 codefix to use the existing newline character sequence by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3607](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3607) - Correct code fix for SA1130 when delegate expression is part of a cast expression by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3516](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3516) - Update so that c# 7 tests will be run with the expected language version in test projects for c# 8 and above by [@​bjornhellander](https://github.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3616](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3616) - SA1629 should allow full-sentence links instead of forcing the period to glow white by [@​jnm2](https://github.com/jnm2) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3371](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3371) #### New Contributors - [@​twojnarowski](https://github.com/twojnarowski) made their first contribution in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3549](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3549) - [@​ninedan](https://github.com/ninedan) made their first contribution in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3651](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3651) - [@​CollinAlpert](https://github.com/CollinAlpert) made their first contribution in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3644](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3644) - [@​JakubLinhart](https://github.com/JakubLinhart) made their first contribution in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3513](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3513) **Full Changelog**: DotNetAnalyzers/StyleCopAnalyzers@1.2.0-beta.435...1.2.0-beta.507 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 4am" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/ThorstenSauter/NoPlan). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xMzEuMCIsInVwZGF0ZWRJblZlciI6IjM1LjEzMS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Thorsten Sauter <[email protected]>
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.
Fixes #3481
The problem as I see it was that the previous code kept state to be able to trigger on the following code:
without triggering on this:
But this state also leaked over to unrelated chunks of trivia. I replaced the state with more digging in the current trivia, to avoid the reported false positive.