Skip to content

StyleCop rules and StyleBro

Which StyleBro rule or .NET SDK rule covers each StyleCop.Analyzers rule ID. bro migrate uses the same mapping to turn on the StyleBro rules that replace the StyleCop rules a project has on, and to carry its suppressions over.

  • StyleBro (a BRO rule): StyleBro's rule, with a code fix that dotnet format applies.
  • SDK: a .NET SDK rule or setting that dotnet format fixes; StyleBro's preset turns it on unless the entry says otherwise.
  • Not covered: StyleBro has no rule for it, usually because there is no safe automatic fix. Each one is explained in skipped-rules.md.

Of 203 rules: 45 SDK, 112 StyleBro (112 done), 44 drop, 0 not yet done, 2 not applicable or variants.

Documentation

Rule Title Covered by
SA1600 Elements should be documented BRO1601, for overrides and implementations (<inheritdoc/>); other missing documentation isn't covered (why)
SA1601 Partial elements should be documented Not covered (why)
SA1602 Enumeration items should be documented Not covered (why)
SA1603 Documentation should contain valid XML Not covered (why)
SA1604 Element documentation should have summary Not covered (why)
SA1605 Partial element documentation should have summary Not covered (why)
SA1606 Element documentation should have summary text Not covered (why)
SA1607 Partial element documentation should have summary text Not covered (why)
SA1608 Element documentation should not have default summary Not covered (why)
SA1609 Property documentation should have value Not covered (why)
SA1610 Property documentation should have value text Not covered (why)
SA1611 Element parameters should be documented Not covered (why)
SA1612 Element parameter documentation should match element parameters BRO1611
SA1613 Element parameter documentation should declare parameter name BRO1612, when the parameter name is certain
SA1614 Element parameter documentation should have text Not covered (why)
SA1615 Element return value should be documented Not covered (why)
SA1616 Element return value documentation should have text Not covered (why)
SA1617 Void return value should not be documented BRO1608
SA1618 Generic type parameters should be documented Not covered (why)
SA1619 Generic type parameters should be documented partial class Not covered (why)
SA1620 Generic type parameter documentation should match type parameters BRO1613
SA1621 Generic type parameter documentation should declare parameter name BRO1614, when the type parameter name is certain
SA1622 Generic type parameter documentation should have text Not covered (why)
SA1623 Property summary documentation should match accessors BRO1604
SA1624 Property summary documentation should omit accessor with restricted access BRO1605
SA1625 Element documentation should not contain duplicate entries Not covered (why)
SA1626 Single-line comments should not use documentation style slashes BRO1602
SA1627 Documentation text should not be empty BRO1610, for an empty <remarks>
SA1628 Documentation text should begin with a capital letter Nothing to replace (why)
SA1629 Documentation text should end with a period BRO1603
SA1630 Documentation text should contain whitespace Nothing to replace (why)
SA1631 Documentation should meet character percentage Nothing to replace (why)
SA1632 Documentation text should meet minimum character length Nothing to replace (why)
SA1633 File should have header SDK: IDE0073 (file_header_template) for a plain header; BRO1615 for the XML header
SA1634 File header should show copyright BRO1615
SA1635 File header should have copyright text BRO1615
SA1636 File header copyright text should match BRO1615
SA1637 File header should contain file name BRO1615
SA1638 File header file name documentation should match file name BRO1615
SA1639 File header should have summary Not covered (why)
SA1640 File header should have valid company text BRO1615
SA1641 File header company name text should match BRO1615
SA1642 Constructor summary documentation should begin with standard text BRO1606
SA1643 Destructor summary documentation should begin with standard text BRO1607
SA1644 Documentation headers should not contain blank lines Nothing to replace (why)
SA1645 Included documentation file does not exist Not covered (why)
SA1646 Included documentation XPath does not exist Not covered (why)
SA1647 Include node does not contain valid file and path Not covered (why)
SA1648 inheritdoc should be used with inheriting class Not covered (why)
SA1649 File name should match first type name Not covered (why)
SA1650 Element documentation should be spelled correctly Nothing to replace (why)
SA1651 Do not use placeholder elements BRO1609
SA1653 Only one partial declaration should contain summary documentation Not covered (why)
SA1654 Properly encode generic brackets BRO1617

