Skip to content
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

SA1015 false positive on object initializer #3856

Closed
n0099 opened this issue May 31, 2024 · 3 comments · Fixed by #3857
Closed

SA1015 false positive on object initializer #3856

n0099 opened this issue May 31, 2024 · 3 comments · Fixed by #3857
Labels
Milestone

Comments

@n0099
Copy link

n0099 commented May 31, 2024

n0099/open-tbm@b29fea0#diff-ca28356cfa73fff3341e8571881b0401158b49858f07d83d30e1ece640b15fe2R19

protected override Lazy<Dictionary<Type, AddSplitRevisionsDelegate>>
    AddSplitRevisionsDelegatesKeyByEntityType =>
    _addSplitRevisionsDelegatesKeyByEntityType ??= new(() => new()
    {
        {typeof(ReplyRevision.SplitFloor), AddSplitRevisions<ReplyRevision.SplitFloor>},
        // SA1015 Closing generic bracket should be followed by a space              ^
        {typeof(ReplyRevision.SplitSubReplyCount), AddSplitRevisions<ReplyRevision.SplitSubReplyCount>},
        // SA1015 Closing generic bracket should be followed by a space                              ^
        {typeof(ReplyRevision.SplitAgreeCount), AddSplitRevisions<ReplyRevision.SplitAgreeCount>}
        // SA1015 Closing generic bracket should be followed by a space                        ^
    });
n0099 added a commit to n0099/open-tbm that referenced this issue May 31, 2024
* disable Roslyn analyzer rule `SA1015:Closing generic brackets should be spaced correctly`: DotNetAnalyzers/StyleCopAnalyzers#3856 @ GlobalSuppressions.cs
@ c#
@bjornhellander
Copy link
Contributor

Just to clarify: Normally, those three lines would also get a SA1012 since they don't have a space after the opening brace and a SA1013 since they don't have a space before the closing brace. I assume that you have intentionally turned both of them off, since you only mention SA1015?

@n0099
Copy link
Author

n0099 commented Jun 1, 2024

I assume that you have intentionally turned both of them off

Yes: n0099/open-tbm@b2910ff#diff-dee8b4f6b469005cc91d8562bba59ac8c3b8b151d08f85ed8f8b613ace4132ecR23

@bjornhellander
Copy link
Contributor

Ok, well I agree with you. I also think this is a bug.

bjornhellander added a commit to bjornhellander/StyleCopAnalyzers that referenced this issue Jun 1, 2024
… typically last in dictionary initializer items, collection initializers and collection expressions. DotNetAnalyzers#3856
sharwell added a commit that referenced this issue Jun 3, 2024
…er-3856

Update SA1015 to not care about trailing spaces in a number of cases: typically last in dictionary initializer items, collection initializers and collection expressions. #3856
@sharwell sharwell added the fixed label Jun 3, 2024
@sharwell sharwell added this to the 1.2-beta.next milestone Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment