fluentassertions.analyzers icon indicating copy to clipboard operation
fluentassertions.analyzers copied to clipboard

Common DiagnosticId prefix for all analyzer rules

Open kirchsth opened this issue 1 year ago • 0 comments

Description

I added fluentassertions.analyzers to a solution (with >100 projects) that I can I fix/improve my assertions. But based on the missing common prefix in the DiagnosticId/Code it is hard to find all fluentassertions.analyzers related messages. E.g. all NUnit.Analyzers findings start with "NUnit####" that "code" column can be as sort criteria or "NUnit" as filter criteria in e.g. error list.

grafik

grafik

Complete minimal example reproducing the issue

Open a project with a rule violation in Visual Studio and check the DiagnosticId/code in the error view (see above)

Expected behavior:

All DiagnosticIds/Code have a direct FluentAssert relation and uses e.g. a pattern like Fluent{TipsCategoryIdx:#}{TipsAnalyserIdxPerCategory:###} based on the Tips is Constants.cs:

  • Fluent0000: CollectionsShouldBeEmpty
  • Fluent0001: CollectionsShouldNotBeEmpty ...
  • Fluent1000: DictionaryShouldContainKey

Details:

        public static class Tips
        {
            public const string Category = "FluentAssertionTips";
            public static class Collections
            {
                public const string CollectionsShouldBeEmpty = nameof(CollectionsShouldBeEmpty);
                public const string CollectionsShouldNotBeEmpty = nameof(CollectionsShouldNotBeEmpty);
...
            public static class Dictionaries
            {
                public const string DictionaryShouldContainKey = nameof(DictionaryShouldContainKey);
CollectionsShouldBeEmpty (e.g Collections = 0; CollectionsShouldBeEmpty=000)   = "Fluent0000"
CollectionsShouldNotBeEmpty (e.g Collections = 0; CollectionsShouldBeEmpty=001)   = "Fluent0001"
...
DictionaryShouldContainKey (e.g Dictionary = 1; CollectionsShouldBeEmpty=000)   = "Fluent1000"

Actual behavior:

DiagnosticId/Code contains no direct FluentAssert relation (CollectionsShouldBeEmpty, CollectionsShouldNotBeEmpty, DictionaryShouldContainKey )

Versions

  • Fluent Assertions Analyzers v. 0.17.2

kirchsth avatar Oct 15 '22 19:10 kirchsth