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

Bug: Neither SA1304 nor SA1307 is reported for public readonly fields #1306

Closed
ghost opened this issue Aug 28, 2015 · 4 comments
Closed

Bug: Neither SA1304 nor SA1307 is reported for public readonly fields #1306

ghost opened this issue Aug 28, 2015 · 4 comments
Assignees
Milestone

Comments

@ghost
Copy link

ghost commented Aug 28, 2015

Hi,

It seems like both analyzers rely to each other to report a warning and no warning is generated at all. Here's a simple example (StyleCop.Analyzers 1.0.0.8):

#pragma warning disable SA1401 // Fields must be private
public class Class1
{
    // no warning here
    public readonly int sa1304or1307shouldBeReportedHere;
}
@pdelvo
Copy link
Member

pdelvo commented Aug 28, 2015

Yes this looks like a 🐛 to me. The source code for SA1304 clearly says that SA1307 should take precedence.

Do you want to work on this yourself or should someone take a look at this?

@ghost
Copy link
Author

ghost commented Aug 28, 2015

No, I just wanted to report a bug. However, I think the fix is just to remove || declaration.Modifiers.Any(SyntaxKind.ReadOnlyKeyword) in SA1307AccessibleFieldsMustBeginWithUpperCaseLetter.cs, line 63 (provided that SA1307 should have priority in this case).

@pdelvo
Copy link
Member

pdelvo commented Aug 28, 2015

Yes this should fix it. Im going to grab this

@sharwell
Copy link
Member

Thanks for the 🐛 report @test20150828!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants