Simon
Simon

Reputation: 34840

How to get Resharper to show "private" on members and "internal" on classes as redundancy errors?

For class members the private modifier is redundant.

For classes the internal modifier is redundant.

Is it possible to get Resharper to show these as code errors?

Upvotes: 2

Views: 256

Answers (2)

controlflow
controlflow

Reputation: 6737

In short: no.

We have only 'code cleanup' functionality able to remove redundant private/internal modifiers, but no code inspection like this. This easily can be done via plugin or issue request :)

Upvotes: 1

jessehouwing
jessehouwing

Reputation: 114641

There is no default out-of-the-box rule that enforces this. And I must say that I haven't seen a coding guideline in the last years that ever suggested not specifying the access level on anything. Usually specifying the access level is seen as a good thing, since it shows that there has been at least some thought into the desired level.

Of course some people set everything to public, but then again, that's something your rule won't see anyway.

You'll need to create a custom StyleCop rule (with the StyleCop plugin for Resharper) or a Resharper plugin to detect and flag these issues. It shouldn't be too hard, since the "error" is not too complex and the list acceptance criteria would be short and simple.

Upvotes: 0

Related Questions