Layout

Rule Title Covered by
SA1500 Braces for multi-line statements should not share line SDK: IDE0055 (csharp_new_line_before_open_brace = all)
SA1501 Statement should not be on a single line BRO1508
SA1502 Element should not be on a single line BRO1509
SA1503 Braces should not be omitted BRO1514
SA1504 All accessors should be single-line or multi-line BRO1510
SA1505 Opening braces should not be followed by blank line BRO1503
SA1506 Element documentation headers should not be followed by blank line BRO1511
SA1507 Code should not contain multiple blank lines in a row BRO1517
SA1508 Closing braces should not be preceded by blank line BRO1518
SA1509 Opening braces should not be preceded by blank line BRO1501
SA1510 Chained statement blocks should not be preceded by blank line BRO1502
SA1511 While-do footer should not be preceded by blank line BRO1512
SA1512 Single-line comments should not be followed by blank line BRO1506
SA1513 Closing brace should be followed by blank line BRO1519
SA1514 Element documentation header should be preceded by blank line BRO1513
SA1515 Single-line comment should be preceded by blank line BRO1504
SA1516 Elements should be separated by blank line BRO1505
SA1517 Code should not contain blank lines at start of file SDK: only as a side effect of IDE0073 (file header); not fixed without file_header_template
SA1518 Use line endings correctly at end of file BRO1507
SA1519 Braces should not be omitted from multi-line child statement BRO1515
SA1520 Use braces consistently BRO1516

Maintainability

Rule Title Covered by
SA1119 Statement should not use unnecessary parenthesis BRO1405
SA1119_p Statement should not use unnecessary parenthesis BRO1405 (the hidden companion of SA1119, not a rule of its own)
SA1400 Access modifier should be declared BRO1404
SA1401 Fields should be private Not covered (why)
SA1402 File may only contain a single type Not covered (why)
SA1403 File may only contain a single namespace Not covered (why)
SA1404 Code analysis suppression should have justification Not covered (why)
SA1405 Debug.Assert should provide message text Not covered (why)
SA1406 Debug.Fail should provide message text Not covered (why)
SA1407 Arithmetic, bitwise, and shift expressions should declare precedence BRO1406
SA1408 Conditional expressions should declare precedence BRO1407
SA1409 Remove unnecessary code Nothing to replace (why)
SA1410 Remove delegate parenthesis when possible BRO1403, where BRO1125 doesn't turn the method into a lambda
SA1411 Attribute constructor should not use unnecessary parenthesis BRO1402
SA1412 Store files as UTF-8 with byte order mark SDK: charset = utf-8-bom, not in the preset; bro migrate sets it when SA1412 is on
SA1413 Use trailing comma in multi-line initializers and lists BRO1401
SX1412 Store files as UTF-8 without byte order mark SDK: charset = utf-8, not in the preset; bro migrate sets it when SX1412 is on

Naming

