Open sharwell opened 7 years ago
Similar to #1163, this behavior is an explicit match with FxCop behavior, and unlike #1163, this would introduce a new warning where previously none existed. @dotnet/roslyn-analysis, thoughts on what we should do here? While I agree with the change in behavior, do we want to risk breaking people by reporting new warnings?
We should add an editorconfig option to allow end users to configure this behavior.
What about interfaces? If an internal
interface is never implemented it shall have a similar behavior as un-inherited abstract
classes, don't you think?
I also don't understand why we don't report on struct
nor enum
, is there any reason not to?
Bonus points for warning on code only used by tests but that is probably a separate issue.
@JohanLarsson If we go this road it would be nice to be able to categorize an assembly as main code/production code VS test code. I don't want to have some diagnostic reported on an internal test class used only by test class. This class could be either an helper directly in the test assembly or in some code of test utility/test infrastructure project.
@mavasani We have raised a couple of interesting cases here. In your opinion, which one(s) shall be handled?
Analyzer package
Example: Microsoft.CodeQuality.Analyzers
Analyzer
CA1812: Avoid uninstantiated internal classes
Repro steps
abstract
modifierExpected behavior
CA1812 should be reported.
Actual behavior
CA1812 is not reported.
:memo: If the abstract type has one or more derived types, CA1812 should not be reported on the base class. If/when the derived types are removed in accordance with CA1812, a new warning will indicate that the user can now remove CA1812.