|
2 | 2 | <RuleSet Name="Autofac Analyzer Rules" Description="Analyzer rules for Autofac assemblies." ToolsVersion="16.0"> |
3 | 3 | <IncludeAll Action="Warning" /> |
4 | 4 | <Rules AnalyzerId="Microsoft.Usage" RuleNamespace="Microsoft.Usage"> |
| 5 | + <!-- Avoid excessive parameters on generic types (must be explicitly enabled). --> |
| 6 | + <Rule Id="CA1005" Action="Warning" /> |
| 7 | + <!-- Don't catch general exceptions - test scenarios sometimes require general exception handling. --> |
| 8 | + <Rule Id="CA1031" Action="None" /> |
5 | 9 | <!-- Implement standard exception constructors - not all of the exception constructors (e.g., parameterless) are desired in our system. --> |
6 | 10 | <Rule Id="CA1032" Action="None" /> |
7 | | - <!-- Do not nest types - we do that special for the DynamicProxy testing because there are lots of overlapping scenarios to test and interfaces/classes do need to be public. --> |
8 | | - <Rule Id="CA1034" Action="None" /> |
9 | | - <!-- Identifiers should not contain underscores - underscores are helpful in test naming. --> |
| 11 | + <!-- Avoid empty interfaces - in unit tests for service resolution, this happens a lot. --> |
| 12 | + <Rule Id="CA1040" Action="None" /> |
| 13 | + <!-- Do not pass literals as localized parameters - tests don't need to localize. --> |
| 14 | + <Rule Id="CA1303" Action="None" /> |
| 15 | + <!-- Avoid excessive inheritance (must be explicitly enabled). --> |
| 16 | + <Rule Id="CA1501" Action="Warning" /> |
| 17 | + <!-- Avoid excessive complexity (must be explicitly enabled). --> |
| 18 | + <Rule Id="CA1502" Action="Warning" /> |
| 19 | + <!-- Avoid unmaintainable code (must be explicitly enabled). --> |
| 20 | + <Rule Id="CA1505" Action="Warning" /> |
| 21 | + <!-- Avoid excessive class coupling (must be explicitly enabled). --> |
| 22 | + <Rule Id="CA1506" Action="Warning" /> |
| 23 | + <!-- Use ArgumentNullException.ThrowIfNull - this isn't available until we stop targeting netstandard. --> |
| 24 | + <Rule Id="CA1510" Action="None" /> |
| 25 | + <!-- Make API types internal - causes problems with tests and test assemblies. --> |
| 26 | + <Rule Id="CA1515" Action="None" /> |
| 27 | + <!-- Remove the underscores from member name - unit test scenarios may use underscores. --> |
10 | 28 | <Rule Id="CA1707" Action="None" /> |
11 | 29 | <!-- Change names to avoid reserved word overlaps (e.g., Delegate, GetType, etc.) - too many of these in the public API, we'd break if we fixed it. --> |
12 | 30 | <Rule Id="CA1716" Action="None" /> |
| 31 | + <!-- Internal class that appears to never be instantiated - lots of false positives here because they're test stubs created by Autofac registrations. --> |
| 32 | + <Rule Id="CA1812" Action="None" /> |
13 | 33 | <!-- Change Dispose() to call GC.SuppressFinalize - in tests we don't really care and it can impact readability. --> |
14 | 34 | <Rule Id="CA1816" Action="None" /> |
15 | 35 | <!-- Mark members static - test methods may not access member data but also can't be static. --> |
16 | 36 | <Rule Id="CA1822" Action="None" /> |
17 | | - <!-- Implement serialization constructors - false positive when building .NET Core --> |
| 37 | + <!-- Seal internal types for performance - in tests we don't really care and it gets painful to enforce. --> |
| 38 | + <Rule Id="CA1852" Action="None" /> |
| 39 | + <!-- Prefer static readonly fields over constant array arguments - constant array arguments happen a lot in unit tests for assertions and test setup. --> |
| 40 | + <Rule Id="CA1861" Action="None" /> |
| 41 | + <!-- Cache a CompositeFormat object for use in String.Format - this makes unit tests harder to read, and performance isn't an issue. --> |
| 42 | + <Rule Id="CA1863" Action="None" /> |
| 43 | + <!-- Call ConfigureAwait on tasks - you shouldn't do this in unit test libraries; XUnit has an opposite analyzer. --> |
| 44 | + <Rule Id="CA2007" Action="None" /> |
| 45 | + <!-- Implement serialization constructors - false positive when building .NET Core. --> |
18 | 46 | <Rule Id="CA2229" Action="None" /> |
19 | | - <!-- Mark ISerializable types with SerializableAttribute - false positive when building .NET Core --> |
| 47 | + <!-- Use Uri instead of string parameters - strings are easier for testing. --> |
| 48 | + <Rule Id="CA2234" Action="None" /> |
| 49 | + <!-- Mark ISerializable types with SerializableAttribute - false positive when building .NET Core. --> |
20 | 50 | <Rule Id="CA2237" Action="None" /> |
| 51 | + <!-- Prefer generic overloads to using Type parameters - we do a lot of reflection work in Autofac that needs to be tested. --> |
| 52 | + <Rule Id="CA2263" Action="None" /> |
21 | 53 | </Rules> |
22 | 54 | <Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers"> |
23 | | - <!-- Prefix local calls with this --> |
| 55 | + <!-- Prefix local calls with this. --> |
24 | 56 | <Rule Id="SA1101" Action="None" /> |
25 | | - <!-- Use built-in type alias --> |
| 57 | + <!-- Use built-in type alias. --> |
26 | 58 | <Rule Id="SA1121" Action="None" /> |
27 | | - <!-- Use String.Empty instead of "" --> |
| 59 | + <!-- Use String.Empty instead of "". --> |
28 | 60 | <Rule Id="SA1122" Action="None" /> |
29 | | - <!-- Using statements must be inside a namespace --> |
30 | | - <Rule Id="SA1200" Action="None" /> |
31 | | - <!-- Enforce order of class members by member type --> |
| 61 | + <!-- Enforce order of class members by member type - sometimes putting test classes/data by the test helps. --> |
32 | 62 | <Rule Id="SA1201" Action="None" /> |
33 | | - <!-- Enforce order of class members by member visibility --> |
| 63 | + <!-- Enforce order of class members by member visibility - sometimes putting test classes/data by the test helps. --> |
34 | 64 | <Rule Id="SA1202" Action="None" /> |
35 | | - <!-- Enforce order of constantand static members --> |
36 | | - <Rule Id="SA1203" Action="None" /> |
37 | | - <!-- Enforce order of static vs. non-static members --> |
| 65 | + <!-- Enforce order of static vs. non-static members - sometimes putting test classes/data by the test helps. --> |
38 | 66 | <Rule Id="SA1204" Action="None" /> |
39 | | - <!-- Modifiers are not ordered - .editorconfig handles this --> |
40 | | - <Rule Id="SA1206" Action="None" /> |
41 | | - <!-- Enforce order of readonly vs. non-readonly members --> |
42 | | - <Rule Id="SA1214" Action="None" /> |
43 | | - <!-- Fields can't start with underscore --> |
| 67 | + <!-- Fields can't start with underscore. --> |
44 | 68 | <Rule Id="SA1309" Action="None" /> |
45 | | - <!-- Suppressions must have a justification --> |
46 | | - <Rule Id="SA1404" Action="None" /> |
47 | | - <!-- Elements should be documented --> |
| 69 | + <!-- Elements should be documented. --> |
48 | 70 | <Rule Id="SA1600" Action="None" /> |
49 | | - <!-- Enuemration items should be documented --> |
| 71 | + <!-- Partial items should be documented. --> |
| 72 | + <Rule Id="SA1601" Action="None" /> |
| 73 | + <!-- Enumeration items should be documented. --> |
50 | 74 | <Rule Id="SA1602" Action="None" /> |
51 | | - <!-- Parameter documentation must be in the right order --> |
| 75 | + <!-- Parameter should be documented. --> |
| 76 | + <Rule Id="SA1611" Action="None" /> |
| 77 | + <!-- Parameter documentation must be in the right order. --> |
52 | 78 | <Rule Id="SA1612" Action="None" /> |
53 | | - <!-- Return value must be documented --> |
| 79 | + <!-- Return value must be documented. --> |
54 | 80 | <Rule Id="SA1615" Action="None" /> |
55 | | - <!-- Generic type parameters must be documented --> |
| 81 | + <!-- Generic type parameters must be documented. --> |
56 | 82 | <Rule Id="SA1618" Action="None" /> |
57 | | - <!-- Don't copy/paste documentation --> |
| 83 | + <!-- Don't copy/paste documentation. --> |
58 | 84 | <Rule Id="SA1625" Action="None" /> |
59 | | - <Rule Id="SA1633" Action="None" /> |
60 | | - <!-- Exception documentation must not be empty --> |
61 | | - <Rule Id="SA1627" Action="None" /> |
62 | | - <!-- Enable XML documentation output--> |
63 | | - <Rule Id="SA1652" Action="None" /> |
64 | 85 | <!-- Private member is unused - tests for reflection require members that may not get used. --> |
65 | 86 | <Rule Id="IDE0051" Action="None" /> |
66 | 87 | <!-- Private member assigned value never read - tests for reflection require values that may not get used. --> |
|
0 commit comments