Rule Title Covered by
SA1300 Element should begin with upper-case letter BRO1309; namespaces: BRO1312 (off by default; bro migrate turns it on with SA1300)
SA1301 Element should begin with lower-case letter Nothing to replace (why)
SA1302 Interface names should begin with I BRO1304
SA1303 Const field names should begin with upper-case letter BRO1306
SA1304 Non-private readonly fields should begin with upper-case letter BRO1306
SA1305 Names should not use Hungarian notation BRO1310 (off by default)
SA1306 Field names should begin with lower-case letter BRO1303, for private and protected fields
SA1307 Accessible fields should begin with upper-case letter BRO1306
SA1308 Variable names should not be prefixed BRO1307
SA1309 Field names should not begin with underscore BRO1303 (private and protected fields) and BRO1306 (constants, static readonly and public or internal fields)
SA1310 Field names should not contain underscore BRO1308
SA1311 Static readonly fields should begin with upper-case letter BRO1306
SA1312 Variable names should begin with lower-case letter BRO1301
SA1313 Parameter names should begin with lower-case letter BRO1302
SA1314 Type parameter names should begin with T BRO1305
SA1315 Parameter names should match inherited names BRO1313 (off by default; bro migrate turns it on with SA1315)
SA1316 Tuple element names should use correct casing BRO1311
SA1317 Identifier should be named only with Latin letters Not covered (why)
SX1309 Field names should begin with underscore BRO1303 with stylebro_private_field_naming = _camelCase (bro migrate sets it when SX1309 is on)
SX1309S Static field names should begin with underscore BRO1303 with stylebro_private_mutable_static_field_naming = _camelCase

Ordering

Rule Title Covered by
SA1200 Using directives should be placed correctly BRO1008, where moving the usings can't change what a name binds to
SA1201 Elements should appear in the correct order BRO1001
SA1202 Elements should be ordered by access BRO1001
SA1203 Constants should appear before fields BRO1001
SA1204 Static elements should appear before instance elements BRO1001
SA1205 Partial elements should declare access BRO1007
SA1206 Declaration keywords should follow order SDK: IDE0036 (csharp_preferred_modifier_order), which checks the whole modifier order (details)
SA1207 Protected should come before internal SDK: IDE0036 (csharp_preferred_modifier_order; internal protected -> protected internal)
SA1208 System using directives should be placed before other using directives SDK: using sorting in dotnet format (dotnet_sort_system_directives_first = true)
SA1209 Using alias directives should be placed after other using directives SDK: using sorting in dotnet format
SA1210 Using directives should be ordered alphabetically by namespace SDK: using sorting in dotnet format
SA1211 Using alias directives should be ordered alphabetically by alias name SDK: using sorting in dotnet format
SA1212 Property accessors should follow order BRO1003
SA1213 Event accessors should follow order BRO1004
SA1214 Readonly fields should appear before non-readonly fields BRO1001
SA1216 Using static directives should be placed at the correct location SDK: using sorting in dotnet format
SA1217 Using static directives should be ordered alphabetically SDK: using sorting in dotnet format

Readability

Rule Title Covered by
SA1100 Do not prefix calls with base unless local implementation exists BRO1131
SA1101 Prefix local calls with this SDK: IDE0009 (dotnet_style_qualification_for_* = true)
SA1102 Query clause should follow previous clause BRO1127
SA1103 Query clauses should be on separate lines or all on one line BRO1128
SA1104 Query clause should begin on new line when previous clause spans multiple lines BRO1129
SA1105 Query clauses spanning multiple lines should begin on own line BRO1130
SA1106 Code should not contain empty statements BRO1101
SA1107 Code should not contain multiple statements on one line SDK: IDE0055 (csharp_preserve_single_line_statements = false)
SA1108 Block statements should not contain embedded comments BRO1132
SA1109 Block statements should not contain embedded regions Nothing to replace (why)
SA1110 Opening parenthesis or bracket should be on declaration line BRO1109
SA1111 Closing parenthesis should be on line of last parameter BRO1110
SA1112 Closing parenthesis should be on line of opening parenthesis BRO1116
SA1113 Comma should be on the same line as previous parameter BRO1117
SA1114 Parameter list should follow declaration BRO1118
SA1115 Parameter should follow comma BRO1119
SA1116 Split parameters should start on line after declaration BRO1107
SA1117 Parameters should be on same line or separate lines BRO1108
SA1118 Parameter should not span multiple lines Not covered (why)
SA1120 Comments should contain text BRO1120
SA1121 Use built-in type alias SDK: IDE0049 (dotnet_style_predefined_type_* = true)
SA1122 Use string.Empty for empty strings BRO1106
SA1123 Do not place regions within elements BRO1113
SA1124 Do not use regions BRO1112 (off in the preset)
SA1125 Use shorthand for nullable types BRO1115
SA1126 Prefix calls correctly Nothing to replace (why)
SA1127 Generic type constraints should be on their own line BRO1111
SA1128 Put constructor initializers on their own line BRO1105
SA1129 Do not use default value type constructor BRO1104
SA1130 Use lambda syntax BRO1125
SA1131 Use readable conditions BRO1103
SA1132 Do not combine fields BRO1114
SA1133 Do not combine attributes BRO1102
SA1134 Attributes should not share line SDK: IDE0055 formatting
SA1135 Using directives should be qualified BRO1126
SA1136 Enum values should be on separate lines BRO1121
SA1137 Elements should have the same indentation SDK: IDE0055 formatting
SA1139 Use literal suffix notation instead of casting BRO1122
SA1141 Use tuple syntax BRO1123
SA1142 Refer to tuple fields by name BRO1124
SA1143 Conditional expressions must be formatted consistently BRO1524
SA1414 Tuple types in signatures should have element names Not covered (why)
SX1101 Do not prefix local calls with 'this.' SDK: IDE0003 (dotnet_style_qualification_for_* = false), not in the preset; bro migrate turns it on when SX1101 is on

