Open OwenLacey28 opened 1 month ago
Agreed, it is all too easy to use those attributes, when a lot of times you could refactor.
Looks like the code of SA1404 is very specific to SuppressMessage
so would would need our own implementation, but that can at least cover both of our attributes and more in the future - https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/StyleCop.Analyzers/StyleCop.Analyzers/MaintainabilityRules/SA1404CodeAnalysisSuppressionMustHaveJustification.cs
We could perhaps include SuppressMessage
in our attribute, and disable SA1404 in our configs? That feels more consistent with how we have enhanced other existing rules? Plus it means one warning code for all violations?
@jackpercy-acl nice idea. An alternative is whether we can raise diagnostics that aren't ours e.g can we manually raise a SA1400?
Attributes like
MaxParmeterCount
andMaxMethodLength
provide aJustification
parameter, but don't enforce it.I would like it so that a lack of this parameter raises a diagnostic, like with
SuppressMessage
:We could equally make the justification parameter required, but that would be a breaking change.