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

Update S3962: Ignore public static readonly fields #607

Closed
sl-williamdiesny opened this issue Jul 27, 2017 · 5 comments
Closed

Update S3962: Ignore public static readonly fields #607

sl-williamdiesny opened this issue Jul 27, 2017 · 5 comments
Milestone

Comments

@sl-williamdiesny
Copy link
Contributor

Description

The solution proposed by the rules S3962 and S2339 are not compatible.

Rule S3962 : Change static readonly into const,
Rule S2339 : Change public constant into static readonly.

I think the rule S3962 should be applied only on non public constant.

@michalb-sonar
Copy link
Contributor

Thanks for reporting @williamdiesny. That's a good suggestion.

@michalb-sonar michalb-sonar changed the title Rule S3962 in contradiction with S2339 Update S3962: Ignore public static readonly fields Jul 27, 2017
@michalb-sonar michalb-sonar added this to the near-future milestone Jul 27, 2017
@sl-williamdiesny
Copy link
Contributor Author

I made a pull-request, hope this help...

#609

@MaxTranced
Copy link

IMHO S3962 should also ignore internal visibility fields if the containing assembly is using
[assembly: InternalsVisibleTo("AnotherAssembly")]
This is probably an infrequent case, just thought I'd mention it here to get thoughts.

@valhristov
Copy link
Contributor

@MaxTranced we thought about that when we developed the fix, but it is rather difficult to check for assembly attributes from an analyzer that works on class level. It could be done, but in exchange for significant complexity increase...

@MaxTranced
Copy link

@valhristov that makes sense. Thank you!

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

No branches or pull requests

5 participants