CodeAnalysis.ruleset 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <RuleSet Name="Microsoft.Analyzers.ManagedCodeAnalysis" Description="Microsoft.Analyzers.ManagedCodeAnalysis" ToolsVersion="14.0">
  2. <Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
  3. <Rule Id="CA1000" Action="None" /> <!-- Do not declare static members on generic types -->
  4. <Rule Id="CA1001" Action="None" /> <!-- Non disposable class owns disposable fields -->
  5. <Rule Id="CA1010" Action="None" /> <!-- Collections should implement generic interface -->
  6. <Rule Id="CA1028" Action="None" /> <!-- Enum storage should be Int32 -->
  7. <Rule Id="CA1030" Action="None" /> <!-- Use events where appropriate -->
  8. <Rule Id="CA1031" Action="None" /> <!-- Do not catch general exception types -->
  9. <Rule Id="CA1032" Action="None" /> <!-- Implement standard exception constructors -->
  10. <Rule Id="CA1034" Action="None" /> <!-- Nested types should not be visible -->
  11. <Rule Id="CA1036" Action="None" /> <!-- Overload comparison operators when implementing System.IComparable -->
  12. <Rule Id="CA1041" Action="None" /> <!-- Provide ObsoleteAttribute message -->
  13. <Rule Id="CA1043" Action="None" /> <!-- Use integral or string argument for indexers -->
  14. <Rule Id="CA1044" Action="None" /> <!-- Properties should not be write only -->
  15. <Rule Id="CA1051" Action="None" /> <!-- Do not declare visible instance fields -->
  16. <Rule Id="CA1052" Action="None" /> <!-- Static holder types should be sealed -->
  17. <Rule Id="CA1054" Action="None" /> <!-- URI parameters should not be strings -->
  18. <Rule Id="CA1055" Action="None" /> <!-- URI return values should not be strings -->
  19. <Rule Id="CA1056" Action="None" /> <!-- URI properties should not be strings -->
  20. <Rule Id="CA1058" Action="None" /> <!-- Types should not extend certain base types -->
  21. <Rule Id="CA1061" Action="None" /> <!-- Do not hide base class methods -->
  22. <Rule Id="CA1062" Action="None" /> <!-- Validate arguments of public methods -->
  23. <Rule Id="CA1063" Action="None" /> <!-- Implement IDisposable correctly -->
  24. <Rule Id="CA1064" Action="None" /> <!-- Exceptions should be public -->
  25. <Rule Id="CA1065" Action="None" /> <!-- Do not raise exceptions in unexpected locations -->
  26. <Rule Id="CA1066" Action="None" /> <!-- Type should implement IEquatable -->
  27. <Rule Id="CA1067" Action="None" /> <!-- Override Object.Equals(object) when implementing IEquatable -->
  28. <Rule Id="CA1068" Action="None" /> <!-- CancellationToken parameters must come last -->
  29. <Rule Id="CA1303" Action="None" /> <!-- Do not pass literals as localized parameters -->
  30. <Rule Id="CA1304" Action="None" /> <!-- Specify CultureInfo -->
  31. <Rule Id="CA1305" Action="None" /> <!-- Specify IFormatProvider -->
  32. <Rule Id="CA1307" Action="None" /> <!-- Specify StringComparison -->
  33. <Rule Id="CA1308" Action="None" /> <!-- Normalize strings to upper case -->
  34. <Rule Id="CA1707" Action="None" /> <!-- Identifers should not contain underscores -->
  35. <Rule Id="CA1710" Action="None" /> <!-- Identifers should have correct suffix -->
  36. <Rule Id="CA1712" Action="None" /> <!-- Do not prefix enum values with type name -->
  37. <Rule Id="CA1714" Action="None" /> <!-- Flags enums should have plural names -->
  38. <Rule Id="CA1715" Action="None" /> <!-- Type parameters names should be prefixed with T -->
  39. <Rule Id="CA1716" Action="None" /> <!-- Identifiers should not match keywords -->
  40. <Rule Id="CA1717" Action="None" /> <!-- Only FlagsAttribute enums should have plural names -->
  41. <Rule Id="CA1720" Action="None" /> <!-- Identifier contains type name -->
  42. <Rule Id="CA1721" Action="None" /> <!-- Property names should not match get methods -->
  43. <Rule Id="CA1724" Action="None" /> <!-- Type names should not match namespaces -->
  44. <Rule Id="CA1801" Action="None" /> <!-- Review unused parameters -->
  45. <Rule Id="CA1806" Action="None" /> <!-- Do not ignore method results -->
  46. <Rule Id="CA1812" Action="None" /> <!-- Avoid uninstantiated internal classes -->
  47. <Rule Id="CA1814" Action="None" /> <!-- Prefer jagged arrays over multidimensional -->
  48. <Rule Id="CA1815" Action="None" /> <!-- Override equals and operator equals on value types -->
  49. <Rule Id="CA1816" Action="None" /> <!-- Dispose methods should call SuppressFinalize -->
  50. <Rule Id="CA1819" Action="None" /> <!-- Properties should not return arrays -->
  51. <Rule Id="CA1820" Action="None" /> <!-- Test for empty strings using string length -->
  52. <Rule Id="CA1822" Action="None" /> <!-- Mark members as static -->
  53. <Rule Id="CA1827" Action="None" /> <!-- Do not use Count() when Any() can be used -->
  54. <Rule Id="CA2000" Action="None" /> <!-- Dispose objects before losing scope -->
  55. <Rule Id="CA2002" Action="None" /> <!-- Do not lock on objects with weak identity -->
  56. <Rule Id="CA2010" Action="None" /> <!-- Always consume the value returned by methods marked with PreserveSigAttribute -->
  57. <Rule Id="CA2100" Action="None" /> <!-- Review SQL queries for security vulnerabilities -->
  58. <Rule Id="CA2101" Action="None" /> <!-- Specify marshaling for P/Invoke string arguments -->
  59. <Rule Id="CA2119" Action="None" /> <!-- Seal methods that satisfy private interfaces -->
  60. <Rule Id="CA2208" Action="None" /> <!-- Instantiate exception arguments correctly -->
  61. <Rule Id="CA2211" Action="None" /> <!-- Non-constant fields should not be visible -->
  62. <Rule Id="CA2213" Action="None" /> <!-- Disposable Fields should be disposed -->
  63. <Rule Id="CA2214" Action="None" /> <!-- Do not call overridable methods in constructors -->
  64. <Rule Id="CA2216" Action="None" /> <!-- Disposable types should declare finalizer -->
  65. <Rule Id="CA2219" Action="None" /> <!-- Do not raise exceptions in finally clauses -->
  66. <Rule Id="CA2225" Action="None" /> <!-- Operator overloads have named alternates -->
  67. <Rule Id="CA2227" Action="None" /> <!-- Collection properties should be read only -->
  68. <Rule Id="CA2231" Action="None" /> <!-- Overload operator equals when overriding ValueType.Equals -->
  69. <Rule Id="CA2235" Action="None" /> <!-- Serializable type has non serializable field -->
  70. <Rule Id="CA2237" Action="None" /> <!-- Add [Serializable] to types that implement ISerializable -->
  71. <Rule Id="CA5366" Action="None" /> <!-- Use XmlReader For DataSet Read Xml -->
  72. <Rule Id="CA5369" Action="None" /> <!-- Use XmlReader For Deserialize -->
  73. <Rule Id="CA5371" Action="None" /> <!-- Use XmlReader For Schema Read -->
  74. <Rule Id="CA5372" Action="None" /> <!-- Use XmlReader For XPathDocument -->
  75. <Rule Id="CA5397" Action="None" /> <!-- Security protocol version is deprecated -->
  76. </Rules>
  77. <Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
  78. <Rule Id="AD0001" Action="None" /> <!-- Analyzer threw an exception -->
  79. <Rule Id="SA0001" Action="None" /> <!-- XML comments -->
  80. <Rule Id="SA1002" Action="None" /> <!-- Semicolons should not be preceded by a space -->
  81. <Rule Id="SA1003" Action="None" /> <!-- Operator should not appear at the end of a line -->
  82. <Rule Id="SA1004" Action="None" /> <!-- Documentation line should begin with a space -->
  83. <Rule Id="SA1005" Action="None" /> <!-- Single line comment should begin with a space -->
  84. <Rule Id="SA1008" Action="None" /> <!-- Opening parenthesis should not be preceded by a space -->
  85. <Rule Id="SA1009" Action="None" /> <!-- Closing parenthesis should not be followed by a space -->
  86. <Rule Id="SA1010" Action="None" /> <!-- Opening square brackets should not be preceded by a space -->
  87. <Rule Id="SA1011" Action="None" /> <!-- Closing square bracket should be followed by a space -->
  88. <Rule Id="SA1012" Action="None" /> <!-- Opening brace should be followed by a space -->
  89. <Rule Id="SA1013" Action="None" /> <!-- Closing brace should be preceded by a space -->
  90. <Rule Id="SA1015" Action="None" /> <!-- Closing generic bracket should not be followed by a space -->
  91. <Rule Id="SA1021" Action="None" /> <!-- Negative sign should be preceded by a space -->
  92. <Rule Id="SA1023" Action="None" /> <!-- Dereference symbol '*' should not be preceded by a space." -->
  93. <Rule Id="SA1024" Action="None" /> <!-- Colon should be followed by a space -->
  94. <Rule Id="SA1025" Action="None" /> <!-- Code should not contain multiple whitespace characters in a row -->
  95. <Rule Id="SA1100" Action="None" /> <!-- Do not prefix calls with base unless local implementation exists -->
  96. <Rule Id="SA1101" Action="None" /> <!-- Prefix local calls with this -->
  97. <Rule Id="SA1106" Action="None" /> <!-- Code should not contain empty statements -->
  98. <Rule Id="SA1107" Action="None" /> <!-- Code should not contain multiple statements on one line -->
  99. <Rule Id="SA1108" Action="None" /> <!-- Block statements should not contain embedded comments -->
  100. <Rule Id="SA1110" Action="None" /> <!-- Opening parenthesis or bracket should be on declaration line -->
  101. <Rule Id="SA1111" Action="None" /> <!-- Closing parenthesis should be on line of last parameter -->
  102. <Rule Id="SA1114" Action="None" /> <!-- Parameter list should follow declaration -->
  103. <Rule Id="SA1116" Action="None" /> <!-- Split parameters should start on line after declaration -->
  104. <Rule Id="SA1117" Action="None" /> <!-- Parameters should be on same line or separate lines -->
  105. <Rule Id="SA1118" Action="None" /> <!-- Parameter should not span multiple lines -->
  106. <Rule Id="SA1119" Action="None" /> <!-- Statement should not use unnecessary parenthesis -->
  107. <Rule Id="SA1120" Action="None" /> <!-- Comments should contain text -->
  108. <Rule Id="SA1122" Action="None" /> <!-- Use string.Empty for empty strings -->
  109. <Rule Id="SA1123" Action="None" /> <!-- Region should not be located within a code element -->
  110. <Rule Id="SA1124" Action="None" /> <!-- Do not use regions -->
  111. <Rule Id="SA1125" Action="None" /> <!-- Use shorthand for nullable types -->
  112. <Rule Id="SA1127" Action="None" /> <!-- Generic type constraints should be on their own line -->
  113. <Rule Id="SA1128" Action="None" /> <!-- Put constructor initializers on their own line -->
  114. <Rule Id="SA1130" Action="None" /> <!-- Use lambda syntax -->
  115. <Rule Id="SA1131" Action="None" /> <!-- Constant values should appear on the right-hand side of comparisons -->
  116. <Rule Id="SA1132" Action="None" /> <!-- Do not combine fields -->
  117. <Rule Id="SA1133" Action="None" /> <!-- Do not combine attributes -->
  118. <Rule Id="SA1134" Action="None" /> <!-- Each attribute should be placed on its own line of code -->
  119. <Rule Id="SA1135" Action="None" /> <!-- Using directive should be qualified -->
  120. <Rule Id="SA1136" Action="None" /> <!-- Enum values should be on separate lines -->
  121. <Rule Id="SA1137" Action="None" /> <!-- Elements should have the same indentation -->
  122. <Rule Id="SA1139" Action="None" /> <!-- Use literal suffix notation instead of casting -->
  123. <Rule Id="SA1200" Action="None" /> <!-- Using directive should appear within a namespace declaration -->
  124. <Rule Id="SA1201" Action="None" /> <!-- Elements should appear in the correct order -->
  125. <Rule Id="SA1202" Action="None" /> <!-- Elements should be ordered by access -->
  126. <Rule Id="SA1203" Action="None" /> <!-- Constants should appear before fields -->
  127. <Rule Id="SA1204" Action="None" /> <!-- Static elements should appear before instance elements -->
  128. <Rule Id="SA1208" Action="None" /> <!-- Using directive ordering -->
  129. <Rule Id="SA1209" Action="None" /> <!-- Using alias directives should be placed after all using namespace directives -->
  130. <Rule Id="SA1210" Action="None" /> <!-- Using directives should be ordered alphabetically by the namespaces -->
  131. <Rule Id="SA1211" Action="None" /> <!-- Using alias directive ordering -->
  132. <Rule Id="SA1214" Action="None" /> <!-- Readonly fields should appear before non-readonly fields -->
  133. <Rule Id="SA1216" Action="None" /> <!-- Using static directives should be placed at the correct location -->
  134. <Rule Id="SA1300" Action="None" /> <!-- Element should begin with an uppercase letter -->
  135. <Rule Id="SA1303" Action="None" /> <!-- Const field names should begin with upper-case letter -->
  136. <Rule Id="SA1304" Action="None" /> <!-- Non-private readonly fields should begin with upper-case letter -->
  137. <Rule Id="SA1306" Action="None" /> <!-- Field should begin with lower-case letter -->
  138. <Rule Id="SA1307" Action="None" /> <!-- Field should begin with upper-case letter -->
  139. <Rule Id="SA1308" Action="None" /> <!-- Field should not begin with the prefix 's_' -->
  140. <Rule Id="SA1309" Action="None" /> <!-- Field names should not begin with underscore -->
  141. <Rule Id="SA1310" Action="None" /> <!-- Field should not contain an underscore -->
  142. <Rule Id="SA1311" Action="None" /> <!-- Static readonly fields should begin with upper-case letter -->
  143. <Rule Id="SA1312" Action="None" /> <!-- Variable should begin with lower-case letter -->
  144. <Rule Id="SA1313" Action="None" /> <!-- Parameter should begin with lower-case letter -->
  145. <Rule Id="SA1314" Action="None" /> <!-- Type parameter names should begin with T -->
  146. <Rule Id="SA1316" Action="None" /> <!-- Tuple element names should use correct casing -->
  147. <Rule Id="SA1401" Action="None" /> <!-- Fields should be private -->
  148. <Rule Id="SA1402" Action="None" /> <!-- File may only contain a single type -->
  149. <Rule Id="SA1403" Action="None" /> <!-- File may only contain a single namespace -->
  150. <Rule Id="SA1404" Action="None" /> <!-- Code analysis suppression should have justification -->
  151. <Rule Id="SA1405" Action="None" /> <!-- Debug.Assert should provide message text -->
  152. <Rule Id="SA1407" Action="None" /> <!-- Arithmetic expressions should declare precedence -->
  153. <Rule Id="SA1408" Action="None" /> <!-- Conditional expressions should declare precedence -->
  154. <Rule Id="SA1413" Action="None" /> <!-- Use trailing comma in multi-line initializers -->
  155. <Rule Id="SA1414" Action="None" /> <!-- Tuple types in signatures should have element names -->
  156. <Rule Id="SA1500" Action="None" /> <!-- Braces for multi-line statements should not share line -->
  157. <Rule Id="SA1501" Action="None" /> <!-- Statement should not be on a single line -->
  158. <Rule Id="SA1502" Action="None" /> <!-- Element should not be on a single line -->
  159. <Rule Id="SA1503" Action="None" /> <!-- Braces should not be omitted -->
  160. <Rule Id="SA1504" Action="None" /> <!-- All accessors should be single-line or multi-line -->
  161. <Rule Id="SA1505" Action="None" /> <!-- An opening brace should not be followed by a blank line -->
  162. <Rule Id="SA1506" Action="None" /> <!-- Element documentation headers should not be followed by blank line -->
  163. <Rule Id="SA1507" Action="None" /> <!-- Code should not contain multiple blank lines in a row -->
  164. <Rule Id="SA1508" Action="None" /> <!-- A closing brace should not be preceded by a blank line -->
  165. <Rule Id="SA1509" Action="None" /> <!-- Opening braces should not be preceded by blank line -->
  166. <Rule Id="SA1510" Action="None" /> <!-- 'else' statement should not be preceded by a blank line -->
  167. <Rule Id="SA1512" Action="None" /> <!-- Single-line comments should not be followed by blank line -->
  168. <Rule Id="SA1513" Action="None" /> <!-- Closing brace should be followed by blank line -->
  169. <Rule Id="SA1514" Action="None" /> <!-- Element documentation header should be preceded by blank line -->
  170. <Rule Id="SA1515" Action="None" /> <!-- Single-line comment should be preceded by blank line -->
  171. <Rule Id="SA1516" Action="None" /> <!-- Elements should be separated by blank line -->
  172. <Rule Id="SA1519" Action="None" /> <!-- Braces should not be omitted from multi-line child statement -->
  173. <Rule Id="SA1520" Action="None" /> <!-- Use braces consistently -->
  174. <Rule Id="SA1600" Action="None" /> <!-- Elements should be documented -->
  175. <Rule Id="SA1601" Action="None" /> <!-- Partial elements should be documented -->
  176. <Rule Id="SA1602" Action="None" /> <!-- Enumeration items should be documented -->
  177. <Rule Id="SA1604" Action="None" /> <!-- Element documentation should have summary -->
  178. <Rule Id="SA1605" Action="None" /> <!-- Partial element documentation should have summary -->
  179. <Rule Id="SA1606" Action="None" /> <!-- Element documentation should have summary text -->
  180. <Rule Id="SA1608" Action="None" /> <!-- Element documentation should not have default summary -->
  181. <Rule Id="SA1610" Action="None" /> <!-- Property documentation should have value text -->
  182. <Rule Id="SA1611" Action="None" /> <!-- The documentation for parameter 'message' is missing -->
  183. <Rule Id="SA1612" Action="None" /> <!-- The parameter documentation is at incorrect position -->
  184. <Rule Id="SA1614" Action="None" /> <!-- Element parameter documentation should have text -->
  185. <Rule Id="SA1615" Action="None" /> <!-- Element return value should be documented -->
  186. <Rule Id="SA1616" Action="None" /> <!-- Element return value documentation should have text -->
  187. <Rule Id="SA1618" Action="None" /> <!-- The documentation for type parameter is missing -->
  188. <Rule Id="SA1619" Action="None" /> <!-- The documentation for type parameter is missing -->
  189. <Rule Id="SA1622" Action="None" /> <!-- Generic type parameter documentation should have text -->
  190. <Rule Id="SA1623" Action="None" /> <!-- Property documentation text -->
  191. <Rule Id="SA1624" Action="None" /> <!-- Because the property only contains a visible get accessor, the documentation summary text should begin with 'Gets' -->
  192. <Rule Id="SA1625" Action="None" /> <!-- Element documentation should not be copied and pasted -->
  193. <Rule Id="SA1626" Action="None" /> <!-- Single-line comments should not use documentation style slashes -->
  194. <Rule Id="SA1627" Action="None" /> <!-- The documentation text within the \'exception\' tag should not be empty -->
  195. <Rule Id="SA1629" Action="None" /> <!-- Documentation text should end with a period -->
  196. <Rule Id="SA1633" Action="None" /> <!-- File should have header -->
  197. <Rule Id="SA1642" Action="None" /> <!-- Constructor summary documentation should begin with standard text -->
  198. <Rule Id="SA1643" Action="None" /> <!-- Destructor summary documentation should begin with standard text -->
  199. <Rule Id="SA1649" Action="None" /> <!-- File name should match first type name -->
  200. </Rules>
  201. <Rules AnalyzerId="xunit.analyzers" RuleNamespace="xunit.analyzers">
  202. <Rule Id="xUnit1024" Action="None" /> <!-- Test methods cannot have overloads -->
  203. <Rule Id="xUnit2013" Action="None" /> <!-- Do not use equality check to check for collection size. -->
  204. <Rule Id="xUnit2017" Action="None" /> <!-- Do not use Contains() to check if a value exists in a collection -->
  205. </Rules>
  206. </RuleSet>