StyleCop rules and StyleBro¶
What happens to each StyleCop.Analyzers rule when a project moves to StyleBro. Every rule gets one of three answers:
- SDK: the .NET SDK already has an equivalent that
dotnet formatfixes. StyleBro's preset turns it on. - StyleBro: StyleBro provides (or should provide) a rule with a safe automatic fix.
- Drop: there is no safe automatic fix, so StyleBro deliberately doesn't cover it.
- Not yet: a StyleBro rule (or turning on an SDK setting) looks feasible but isn't done.
Every rule StyleBro doesn't cover is explained, with what it would take to revisit it, in skipped-rules.md.
Status: complete: every StyleCop rule is StyleBro, SDK or dropped with a reason (2026-10-07). Of 197 rules: 44 SDK, 109 StyleBro (109 done), 42 drop, 0 not yet done, 2 not applicable or variants.
How this was measured¶
Scripts and data: scripts/stylecop-survey.
- Inventory: every diagnostic in StyleCop.Analyzers 1.1.118 and 1.2.0-beta.556, read from the analyzer DLLs, including whether StyleCop itself ships a code fix. 1.2.0-beta.556 adds SA1141, SA1142, SA1316, SA1414 and some variants.
- Teams keeping it on: the effective setting for production code in 3 repos that use StyleCop: OpenTelemetry .NET (
ea1e3f3, StyleCop 1.2.0-beta.556), Polly (0275bc2, StyleCop 1.2.0-beta.556), a private 30-project app (StyleCop 1.1.118). Shown as OTel / Polly / App. - Diagnostics with every rule on: each repo built with all StyleCop rules enabled as warnings (and XML docs on), counting unique diagnostics. Shown as OTel / Polly / App. Where a team keeps a rule on, the count is near zero; where it is off, the count shows how much code would change. 10 of OpenTelemetry's 81 projects (examples and some tests) did not compile in the survey (CS1705 in a shallow clone) and are missing from its counts.
- SDK check: for 94 rules, a small violating example was formatted with
dotnet format styleanddotnet format whitespace(SDK only, not StyleCop's own fixes) using StyleCop-like SDK settings, and StyleCop was run again. "fixed" means the diagnostic was gone. Each rule was checked on one example, so a "fixed" rule can still have cases the SDK handles differently.
Not yet done, by demand¶
Rules that look feasible but aren't covered yet, ordered by how many of the 3 teams keep them on, then by how often they fire in App. Details and what each would take: skipped-rules.md.
| Rule | Title | Teams keeping it on (OTel / Polly / App) | Diagnostics (OTel / Polly / App) | Status |
|---|---|---|---|---|
Observation. Polly turns off most of StyleCop's spacing, layout and naming rules and enforces the SDK equivalents instead: 101 IDE rule severities, including IDE0055 (formatting), IDE0011 (braces) and IDE1006 with 10 naming rules, plus EnforceCodeStyleInBuild. That is the model StyleBro's preset follows. All three repos turn off SA1200 (using placement) and SA1401 (fields should be private).
Naming note. The SDK can detect all of StyleCop's naming rules (IDE1006 with naming rules in .editorconfig), but dotnet format cannot fix them: it reports "Unable to fix IDE1006. Code fix NamingStyleCodeFixProvider doesn't support Fix All in Solution." A StyleBro rename fix with Fix All would close that gap. Renaming public API breaks callers, so it should start with private and local symbols.
The documentation rules (SA16xx) are mostly not tested yet. The ones where StyleCop has a fix are candidates for the planned BRO16xx rules.
All rules¶
Documentation¶
| Rule | Title | Default | StyleCop fix | Teams keeping it on (OTel / Polly / App) | Diagnostics (OTel / Polly / App) | SDK check | Proposal |
|---|---|---|---|---|---|---|---|
| SA1600 | Elements should be documented | on | yes | off / on / off | 6,259 / 3,249 / 19,004 | StyleBro BRO1601 (done) for overrides and implementations only (<inheritdoc/>); other missing documentation is not reported (no placeholder stubs, user decision) (details) |
|
| SA1601 | Partial elements should be documented | on | yes | on / off / on | 16 / 78 / 0 | Drop: Missing documentation on a partial element; the only fix is placeholder text (no stubs, user decision). (details) | |
| SA1602 | Enumeration items should be documented | on | yes | on / on / on | 0 / 10 / 530 | Drop: Missing documentation on enum members; the only fix is placeholder text (no stubs, user decision). 530 findings in the private app. (details) | |
| SA1603 | Documentation should contain valid XML | off | no | off / on / off | 0 / 0 / 0 | Drop: Off by default, no StyleCop fix; invalid XML needs a person to say what was meant. (details) | |
| SA1604 | Element documentation should have summary | on | no | on / on / on | 0 / 0 / 1 | Drop: A doc comment without <summary>; the fix would be placeholder text. (details) |
|
| SA1605 | Partial element documentation should have summary | on | no | on / on / on | 0 / 0 / 0 | Drop: Same as SA1604 for partial elements. (details) | |
| SA1606 | Element documentation should have summary text | on | no | on / on / on | 0 / 0 / 0 | Drop: An empty <summary>; the fix would be placeholder text (no stubs, user decision). (details) |
|
| SA1607 | Partial element documentation should have summary text | on | no | on / on / on | 0 / 0 / 0 | Drop: Same as SA1606 for partial elements. (details) | |
| SA1608 | Element documentation should not have default summary | on | no | on / on / on | 0 / 0 / 0 | Drop: The default "Summary description for X" text has to be replaced by a person. (details) | |
| SA1609 | Property documentation should have value | off | yes | off / off / off | 292 / 171 / 8 | Drop: Off by default. Missing <value>; the fix would be placeholder text (no stubs, user decision). (details) |
|
| SA1610 | Property documentation should have value text | on | yes | on / off / on | 0 / 0 / 0 | Drop: An empty <value>; StyleCop's fix writes placeholder text. (details) |
|
| SA1611 | Element parameters should be documented | on | no | on / on / on | 8 / 1 / 11 | Drop: Missing <param>; the fix would be placeholder text (no stubs, user decision). (details) |
|
| SA1612 | Element parameter documentation should match element parameters | on | no | on / on / on | 0 / 0 / 0 | StyleBro BRO1611 (done), with a fix (StyleCop has none): stale tags renamed or removed, tags reordered | |
| SA1613 | Element parameter documentation should declare parameter name | on | no | on / on / on | 0 / 0 / 0 | StyleBro BRO1612 (done) when the name is certain (one unnamed tag and one undocumented parameter, or all unnamed with one per parameter); StyleCop reports every unnamed tag and has no fix | |
| SA1614 | Element parameter documentation should have text | on | no | on / on / off | 0 / 0 / 4 | Drop: An empty <param>; the fix would be placeholder text. (details) |
|
| SA1615 | Element return value should be documented | on | yes | on / on / on | 3 / 1 / 6 | Drop: Missing <returns>; the fix would be placeholder text. (details) |
|
| SA1616 | Element return value documentation should have text | on | yes | on / on / on | 0 / 0 / 0 | Drop: An empty <returns>; the fix would be placeholder text. (details) |
|
| SA1617 | Void return value should not be documented | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1608 (done), same results and output as StyleCop | |
| SA1618 | Generic type parameters should be documented | on | no | on / on / on | 0 / 0 / 1 | Drop: Missing <typeparam>; the fix would be placeholder text. (details) |
|
| SA1619 | Generic type parameters should be documented partial class | on | no | on / on / on | 0 / 0 / 0 | Drop: Same as SA1618 for partial types. (details) | |
| SA1620 | Generic type parameter documentation should match type parameters | on | no | on / on / on | 0 / 0 / 0 | StyleBro BRO1613 (done), same positions as StyleCop, with a fix (StyleCop has none): stale tags renamed or removed, tags reordered | |
| SA1621 | Generic type parameter documentation should declare parameter name | on | no | on / on / on | 0 / 0 / 0 | StyleBro BRO1614 (done) when the name is certain, like BRO1612 | |
| SA1622 | Generic type parameter documentation should have text | on | no | on / on / on | 0 / 0 / 0 | Drop: An empty <typeparam>; the fix would be placeholder text. (details) |
|
| SA1623 | Property summary documentation should match accessors | on | yes | on / on / off | 0 / 0 / 8 | StyleBro BRO1604 (done), same results as StyleCop | |
| SA1624 | Property summary documentation should omit accessor with restricted access | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1605 (done), same results as StyleCop | |
| SA1625 | Element documentation should not be copied and pasted | on | no | on / on / on | 0 / 0 / 0 | Drop: Identical text copied between tags has to be rewritten by a person. (details) | |
| SA1626 | Single-line comments should not use documentation style slashes | on | yes | on / on / on | 0 / 0 / 2 | StyleBro BRO1602 (done), same results as StyleCop | |
| SA1627 | Documentation text should not be empty | on | no | on / on / on | 0 / 0 / 0 | StyleBro BRO1610 (done) for empty remarks, with a fix (removal); StyleCop has none | |
| SA1628 | Documentation text should begin with a capital letter | off | no | off / on / off | 0 / 0 / 0 | Drop: StyleCop never reports it. StyleCop 1.2 never reports it (not implemented, probed while building BRO16xx). (details) | |
| SA1629 | Documentation text should end with a period | on | yes | on / on / off | 0 / 0 / 29 | StyleBro BRO1603 (done). Differs from StyleCop: text ending with ?, ! or : is not reported |
|
| SA1630 | Documentation text should contain whitespace | off | no | off / on / off | 0 / 0 / 0 | Drop: StyleCop never reports it. Off by default and no diagnostic on a one-word summary (probed). (details) | |
| SA1631 | Documentation should meet character percentage | off | no | off / on / off | 0 / 0 / 0 | Drop: StyleCop never reports it. Off by default and no diagnostic on a summary of symbols (probed). (details) | |
| SA1632 | Documentation text should meet minimum character length | off | no | off / on / off | 0 / 0 / 0 | Drop: StyleCop never reports it. Off by default and no diagnostic on a one-letter summary (probed). (details) | |
| SA1633 | File should have header | on | yes | on / off / off | 0 / 0 / 2,632 | fixed | SDK: IDE0073 (file_header_template) for a plain header (xmlHeader: false); StyleBro BRO1615 for the XML header |
| SA1634 | File header should show copyright | on | yes | on / off / on | 0 / 0 / 0 | StyleBro BRO1615 (done), one rule for the XML header; same positions and fixed headers as StyleCop, except that the fix keeps other comments (StyleCop's deletes them) | |
| SA1635 | File header should have copyright text | on | yes | on / off / on | 0 / 0 / 0 | StyleBro BRO1615 (done), one rule for the XML header; same positions and fixed headers as StyleCop, except that the fix keeps other comments (StyleCop's deletes them) | |
| SA1636 | File header copyright text should match | on | yes | on / off / on | 0 / 0 / 0 | StyleBro BRO1615 (done), one rule for the XML header; same positions and fixed headers as StyleCop, except that the fix keeps other comments (StyleCop's deletes them) | |
| SA1637 | File header should contain file name | on | yes | on / off / on | 0 / 0 / 0 | StyleBro BRO1615 (done), one rule for the XML header; same positions and fixed headers as StyleCop, except that the fix keeps other comments (StyleCop's deletes them) | |
| SA1638 | File header file name documentation should match file name | on | yes | on / off / on | 0 / 0 / 0 | StyleBro BRO1615 (done), one rule for the XML header; same positions and fixed headers as StyleCop, except that the fix keeps other comments (StyleCop's deletes them) | |
| SA1639 | File header should have summary | off | yes | off / off / off | 0 / 0 / 0 | Drop: Off by default; the header's <summary> has to be written by a person. (details) |
|
| SA1640 | File header should have valid company text | on | yes | on / off / on | 0 / 0 / 0 | StyleBro BRO1615 (done), one rule for the XML header; same positions and fixed headers as StyleCop, except that the fix keeps other comments (StyleCop's deletes them) | |
| SA1641 | File header company name text should match | on | yes | on / off / on | 0 / 0 / 0 | StyleBro BRO1615 (done), one rule for the XML header; same positions and fixed headers as StyleCop, except that the fix keeps other comments (StyleCop's deletes them) | |
| SA1642 | Constructor summary documentation should begin with standard text | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1606 (done), same results as StyleCop (the fix adds a space after the standard sentence) | |
| SA1643 | Destructor summary documentation should begin with standard text | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1607 (done), same results as StyleCop (the fix adds a space after the standard sentence) | |
| SA1644 | Documentation headers should not contain blank lines | off | no | off / on / off | 0 / 0 / 0 | Drop: StyleCop never reports it. StyleCop 1.2 never reports it (not implemented, probed while building BRO16xx). (details) | |
| SA1645 | Included documentation file does not exist | off | no | off / on / off | 0 / 0 / 0 | Drop: Off by default; a missing <include> file can't be fixed automatically. (details) |
|
| SA1646 | Included documentation XPath does not exist | off | no | off / on / off | 0 / 0 / 0 | Drop: Off by default; a wrong <include> XPath can't be fixed automatically. (details) |
|
| SA1647 | Include node does not contain valid file and path | off | no | off / on / off | 0 / 0 / 0 | Drop: Off by default; an <include> without file/path can't be fixed automatically. (details) |
|
| SA1648 | inheritdoc should be used with inheriting class | on | no | on / on / on | 0 / 0 / 0 | Drop: <inheritdoc/> where there is nothing to inherit: the fix is real documentation. (details) |
|
| SA1649 | File name should match first type name | on | yes | off / on / off | 0 / 0 / 1 | Drop: Renaming files isn't something dotnet format can do. (details) |
|
| SA1650 | Element documentation should be spelled correctly | off | no | off / on / off | 0 / 0 / 0 | Drop: StyleCop never reports it. Off by default and no diagnostic on misspelled words (probed). (details) | |
| SA1651 | Do not use placeholder elements | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1609 (done), same results and output as StyleCop |
Layout¶
| Rule | Title | Default | StyleCop fix | Teams keeping it on (OTel / Polly / App) | Diagnostics (OTel / Polly / App) | SDK check | Proposal |
|---|---|---|---|---|---|---|---|
| SA1500 | Braces for multi-line statements should not share line | on | yes | on / on / off | 0 / 0 / 6 | fixed | SDK: IDE0055 (csharp_new_line_before_open_brace = all) |
| SA1501 | Statement should not be on a single line | on | yes | on / on / off | 0 / 0 / 1 | fixed | StyleBro BRO1508 (done). Differs from StyleCop: blocks with a comment inside, and a switch-section block on the line of switch (x) {, are not reported |
| SA1502 | Element should not be on a single line | on | yes | on / on / off | 0 / 0 / 356 | fixed | StyleBro BRO1509 (done), same positions as StyleCop (local functions reported once, as BRO1509) |
| SA1503 | Braces should not be omitted | on | yes | on / off / off | 0 / 0 / 14 | fixed | StyleBro BRO1514 (done; replaces IDE0011, whose fix breaks multi-targeted projects). Skips comments/directives where the braces go and multi-line strings |
| SA1504 | All accessors should be single-line or multi-line | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1510 (done), same positions as StyleCop; the fix decides per property (StyleCop's applies one direction to the whole project) and keeps comments | |
| SA1505 | Opening braces should not be followed by blank line | on | yes | on / on / off | 0 / 0 / 37 | not fixed | StyleBro BRO1503 (done), same results as StyleCop |
| SA1506 | Element documentation headers should not be followed by blank line | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1511 (done), same positions and output as StyleCop | |
| SA1507 | Code should not contain multiple blank lines in a row | on | yes | on / off / on | 0 / 0 / 0 | fixed | StyleBro BRO1517 (done; replaces IDE2000, whose fix breaks multi-targeted projects). Leaves runs after {, before } and below a comment to BRO1503/BRO1518/BRO1506 |
| SA1508 | Closing braces should not be preceded by blank line | on | yes | on / off / off | 0 / 46 / 85 | fixed | StyleBro BRO1518 (done; replaces IDE2002). Leaves blank lines below a comment and in empty blocks to BRO1506/BRO1503 |
| SA1509 | Opening braces should not be preceded by blank line | on | yes | on / on / on | 0 / 0 / 0 | not fixed | StyleBro BRO1501 (done), same results as StyleCop |
| SA1510 | Chained statement blocks should not be preceded by blank line | on | yes | on / on / on | 0 / 0 / 0 | not fixed | StyleBro BRO1502 (done), same results as StyleCop |
| SA1511 | While-do footer should not be preceded by blank line | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1512 (done), same positions and output as StyleCop | |
| SA1512 | Single-line comments should not be followed by blank line | on | yes | off / off / on | 82 / 46 / 0 | not fixed | StyleBro BRO1506 (done), same results as StyleCop |
| SA1513 | Closing brace should be followed by blank line | on | yes | on / on / off | 0 / 0 / 119 | fixed | StyleBro BRO1519 (done; replaces IDE2003). Leaves a comment, documentation or member after } to BRO1504/BRO1513/BRO1505 |
| SA1514 | Element documentation header should be preceded by blank line | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1513 (done); documentation right below a comment is not reported (it would conflict with SA1512/BRO1506) | |
| SA1515 | Single-line comment should be preceded by blank line | on | yes | on / on / off | 0 / 0 / 31 | not fixed | StyleBro BRO1504 (done), same results as StyleCop |
| SA1516 | Elements should be separated by blank line | on | yes | on / off / off | 0 / 44 / 5,873 | not fixed | StyleBro BRO1505 (done), same positions as StyleCop |
| SA1517 | Code should not contain blank lines at start of file | on | yes | on / on / off | 0 / 0 / 11 | fixed | 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 | on | yes | off / off / off | 2 / 40 / 31 | not fixed | StyleBro BRO1507 (done), same results as StyleCop's default setting |
| SA1519 | Braces should not be omitted from multi-line child statement | on | yes | on / on / on | 0 / 0 / 0 | fixed | StyleBro BRO1515 (done; replaces IDE0011). Same skips as BRO1514 |
| SA1520 | Use braces consistently | on | yes | on / on / on | 0 / 0 / 0 | fixed | StyleBro BRO1516 (done; replaces IDE0011). Same skips as BRO1514 |
Maintainability¶
| Rule | Title | Default | StyleCop fix | Teams keeping it on (OTel / Polly / App) | Diagnostics (OTel / Polly / App) | SDK check | Proposal |
|---|---|---|---|---|---|---|---|
| SA1119 | Statement should not use unnecessary parenthesis | on | yes | on / on / off | 0 / 0 / 1 | fixed | StyleBro BRO1405 (done; replaces IDE0047, whose fix breaks multi-targeted projects). Skips parentheses whose removal would change how the code parses (StyleCop's fix can make a generic call) |
| SA1119_p | Statement should not use unnecessary parenthesis | on | yes | on / off / on | 0 / 0 / 0 | StyleBro BRO1405 (done). Not a rule of its own: the Hidden companion of SA1119 that StyleCop reports on the same parentheses' ( and ) so the IDE greys them out (it only checks parenthesized expressions, never patterns). BRO1405 reports the same parentheses; the greying isn't ported |
|
| SA1400 | Access modifier should be declared | on | yes | on / on / off | 0 / 0 / 10 | fixed | StyleBro BRO1404 (done; replaces IDE0040), same positions and output as StyleCop |
| SA1401 | Fields should be private | on | no | off / off / off | 141 / 48 / 39 | Drop: Making a public or protected field private changes the public API and breaks callers. 141 / 48 / 39 findings with the rule on. (details) | |
| SA1402 | File may only contain a single type | on | yes | on / off / off | 0 / 34 / 1 | Drop: Moving a type to its own file isn't something dotnet format can do (code fixes can't add documents through it). (details) |
|
| SA1403 | File may only contain a single namespace | on | no | on / on / on | 0 / 0 / 0 | Drop: StyleCop has no fix; splitting namespaces into files has the same problem as SA1402. (details) | |
| SA1404 | Code analysis suppression should have justification | on | yes | on / on / on | 0 / 0 / 0 | Drop: The justification of a SuppressMessage has to be written by a person. (details) | |
| SA1405 | Debug.Assert should provide message text | on | no | on / on / on | 0 / 0 / 0 | Drop: StyleCop has no fix; the message for Debug.Assert has to be written by a person. (details) | |
| SA1406 | Debug.Fail should provide message text | on | no | on / on / on | 0 / 0 / 0 | Drop: StyleCop has no fix; the message for Debug.Fail has to be written by a person. (details) | |
| SA1407 | Arithmetic expressions should declare precedence | on | yes | on / on / off | 0 / 0 / 5 | not fixed | StyleBro BRO1406 (done; replaces IDE0048, whose fix breaks multi-targeted projects and needed two runs), same positions and output as StyleCop |
| SA1408 | Conditional expressions should declare precedence | on | yes | on / on / off | 0 / 0 / 14 | fixed | StyleBro BRO1407 (done; replaces IDE0048). Also checks and/or patterns, like StyleCop's current source (after 1.2.0-beta.556) |
| SA1409 | Remove unnecessary code | off | no | off / on / off | 0 / 0 / 0 | Drop: StyleCop never reports it. Off by default and no diagnostic for an empty try { } finally { } (probed). (details) |
|
| SA1410 | Remove delegate parenthesis when possible | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1403 (done), only where BRO1125 doesn't turn the method into a lambda | |
| SA1411 | Attribute constructor should not use unnecessary parenthesis | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1402 (done), same positions; the fix also removes the space in ( ) |
|
| SA1412 | Store files as UTF-8 with byte order mark | off | yes | off / off / off | 876 / 325 / 2,581 | fixed | SDK: charset = utf-8-bom (dotnet format writes the BOM); off by default in StyleCop and not in the preset; stylebro-migrate sets it when SA1412 is on |
| SA1413 | Use trailing comma in multi-line initializers | on | yes | on / off / off | 0 / 407 / 1,862 | not fixed | StyleBro BRO1401 (done). Differs from StyleCop: lists with #if between their braces are not reported |
Naming¶
| Rule | Title | Default | StyleCop fix | Teams keeping it on (OTel / Polly / App) | Diagnostics (OTel / Polly / App) | SDK check | Proposal |
|---|---|---|---|---|---|---|---|
| SA1300 | Element should begin with upper-case letter | on | yes | on / off / off | 0 / 0 / 4 | not fixed | StyleBro BRO1309 (done), rename with Fix All incl. overrides/implementations; namespaces: BRO1312 (done, opt-in: off by default, stylebro-migrate turns it on with SA1300) |
| SA1301 | Element should begin with lower-case letter | off | no | off / off / off | 0 / 0 / 0 | Drop: StyleCop never reports it. Off by default and no diagnostic (probed). StyleCop keeps the id for compatibility. (details) | |
| SA1302 | Interface names should begin with I | on | yes | on / off / on | 0 / 0 / 0 | not fixed | StyleBro BRO1304 (done), rename with Fix All, same results as StyleCop |
| SA1303 | Const field names should begin with upper-case letter | on | yes | on / off / off | 0 / 0 / 4 | not fixed | StyleBro BRO1306 (done), rename with Fix All |
| SA1304 | Non-private readonly fields should begin with upper-case letter | on | yes | on / off / on | 0 / 1 / 0 | StyleBro BRO1306 (done), rename with Fix All | |
| SA1305 | Field names should not use Hungarian notation | off | no | off / off / off | 82 / 1 / 14 | StyleBro BRO1310 (done, off by default like StyleCop), the prefix removed in the same rename as the other naming rules | |
| SA1306 | Field names should begin with lower-case letter | on | yes | on / off / off | 0 / 4 / 11 | not fixed | StyleBro BRO1303 (done) for private and protected fields; stylebro_private_field_naming picks count (default) or _count |
| SA1307 | Accessible fields should begin with upper-case letter | on | yes | on / off / on | 0 / 0 / 0 | StyleBro BRO1306 (done), rename with Fix All | |
| SA1308 | Variable names should not be prefixed | on | yes | on / off / on | 0 / 0 / 0 | StyleBro BRO1307 (done), rename to the complete correct name in one pass | |
| SA1309 | Field names should not begin with underscore | on | yes | on / off / off | 0 / 486 / 1,060 | not fixed | StyleBro BRO1303 (done, private and protected fields) and BRO1306 (done, constants, static readonly and public/internal fields) |
| SA1310 | Field names should not contain underscore | on | yes | on / on / off | 184 / 0 / 7 | StyleBro BRO1308 (done), words joined in the field's casing (MAX_VALUE -> MaxValue) | |
| SA1311 | Static readonly fields should begin with upper-case letter | on | yes | on / off / off | 0 / 0 / 4 | not fixed | StyleBro BRO1306 (done), rename with Fix All |
| SA1312 | Variable names should begin with lower-case letter | on | yes | on / off / off | 0 / 14 / 7 | not fixed | StyleBro BRO1301 (done), rename with Fix All; also fixes _name |
| SA1313 | Parameter names should begin with lower-case letter | on | yes | on / off / off | 0 / 0 / 90 | not fixed | StyleBro BRO1302 (done), rename with Fix All incl. named arguments and overrides; also fixes _name |
| SA1314 | Type parameter names should begin with T | on | yes | on / off / off | 0 / 0 / 0 | not fixed | StyleBro BRO1305 (done), rename with Fix All, same results as StyleCop |
| SA1316 (1.2 beta) | Tuple element names should use correct casing | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1311 (done), the name renamed with every use and override solution-wide; stylebro_tuple_element_name_casing from tupleElementNameCasing |
|
| SX1309 | Field names should begin with underscore | off | yes | off / off / off | 842 / 0 / 32 | StyleBro BRO1303 (done) with stylebro_private_field_naming = _camelCase, which stylebro-migrate sets when SX1309 is on |
|
| SX1309S | Static field names should begin with underscore | off | yes | off / off / off | 19 / 1 / 0 | StyleBro BRO1303 (done) with stylebro_private_mutable_static_field_naming = _camelCase (the style of private static fields that aren't readonly or const, SX1309S's fields; not set: stylebro_private_field_naming's). stylebro-migrate counts SX1309S as covered when it writes _camelCase (always with SX1309); on its own, with instance fields named count, SA1309 is off, StyleCop accepts instance fields with and without _, and the report lists it as not expressible |
Ordering¶
| Rule | Title | Default | StyleCop fix | Teams keeping it on (OTel / Polly / App) | Diagnostics (OTel / Polly / App) | SDK check | Proposal |
|---|---|---|---|---|---|---|---|
| SA1200 | Using directives should be placed correctly | on | yes | off / off / off | 0 / 0 / 14,192 | fixed | StyleBro BRO1008 (done; replaces IDE0065, whose fix can change what names bind to: CS0104/CS0118 in eShop and Ocelot). Moves the usings only when no name can be looked up differently; skips files with several namespaces, directives before the namespace body, usings on both levels |
| SA1201 | Elements should appear in the correct order | on | yes | on / off / off | 0 / 89 / 839 | StyleBro BRO1001 (done) | |
| SA1202 | Elements should be ordered by access | on | yes | on / off / off | 0 / 71 / 185 | StyleBro BRO1001 (done) | |
| SA1203 | Constants should appear before fields | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1001 (done) | |
| SA1204 | Static elements should appear before instance elements | on | yes | on / on / off | 0 / 2 / 50 | StyleBro BRO1001 (done) | |
| SA1205 | Partial elements should declare access | on | yes | on / on / on | 0 / 0 / 0 | fixed | StyleBro BRO1007 (done; replaces IDE0040, whose fix breaks multi-targeted projects), same positions and output as StyleCop |
| SA1206 | Declaration keywords should follow order | on | yes | on / on / on | 0 / 0 / 0 | fixed | SDK: IDE0036 (csharp_preferred_modifier_order, the SDK default order) (details) |
| SA1207 | Protected should come before internal | on | yes | on / on / on | 0 / 0 / 0 | fixed | SDK: IDE0036 (csharp_preferred_modifier_order; internal protected -> protected internal) |
| SA1208 | System using directives should be placed before other using directives | on | yes | on / on / off | 0 / 0 / 57 | fixed | SDK: using sorting in dotnet format (dotnet_sort_system_directives_first = true) |
| SA1209 | Using alias directives should be placed after other using directives | on | yes | on / on / off | 0 / 0 / 4 | fixed | SDK: using sorting in dotnet format |
| SA1210 | Using directives should be ordered alphabetically by namespace | on | yes | on / on / off | 0 / 0 / 290 | fixed | SDK: using sorting in dotnet format |
| SA1211 | Using alias directives should be ordered alphabetically by alias name | on | yes | on / on / on | 0 / 0 / 0 | fixed | SDK: using sorting in dotnet format |
| SA1212 | Property accessors should follow order | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1003 (done), same positions and output as StyleCop | |
| SA1213 | Event accessors should follow order | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1004 (done), same positions and output as StyleCop | |
| SA1214 | Readonly fields should appear before non-readonly fields | on | yes | on / on / off | 0 / 0 / 2 | StyleBro BRO1001 (done) | |
| SA1216 | Using static directives should be placed at the correct location | on | yes | on / on / on | 0 / 0 / 0 | fixed | SDK: using sorting in dotnet format |
| SA1217 | Using static directives should be ordered alphabetically | on | yes | on / on / on | 0 / 0 / 0 | fixed | SDK: using sorting in dotnet format |
Readability¶
| Rule | Title | Default | StyleCop fix | Teams keeping it on (OTel / Polly / App) | Diagnostics (OTel / Polly / App) | SDK check | Proposal |
|---|---|---|---|---|---|---|---|
| SA1100 | Do not prefix calls with base unless local implementation exists | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1131 (done). Differs from StyleCop: virtual members in types that aren't sealed are not reported (this. would dispatch to a derived override) |
|
| SA1101 | Prefix local calls with this | on | yes | on / off / off | 0 / 4,007 / 17,153 | fixed | SDK: IDE0009 (dotnet_style_qualification_for_* = true) |
| SA1102 | Query clause should follow previous clause | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1127 (done), same positions as StyleCop except blank lines around a comment line | |
| SA1103 | Query clauses should be on separate lines or all on one line | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1128 (done), always one clause per line (StyleCop's fix picks one line or split, varying between runs) | |
| SA1104 | Query clause should begin on new line when previous clause spans multiple lines | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1129 (done), same positions as StyleCop | |
| SA1105 | Query clauses spanning multiple lines should begin on own line | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1130 (done), same positions as StyleCop | |
| SA1106 | Code should not contain empty statements | on | yes | on / on / on | 0 / 0 / 0 | not fixed | StyleBro BRO1101 (done). Differs from StyleCop: embedded (while (x) ;) and labeled empty statements are not reported |
| SA1107 | Code should not contain multiple statements on one line | on | yes | on / off / off | 0 / 243 / 0 | fixed | SDK: IDE0055 (csharp_preserve_single_line_statements = false) |
| SA1108 | Block statements should not contain embedded comments | on | no | on / on / on | 0 / 0 / 0 | StyleBro BRO1132 (done), same positions as StyleCop; StyleCop has no fix, StyleBro moves the comment into the block. Not reported: headers spanning several lines (user decision), single-line blocks, comments spanning lines | |
| SA1109 | Block statements should not contain embedded regions | off | no | off / on / off | 0 / 0 / 0 | Drop: StyleCop never reports it. Off by default and no diagnostic for a region between if (b) and its block (probed). (details) |
|
| SA1110 | Opening parenthesis or bracket should be on declaration line | on | yes | on / on / off | 0 / 0 / 3 | StyleBro BRO1109 (done), same results and output as StyleCop | |
| SA1111 | Closing parenthesis should be on line of last parameter | on | yes | on / on / off | 0 / 0 / 740 | StyleBro BRO1110 (done), same results and output as StyleCop | |
| SA1112 | Closing parenthesis should be on line of opening parenthesis | on | yes | on / on / on | 0 / 0 / 0 | not fixed | StyleBro BRO1116 (done), same positions and output as StyleCop |
| SA1113 | Comma should be on the same line as previous parameter | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1117 (done), same positions and output as StyleCop | |
| SA1114 | Parameter list should follow declaration | on | no | on / on / on | 0 / 0 / 0 | StyleBro BRO1118 (done), with a fix (StyleCop has none); a comment before the first item is not reported | |
| SA1115 | Parameter should follow comma | on | no | on / off / off | 0 / 0 / 0 | StyleBro BRO1119 (done), with a fix (StyleCop has none) | |
| SA1116 | Split parameters should start on line after declaration | on | yes | on / off / off | 0 / 375 / 266 | not fixed | StyleBro BRO1107 (done), also checks record and primary-constructor parameters |
| SA1117 | Parameters should be on same line or separate lines | on | no | on / off / off | 0 / 370 / 102 | not fixed | StyleBro BRO1108 (done), also checks record and primary-constructor parameters; unlike StyleCop, has a fix |
| SA1118 | Parameter should not span multiple lines | on | no | on / on / off | 0 / 0 / 126 | Drop: StyleCop has no fix. A multi-line argument (other than the first, or a lambda/anonymous object) needs extracting into a variable: a refactoring that names things. 126 findings in the private app. (details) | |
| SA1120 | Comments should contain text | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1120 (done), same positions; the fix removes every empty comment at that end of the group in one run | |
| SA1121 | Use built-in type alias | on | yes | on / on / off | 0 / 0 / 0 | fixed | SDK: IDE0049 (dotnet_style_predefined_type_* = true) |
| SA1122 | Use string.Empty for empty strings | on | yes | on / off / off | 0 / 7 / 352 | not fixed | StyleBro BRO1106 (done), same results as StyleCop |
| SA1123 | Do not place regions within elements | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1113 (done), same results and output as StyleCop | |
| SA1124 | Do not use regions | on | yes | on / off / off | 0 / 264 / 17 | StyleBro BRO1112 (done), off in the preset (StyleCop has it on; opt-in because it's a large one-time change) | |
| SA1125 | Use shorthand for nullable types | on | no | on / on / on | 0 / 0 / 0 | StyleBro BRO1115 (done), same positions, with a fix (StyleCop has none) | |
| SA1126 | Prefix calls correctly | off | no | off / off / off | 0 / 0 / 0 | Drop: StyleCop never reports it. Off by default and no diagnostic on an unprefixed member call (probed). (details) | |
| SA1127 | Generic type constraints should be on their own line | on | yes | on / on / off | 0 / 0 / 82 | StyleBro BRO1111 (done), same results and output as StyleCop | |
| SA1128 | Put constructor initializers on their own line | on | yes | on / on / off | 0 / 0 / 408 | not fixed | StyleBro BRO1105 (done), same results as StyleCop |
| SA1129 | Do not use default value type constructor | on | yes | on / on / on | 0 / 0 / 0 | not fixed | StyleBro BRO1104 (done). Differs from StyleCop: new T() on a type parameter and new S(); statements are not reported |
| SA1130 | Use lambda syntax | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1125 (done), lambdas checked by binding them in place (same delegate type and overload); StyleCop misses some calls and its fix breaks var |
|
| SA1131 | Use readable conditions | on | yes | on / on / on | 0 / 0 / 0 | not fixed | StyleBro BRO1103 (done). Differs from StyleCop: comparisons using a type's own operator are not reported |
| SA1132 | Do not combine fields | on | yes | on / off / on | 0 / 0 / 0 | StyleBro BRO1114 (done), same positions; the fix copies attributes and documentation to every field (StyleCop's keeps attributes on the first only) | |
| SA1133 | Do not combine attributes | on | yes | on / on / on | 0 / 0 / 0 | not fixed | StyleBro BRO1102 (done). Differs from StyleCop: lists with comments between attributes are not reported |
| SA1134 | Attributes should not share line | on | yes | on / off / on | 0 / 9 / 0 | fixed | SDK: IDE0055 formatting |
| SA1135 | Using directives should be qualified | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1126 (done), same positions and output as StyleCop; skips names an enclosing namespace would hide | |
| SA1136 | Enum values should be on separate lines | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1121 (done), same positions; an enum on one line gets BRO1509's expansion | |
| SA1137 | Elements should have the same indentation | on | yes | on / off / off | 0 / 4 / 4 | fixed | SDK: IDE0055 formatting |
| SA1139 | Use literal suffix notation instead of casting | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1122 (done), only when the suffixed literal has exactly the cast's value (StyleCop's fix can change decimals) | |
| SA1141 (1.2 beta) | Use tuple syntax | on | yes | on / on / on | 0 / 0 / 0 | StyleBro BRO1123 (done), every type-only position (StyleCop: declarations only); StyleCop's fix has no Fix All | |
| SA1142 (1.2 beta) | Refer to tuple fields by name | on | yes | on / off / on | 0 / 0 / 0 | StyleBro BRO1124 (done), same positions as StyleCop except nameof; StyleCop's fix throws under dotnet format |
|
| SA1414 (1.2 beta) | Tuple types in signatures should have element names | on | no | on / on / on | 0 / 0 / 0 | Drop: StyleCop has no fix (1.2 only); tuple element names in signatures have to be chosen by a person. (details) | |
| SX1101 | Do not prefix local calls with 'this.' | off | yes | off / on / off | 6,123 / 0 / 6 | SDK: IDE0003 (dotnet_style_qualification_for_* = false); off by default in StyleCop and not enforced by the preset; stylebro-migrate turns IDE0003 on when SX1101 is on |
Spacing¶
| Rule | Title | Default | StyleCop fix | Teams keeping it on (OTel / Polly / App) | Diagnostics (OTel / Polly / App) | SDK check | Proposal |
|---|---|---|---|---|---|---|---|
| SA1000 | Keywords should be spaced correctly | on | yes | on / off / off | 0 / 0 / 3,886 | fixed | SDK: IDE0055 formatting |
| SA1001 | Commas should be spaced correctly | on | yes | on / off / on | 0 / 4 / 0 | fixed | SDK: IDE0055 formatting |
| SA1002 | Semicolons should be spaced correctly | on | yes | on / off / on | 0 / 0 / 0 | fixed | SDK: IDE0055 formatting |
| SA1003 | Symbols should be spaced correctly | on | yes | on / off / off | 0 / 1 / 16 | fixed | SDK: IDE0055 formatting |
| SA1004 | Documentation lines should begin with single space | on | yes | on / on / on | 0 / 0 / 0 | not fixed | StyleBro BRO1005 (done), same positions and output as StyleCop |
| SA1005 | Single line comments should begin with single space | on | yes | on / on / off | 0 / 0 / 78 | not fixed | StyleBro BRO1002 (done), same results as StyleCop 1.2 (1.1.118 also reported // two spaces) |
| SA1006 | Preprocessor keywords should not be preceded by space | on | yes | on / on / on | 0 / 0 / 0 | not fixed | StyleBro BRO1006 (done), same positions and output as StyleCop |
| SA1007 | Operator keyword should be followed by space | on | yes | on / off / on | 0 / 0 / 0 | fixed | SDK: IDE0055 formatting |
| SA1008 | Opening parenthesis should be spaced correctly | on | yes | on / off / off | 0 / 1 / 17 | fixed | SDK: IDE0055 formatting |
| SA1009 | Closing parenthesis should be spaced correctly | on | yes | on / off / off | 0 / 8 / 1,108 | fixed | SDK: IDE0055 formatting |
| SA1010 | Opening square brackets should be spaced correctly | on | yes | on / off / on | 0 / 0 / 0 | fixed | SDK: IDE0055 formatting |
| SA1011 | Closing square brackets should be spaced correctly | on | yes | on / off / on | 0 / 0 / 0 | fixed | SDK: IDE0055 formatting |
| SA1012 | Opening braces should be spaced correctly | on | yes | on / off / off | 0 / 0 / 120 | fixed | SDK: IDE0055 formatting |
| SA1013 | Closing braces should be spaced correctly | on | yes | on / off / off | 0 / 0 / 58 | fixed | SDK: IDE0055 formatting |
| SA1014 | Opening generic brackets should be spaced correctly | on | yes | on / off / on | 0 / 0 / 0 | fixed | SDK: IDE0055 formatting |
| SA1015 | Closing generic brackets should be spaced correctly | on | yes | on / off / on | 0 / 0 / 0 | fixed | SDK: IDE0055 formatting |
| SA1016 | Opening attribute brackets should be spaced correctly | on | yes | on / off / on | 0 / 0 / 0 | fixed | SDK: IDE0055 formatting |
| SA1017 | Closing attribute brackets should be spaced correctly | on | yes | on / off / on | 0 / 0 / 0 | fixed | SDK: IDE0055 formatting |
| SA1018 | Nullable type symbols should be spaced correctly | on | yes | on / off / on | 0 / 0 / 0 | fixed | SDK: IDE0055 formatting |
| SA1019 | Member access symbols should be spaced correctly | on | yes | on / off / on | 0 / 0 / 0 | fixed | SDK: IDE0055 formatting |
| SA1020 | Increment decrement symbols should be spaced correctly | on | yes | on / off / on | 0 / 0 / 0 | fixed | SDK: IDE0055 formatting |
| SA1021 | Negative signs should be spaced correctly | on | yes | on / off / off | 0 / 0 / 0 | fixed | SDK: IDE0055 formatting |
| SA1022 | Positive signs should be spaced correctly | on | yes | on / off / on | 0 / 0 / 0 | fixed | SDK: IDE0055 formatting |
| SA1023 | Dereference and access of symbols should be spaced correctly | on | yes | on / off / on | 0 / 0 / 0 | fixed | SDK: IDE0055 formatting |
| SA1024 | Colons Should Be Spaced Correctly | on | yes | on / off / off | 0 / 0 / 21 | fixed | SDK: IDE0055 formatting |
| SA1025 | Code should not contain multiple whitespace in a row | on | yes | on / off / off | 0 / 4 / 91 | fixed | SDK: IDE0055 formatting |
| SA1026 | Code should not contain space after new or stackalloc keyword in implicitly typed array allocation | on | yes | on / off / on | 0 / 0 / 0 | fixed | SDK: IDE0055 formatting |
| SA1027 | Use tabs correctly | on | yes | on / on / on | 0 / 0 / 0 | fixed | SDK: IDE0055 formatting (indent_style = space) |
| SA1028 | Code should not contain trailing whitespace | on | yes | on / on / off | 0 / 0 / 11 | fixed | SDK: IDE0055 formatting |
Special¶
| Rule | Title | Default | StyleCop fix | Teams keeping it on (OTel / Polly / App) | Diagnostics (OTel / Polly / App) | SDK check | Proposal |
|---|---|---|---|---|---|---|---|
| SA0001 | XML comment analysis disabled | on | no | on / off / off | 0 / 0 / 0 | Not applicable: StyleCop's own setup diagnostic: XML comment analysis is disabled (no GenerateDocumentationFile). (details) | |
| SA0002 | Invalid settings file | on | no | on / on / on | 0 / 0 / 0 | Not applicable: StyleCop's own diagnostic for an invalid stylecop.json. (details) |