Spacing

Rule Title Covered by
SA1000 Keywords should be spaced correctly SDK: IDE0055 formatting
SA1001 Commas should be spaced correctly SDK: IDE0055 formatting
SA1002 Semicolons should be spaced correctly SDK: IDE0055 formatting
SA1003 Symbols should be spaced correctly SDK: IDE0055 formatting
SA1004 Documentation lines should begin with single space BRO1005
SA1005 Single line comments should begin with single space BRO1002
SA1006 Preprocessor keywords should not be preceded by space BRO1006
SA1007 Operator keyword should be followed by space SDK: IDE0055 formatting
SA1008 Opening parenthesis should be spaced correctly SDK: IDE0055 formatting
SA1009 Closing parenthesis should be spaced correctly SDK: IDE0055 formatting
SA1010 Opening square brackets should be spaced correctly SDK: IDE0055 formatting
SA1011 Closing square brackets should be spaced correctly SDK: IDE0055 formatting
SA1012 Opening braces should be spaced correctly SDK: IDE0055 formatting
SA1013 Closing braces should be spaced correctly SDK: IDE0055 formatting
SA1014 Opening generic brackets should be spaced correctly SDK: IDE0055 formatting
SA1015 Closing generic brackets should be spaced correctly SDK: IDE0055 formatting
SA1016 Opening attribute brackets should be spaced correctly SDK: IDE0055 formatting
SA1017 Closing attribute brackets should be spaced correctly SDK: IDE0055 formatting
SA1018 Nullable type symbols should be spaced correctly SDK: IDE0055 formatting
SA1019 Member access symbols should be spaced correctly SDK: IDE0055 formatting
SA1020 Increment decrement symbols should be spaced correctly SDK: IDE0055 formatting
SA1021 Negative signs should be spaced correctly SDK: IDE0055 formatting
SA1022 Positive signs should be spaced correctly SDK: IDE0055 formatting
SA1023 Dereference and access of symbols should be spaced correctly SDK: IDE0055 formatting
SA1024 Colons Should Be Spaced Correctly SDK: IDE0055 formatting
SA1025 Code should not contain multiple whitespace in a row SDK: IDE0055 formatting
SA1026 Code should not contain space after new or stackalloc keyword in implicitly typed array allocation SDK: IDE0055 formatting
SA1027 Use tabs correctly SDK: IDE0055 formatting (indent_style = space)
SA1028 Code should not contain trailing whitespace SDK: IDE0055 formatting

Special

Rule Title Covered by
SA0001 XML comment analysis disabled Not applicable (why)
SA0002 Invalid settings file Not applicable (why)