Skip to content

Commit 4c033c0

Browse files
authored
Change diagnostic IDs (#168)
1 parent fa10893 commit 4c033c0

File tree

1 file changed

+88
-87
lines changed

1 file changed

+88
-87
lines changed

src/FluentAssertions.Analyzers/Constants.cs

Lines changed: 88 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -7,135 +7,136 @@ public static class DiagnosticProperties
77
public const string Title = nameof(Title);
88
public const string VisitorName = nameof(VisitorName);
99
public const string HelpLink = nameof(HelpLink);
10+
public const string IdPrefix = "FluentAssertions";
1011
}
1112

1213
public static class Tips
1314
{
1415
public const string Category = "FluentAssertionTips";
1516
public static class Collections
1617
{
17-
public const string CollectionsShouldBeEmpty = nameof(CollectionsShouldBeEmpty);
18-
public const string CollectionsShouldNotBeEmpty = nameof(CollectionsShouldNotBeEmpty);
19-
public const string CollectionShouldContainProperty = nameof(CollectionShouldContainProperty);
20-
public const string CollectionShouldNotContainProperty = nameof(CollectionShouldNotContainProperty);
21-
public const string CollectionShouldContainItem = nameof(CollectionShouldContainItem);
22-
public const string CollectionShouldNotContainItem = nameof(CollectionShouldNotContainItem);
23-
public const string CollectionShouldHaveCount = nameof(CollectionShouldHaveCount);
24-
public const string CollectionShouldHaveCountGreaterThan = nameof(CollectionShouldHaveCountGreaterThan);
25-
public const string CollectionShouldHaveCountGreaterOrEqualTo = nameof(CollectionShouldHaveCountGreaterOrEqualTo);
26-
public const string CollectionShouldHaveCountLessThan = nameof(CollectionShouldHaveCountLessThan);
27-
public const string CollectionShouldHaveCountLessOrEqualTo = nameof(CollectionShouldHaveCountLessOrEqualTo);
28-
public const string CollectionShouldNotHaveCount = nameof(CollectionShouldNotHaveCount);
29-
public const string CollectionShouldContainSingle = nameof(CollectionShouldContainSingle);
30-
public const string CollectionShouldOnlyContainProperty = nameof(CollectionShouldOnlyContainProperty);
31-
public const string CollectionShouldHaveSameCount = nameof(CollectionShouldHaveSameCount);
32-
public const string CollectionShouldNotHaveSameCount = nameof(CollectionShouldNotHaveSameCount);
33-
public const string CollectionShouldContainSingleProperty = nameof(CollectionShouldContainSingleProperty);
34-
public const string CollectionShouldNotBeNullOrEmpty = nameof(CollectionShouldNotBeNullOrEmpty);
35-
public const string CollectionShouldHaveElementAt = nameof(CollectionShouldHaveElementAt);
36-
public const string CollectionShouldBeInAscendingOrder = nameof(CollectionShouldBeInAscendingOrder);
37-
public const string CollectionShouldBeInDescendingOrder = nameof(CollectionShouldBeInDescendingOrder);
38-
public const string CollectionShouldEqualOtherCollectionByComparer = nameof(CollectionShouldEqualOtherCollectionByComparer);
39-
public const string CollectionShouldNotIntersectWith = nameof(CollectionShouldNotIntersectWith);
40-
public const string CollectionShouldIntersectWith = nameof(CollectionShouldIntersectWith);
41-
public const string CollectionShouldNotContainNulls = nameof(CollectionShouldNotContainNulls);
42-
public const string CollectionShouldOnlyHaveUniqueItems = nameof(CollectionShouldOnlyHaveUniqueItems);
43-
public const string CollectionShouldOnlyHaveUniqueItemsByComparer = nameof(CollectionShouldOnlyHaveUniqueItemsByComparer);
44-
public const string CollectionShouldHaveElementAt0Null = nameof(CollectionShouldHaveElementAt0Null);
18+
public const string CollectionsShouldBeEmpty = $"{DiagnosticProperties.IdPrefix}0000";
19+
public const string CollectionsShouldNotBeEmpty = $"{DiagnosticProperties.IdPrefix}0001";
20+
public const string CollectionShouldContainProperty = $"{DiagnosticProperties.IdPrefix}0002";
21+
public const string CollectionShouldNotContainProperty = $"{DiagnosticProperties.IdPrefix}0003";
22+
public const string CollectionShouldContainItem = $"{DiagnosticProperties.IdPrefix}0004";
23+
public const string CollectionShouldNotContainItem = $"{DiagnosticProperties.IdPrefix}0005";
24+
public const string CollectionShouldHaveCount = $"{DiagnosticProperties.IdPrefix}0006";
25+
public const string CollectionShouldHaveCountGreaterThan = $"{DiagnosticProperties.IdPrefix}0007";
26+
public const string CollectionShouldHaveCountGreaterOrEqualTo = $"{DiagnosticProperties.IdPrefix}0008";
27+
public const string CollectionShouldHaveCountLessThan = $"{DiagnosticProperties.IdPrefix}0009";
28+
public const string CollectionShouldHaveCountLessOrEqualTo = $"{DiagnosticProperties.IdPrefix}0010";
29+
public const string CollectionShouldNotHaveCount = $"{DiagnosticProperties.IdPrefix}0011";
30+
public const string CollectionShouldContainSingle = $"{DiagnosticProperties.IdPrefix}0012";
31+
public const string CollectionShouldOnlyContainProperty = $"{DiagnosticProperties.IdPrefix}0013";
32+
public const string CollectionShouldHaveSameCount = $"{DiagnosticProperties.IdPrefix}0014";
33+
public const string CollectionShouldNotHaveSameCount = $"{DiagnosticProperties.IdPrefix}0015";
34+
public const string CollectionShouldContainSingleProperty = $"{DiagnosticProperties.IdPrefix}0016";
35+
public const string CollectionShouldNotBeNullOrEmpty = $"{DiagnosticProperties.IdPrefix}0017";
36+
public const string CollectionShouldHaveElementAt = $"{DiagnosticProperties.IdPrefix}0018";
37+
public const string CollectionShouldBeInAscendingOrder = $"{DiagnosticProperties.IdPrefix}0019";
38+
public const string CollectionShouldBeInDescendingOrder = $"{DiagnosticProperties.IdPrefix}0020";
39+
public const string CollectionShouldEqualOtherCollectionByComparer = $"{DiagnosticProperties.IdPrefix}0021";
40+
public const string CollectionShouldNotIntersectWith = $"{DiagnosticProperties.IdPrefix}0022";
41+
public const string CollectionShouldIntersectWith = $"{DiagnosticProperties.IdPrefix}0023";
42+
public const string CollectionShouldNotContainNulls = $"{DiagnosticProperties.IdPrefix}0024";
43+
public const string CollectionShouldOnlyHaveUniqueItems = $"{DiagnosticProperties.IdPrefix}0025";
44+
public const string CollectionShouldOnlyHaveUniqueItemsByComparer = $"{DiagnosticProperties.IdPrefix}0026";
45+
public const string CollectionShouldHaveElementAt0Null = $"{DiagnosticProperties.IdPrefix}0027";
4546
}
4647

4748
public static class Dictionaries
4849
{
49-
public const string DictionaryShouldContainKey = nameof(DictionaryShouldContainKey);
50-
public const string DictionaryShouldContainValue = nameof(DictionaryShouldContainValue);
51-
public const string DictionaryShouldContainKeyAndValue = nameof(DictionaryShouldContainKeyAndValue);
52-
public const string DictionaryShouldContainPair = nameof(DictionaryShouldContainPair);
53-
public const string DictionaryShouldNotContainKey = nameof(DictionaryShouldNotContainKey);
54-
public const string DictionaryShouldNotContainValue = nameof(DictionaryShouldNotContainValue);
50+
public const string DictionaryShouldContainKey = $"{DiagnosticProperties.IdPrefix}0100";
51+
public const string DictionaryShouldContainValue = $"{DiagnosticProperties.IdPrefix}0101";
52+
public const string DictionaryShouldContainKeyAndValue = $"{DiagnosticProperties.IdPrefix}0102";
53+
public const string DictionaryShouldContainPair = $"{DiagnosticProperties.IdPrefix}0103";
54+
public const string DictionaryShouldNotContainKey = $"{DiagnosticProperties.IdPrefix}0104";
55+
public const string DictionaryShouldNotContainValue = $"{DiagnosticProperties.IdPrefix}0105";
5556
}
5657

5758
public static class Strings
5859
{
59-
public const string StringShouldStartWith = nameof(StringShouldStartWith);
60-
public const string StringShouldEndWith = nameof(StringShouldEndWith);
61-
public const string StringShouldNotBeNullOrEmpty = nameof(StringShouldNotBeNullOrEmpty);
62-
public const string StringShouldBeNullOrEmpty = nameof(StringShouldBeNullOrEmpty);
63-
public const string StringShouldBeNullOrWhiteSpace = nameof(StringShouldBeNullOrWhiteSpace);
64-
public const string StringShouldNotBeNullOrWhiteSpace = nameof(StringShouldNotBeNullOrWhiteSpace);
65-
public const string StringShouldHaveLength = nameof(StringShouldHaveLength);
60+
public const string StringShouldStartWith = $"{DiagnosticProperties.IdPrefix}0200";
61+
public const string StringShouldEndWith = $"{DiagnosticProperties.IdPrefix}0201";
62+
public const string StringShouldNotBeNullOrEmpty = $"{DiagnosticProperties.IdPrefix}0202";
63+
public const string StringShouldBeNullOrEmpty = $"{DiagnosticProperties.IdPrefix}0203";
64+
public const string StringShouldBeNullOrWhiteSpace = $"{DiagnosticProperties.IdPrefix}0204";
65+
public const string StringShouldNotBeNullOrWhiteSpace = $"{DiagnosticProperties.IdPrefix}0205";
66+
public const string StringShouldHaveLength = $"{DiagnosticProperties.IdPrefix}0206";
6667
}
6768

6869
public static class Comparable
6970
{
70-
public const string ComparableShouldBePositive = nameof(ComparableShouldBePositive);
71+
public const string ComparableShouldBePositive = $"{DiagnosticProperties.IdPrefix}0300";
7172
}
7273

7374
public static class Numeric
7475
{
75-
public const string NumericShouldBePositive = nameof(NumericShouldBePositive);
76-
public const string NumericShouldBeNegative = nameof(NumericShouldBeNegative);
77-
public const string NumericShouldBeInRange = nameof(NumericShouldBeInRange);
78-
public const string NumericShouldBeApproximately = nameof(NumericShouldBeApproximately);
76+
public const string NumericShouldBePositive = $"{DiagnosticProperties.IdPrefix}0400";
77+
public const string NumericShouldBeNegative = $"{DiagnosticProperties.IdPrefix}0401";
78+
public const string NumericShouldBeInRange = $"{DiagnosticProperties.IdPrefix}0402";
79+
public const string NumericShouldBeApproximately = $"{DiagnosticProperties.IdPrefix}0403";
7980
}
8081

8182
public static class Exceptions
8283
{
83-
public const string ExceptionShouldThrowWithMessage = nameof(ExceptionShouldThrowWithMessage);
84-
public const string ExceptionShouldThrowWithInnerException = nameof(ExceptionShouldThrowWithInnerException);
84+
public const string ExceptionShouldThrowWithMessage = $"{DiagnosticProperties.IdPrefix}0500";
85+
public const string ExceptionShouldThrowWithInnerException = $"{DiagnosticProperties.IdPrefix}0501";
8586
}
8687

8788
public static class MsTest
8889
{
89-
public const string AssertIsTrue = nameof(AssertIsTrue);
90-
public const string AssertIsFalse = nameof(AssertIsFalse);
91-
public const string AssertIsNotNull = nameof(AssertIsNotNull);
92-
public const string AssertIsNull = nameof(AssertIsNull);
93-
public const string AssertIsInstanceOfType = nameof(AssertIsInstanceOfType);
94-
public const string AssertIsNotInstanceOfType = nameof(AssertIsNotInstanceOfType);
95-
public const string AssertAreEqual = nameof(AssertAreEqual);
96-
public const string AssertAreNotEqual = nameof(AssertAreNotEqual);
97-
public const string AssertAreSame = nameof(AssertAreSame);
98-
public const string AssertAreNotSame = nameof(AssertAreNotSame);
99-
public const string AssertThrowsException = nameof(AssertThrowsException);
100-
public const string AssertThrowsExceptionAsync = nameof(AssertThrowsExceptionAsync);
101-
public const string StringAssertContains = nameof(StringAssertContains);
102-
public const string StringAssertStartsWith = nameof(StringAssertStartsWith);
103-
public const string StringAssertEndsWith = nameof(StringAssertEndsWith);
104-
public const string StringAssertMatches = nameof(StringAssertMatches);
105-
public const string StringAssertDoesNotMatch = nameof(StringAssertDoesNotMatch);
106-
public const string CollectionAssertAllItemsAreInstancesOfType = nameof(CollectionAssertAllItemsAreInstancesOfType);
107-
public const string CollectionAssertAreEqual = nameof(CollectionAssertAreEqual);
108-
public const string CollectionAssertAreNotEqual = nameof(CollectionAssertAreNotEqual);
109-
public const string CollectionAssertAreEquivalent = nameof(CollectionAssertAreEquivalent);
110-
public const string CollectionAssertAreNotEquivalent = nameof(CollectionAssertAreNotEquivalent);
111-
public const string CollectionAssertAllItemsAreNotNull = nameof(CollectionAssertAllItemsAreNotNull);
112-
public const string CollectionAssertAllItemsAreUnique = nameof(CollectionAssertAllItemsAreUnique);
113-
public const string CollectionAssertContains = nameof(CollectionAssertContains);
114-
public const string CollectionAssertDoesNotContain = nameof(CollectionAssertDoesNotContain);
115-
public const string CollectionAssertIsSubsetOf = nameof(CollectionAssertIsSubsetOf);
116-
public const string CollectionAssertIsNotSubsetOf = nameof(CollectionAssertIsNotSubsetOf);
90+
public const string AssertIsTrue = $"{DiagnosticProperties.IdPrefix}0600";
91+
public const string AssertIsFalse = $"{DiagnosticProperties.IdPrefix}0601";
92+
public const string AssertIsNotNull = $"{DiagnosticProperties.IdPrefix}0602";
93+
public const string AssertIsNull = $"{DiagnosticProperties.IdPrefix}0603";
94+
public const string AssertIsInstanceOfType = $"{DiagnosticProperties.IdPrefix}0604";
95+
public const string AssertIsNotInstanceOfType = $"{DiagnosticProperties.IdPrefix}0605";
96+
public const string AssertAreEqual = $"{DiagnosticProperties.IdPrefix}0606";
97+
public const string AssertAreNotEqual = $"{DiagnosticProperties.IdPrefix}0607";
98+
public const string AssertAreSame = $"{DiagnosticProperties.IdPrefix}0608";
99+
public const string AssertAreNotSame = $"{DiagnosticProperties.IdPrefix}0609";
100+
public const string AssertThrowsException = $"{DiagnosticProperties.IdPrefix}0610";
101+
public const string AssertThrowsExceptionAsync = $"{DiagnosticProperties.IdPrefix}0611";
102+
public const string StringAssertContains = $"{DiagnosticProperties.IdPrefix}0612";
103+
public const string StringAssertStartsWith = $"{DiagnosticProperties.IdPrefix}0613";
104+
public const string StringAssertEndsWith = $"{DiagnosticProperties.IdPrefix}0614";
105+
public const string StringAssertMatches = $"{DiagnosticProperties.IdPrefix}0615";
106+
public const string StringAssertDoesNotMatch = $"{DiagnosticProperties.IdPrefix}0616";
107+
public const string CollectionAssertAllItemsAreInstancesOfType = $"{DiagnosticProperties.IdPrefix}0617";
108+
public const string CollectionAssertAreEqual = $"{DiagnosticProperties.IdPrefix}0618";
109+
public const string CollectionAssertAreNotEqual = $"{DiagnosticProperties.IdPrefix}0619";
110+
public const string CollectionAssertAreEquivalent = $"{DiagnosticProperties.IdPrefix}0620";
111+
public const string CollectionAssertAreNotEquivalent = $"{DiagnosticProperties.IdPrefix}0621";
112+
public const string CollectionAssertAllItemsAreNotNull = $"{DiagnosticProperties.IdPrefix}0622";
113+
public const string CollectionAssertAllItemsAreUnique = $"{DiagnosticProperties.IdPrefix}0623";
114+
public const string CollectionAssertContains = $"{DiagnosticProperties.IdPrefix}0624";
115+
public const string CollectionAssertDoesNotContain = $"{DiagnosticProperties.IdPrefix}0625";
116+
public const string CollectionAssertIsSubsetOf = $"{DiagnosticProperties.IdPrefix}0626";
117+
public const string CollectionAssertIsNotSubsetOf = $"{DiagnosticProperties.IdPrefix}0627";
117118
}
118119

119120
public static class Xunit
120121
{
121-
public const string AssertTrue = nameof(AssertTrue);
122-
public const string AssertFalse = nameof(AssertFalse);
123-
public const string AssertSame = nameof(AssertSame);
124-
public const string AssertNotSame = nameof(AssertNotSame);
125-
public const string AssertEqual = nameof(AssertEqual);
126-
public const string AssertStrictEqual = nameof(AssertStrictEqual);
127-
public const string AssertNotEqual = nameof(AssertNotEqual);
128-
public const string AssertNotStrictEqual = nameof(AssertNotStrictEqual);
122+
public const string AssertTrue = $"{DiagnosticProperties.IdPrefix}0700";
123+
public const string AssertFalse = $"{DiagnosticProperties.IdPrefix}0701";
124+
public const string AssertSame = $"{DiagnosticProperties.IdPrefix}0702";
125+
public const string AssertNotSame = $"{DiagnosticProperties.IdPrefix}0703";
126+
public const string AssertEqual = $"{DiagnosticProperties.IdPrefix}0704";
127+
public const string AssertStrictEqual = $"{DiagnosticProperties.IdPrefix}0705";
128+
public const string AssertNotEqual = $"{DiagnosticProperties.IdPrefix}0706";
129+
public const string AssertNotStrictEqual = $"{DiagnosticProperties.IdPrefix}0707";
129130
}
130131
}
131132

132133
public static class CodeSmell
133134
{
134135
public const string Category = "FluentAssertionCodeSmell";
135136

136-
public const string NullConditionalAssertion = nameof(NullConditionalAssertion);
137-
public const string AsyncVoid = nameof(AsyncVoid);
138-
public const string ShouldEquals = nameof(ShouldEquals);
137+
public const string NullConditionalAssertion = $"{DiagnosticProperties.IdPrefix}0800";
138+
public const string AsyncVoid = $"{DiagnosticProperties.IdPrefix}0801";
139+
public const string ShouldEquals = $"{DiagnosticProperties.IdPrefix}0802";
139140
}
140141
}
141142
}

0 commit comments

Comments
 (0)