nunit.analyzers
nunit.analyzers copied to clipboard
Refactoring suggestion for managing diagnostic metadata.
I have found it to be nice to have classes like:
internal static class NUNIT17TestCaseSourceIsMissing
{
public const string DiagnosticId = "NUNIT_17";
internal static readonly DiagnosticDescriptor Descriptor = new DiagnosticDescriptor(
DiagnosticId ,
"TestCaseSource argument does not specify an existing member.",
"TestCaseSource argument does not specify an existing member.",
Categories.Usage,
DiagnosticSeverity.Error,
true);
}
Reasons I like it is:
- We group constants that belong together.
- Enables easy scanning of what rule id's we use.
I'm not married to this idea, just thought I'd write an issue about it and see what you think.
I think it makes sense to group the constants together that belong together. Now it is - in some cases - too easy to select the wrong constant by mistake, as most of them "lives" in a general namespace and in a general class, like TransformToConstraintModelDescription in NUnit.Analyzers.Constants.CodeFixConstants.
I find the current structuring less than ideal. The reason for why I have not created an issue for this, is that I have not had time to think about it in detail. TLDR I agree with the issue and thanks for reporting this.
I'll write a PR with the refactoring then.