StyleCop rules StyleBro doesn't cover¶
The StyleCop.Analyzers rule IDs StyleBro has no rule for, why, and what would make StyleBro revisit them. Rules StyleBro covers only in part are at the end. Every ID and what covers it: stylecop-mapping.md.
Summary¶
46 rules: 0 candidate, 0 SDK not on yet, 34 drop, 10 nothing to replace, 0 variant, 2 n/a.
| Rule | Title | Status |
|---|---|---|
| SA1118 | Parameter should not span multiple lines | drop |
| SA1317 | Identifier should be named only with Latin letters | drop |
| SA1401 | Fields should be private | drop |
| SA1402 | File may only contain a single type | drop |
| SA1403 | File may only contain a single namespace | drop |
| SA1404 | Code analysis suppression should have justification | drop |
| SA1405 | Debug.Assert should provide message text | drop |
| SA1406 | Debug.Fail should provide message text | drop |
| SA1414 | Tuple types in signatures should have element names | drop |
| SA1601 | Partial elements should be documented | drop |
| SA1602 | Enumeration items should be documented | drop |
| SA1603 | Documentation should contain valid XML | drop |
| SA1604 | Element documentation should have summary | drop |
| SA1605 | Partial element documentation should have summary | drop |
| SA1606 | Element documentation should have summary text | drop |
| SA1607 | Partial element documentation should have summary text | drop |
| SA1608 | Element documentation should not have default summary | drop |
| SA1609 | Property documentation should have value | drop |
| SA1610 | Property documentation should have value text | drop |
| SA1611 | Element parameters should be documented | drop |
| SA1614 | Element parameter documentation should have text | drop |
| SA1615 | Element return value should be documented | drop |
| SA1616 | Element return value documentation should have text | drop |
| SA1618 | Generic type parameters should be documented | drop |
| SA1619 | Generic type parameters should be documented partial class | drop |
| SA1622 | Generic type parameter documentation should have text | drop |
| SA1625 | Element documentation should not contain duplicate entries | drop |
| SA1639 | File header should have summary | drop |
| SA1645 | Included documentation file does not exist | drop |
| SA1646 | Included documentation XPath does not exist | drop |
| SA1647 | Include node does not contain valid file and path | drop |
| SA1648 | inheritdoc should be used with inheriting class | drop |
| SA1649 | File name should match first type name | drop |
| SA1653 | Only one partial declaration should contain summary documentation | drop |
| SA1109 | Block statements should not contain embedded regions | nothing to replace |
| SA1126 | Prefix calls correctly | nothing to replace |
| SA1301 | Element should begin with lower-case letter | nothing to replace |
| SA1409 | Remove unnecessary code | nothing to replace |
| SA1628 | Documentation text should begin with a capital letter | nothing to replace |
| SA1630 | Documentation text should contain whitespace | nothing to replace |
| SA1631 | Documentation should meet character percentage | nothing to replace |
| SA1632 | Documentation text should meet minimum character length | nothing to replace |
| SA1644 | Documentation headers should not contain blank lines | nothing to replace |
| SA1650 | Element documentation should be spelled correctly | nothing to replace |
| SA0001 | XML comment analysis disabled | n/a |
| SA0002 | Invalid settings file | n/a |
Not covered: no safe automatic fix¶
SA1118: Parameter should not span multiple lines¶
Why: A multi-line argument (other than the first, or a lambda/anonymous object) needs extracting into a variable: a refactoring that names things.
To revisit: Only if a deterministic extraction is acceptable (variable name from the parameter name). Probably stays a human job.
SA1317: Identifier should be named only with Latin letters¶
Why: A name with a non-Latin letter (ЕxаmplеClаss, café) needs a new name a person chooses; transliterating is a guess.
To revisit: Nothing automatic.
SA1401: Fields should be private¶
Why: Making a public or protected field private changes the public API and breaks callers.
To revisit: Only for private nested types or internal fields without InternalsVisibleTo, converting to a property. Probably not worth it.
SA1402: File may only contain a single type¶
Why: Moving a type to its own file isn't something dotnet format can do (code fixes can't add documents through it).
To revisit: Would need a separate tool (bro could do it as a one-off).
SA1403: File may only contain a single namespace¶
Why: Splitting namespaces into files has the same problem as SA1402.
To revisit: Same as SA1402.
SA1404: Code analysis suppression should have justification¶
Why: The justification of a SuppressMessage has to be written by a person.
To revisit: Nothing automatic.
SA1405: Debug.Assert should provide message text¶
Why: The message for Debug.Assert has to be written by a person.
To revisit: A generated message (the condition's text, like CallerArgumentExpression) is possible but adds little.
SA1406: Debug.Fail should provide message text¶
Why: The message for Debug.Fail has to be written by a person.
To revisit: Nothing automatic.
SA1414: Tuple types in signatures should have element names¶
Why: Tuple element names in signatures have to be chosen by a person.
To revisit: Nothing automatic.
SA1601: Partial elements should be documented¶
Why: Missing documentation on a partial element; the only fix is placeholder text (no stubs, user decision).
To revisit: Revisit with the stub decision.
SA1602: Enumeration items should be documented¶
Why: Missing documentation on enum members; the only fix is placeholder text (no stubs, user decision).
To revisit: Revisit with the stub decision.
SA1603: Documentation should contain valid XML¶
Why: Invalid XML needs a person to say what was meant.
To revisit: A narrow fix is possible: escape a lone & or < in text. Probe how often that's the cause.
SA1604: Element documentation should have summary¶
Why: A doc comment without <summary>; the fix would be placeholder text.
To revisit: Revisit with the stub decision. If the comment has plain text outside any tag, wrapping it in <summary> is a real fix: worth a probe.
SA1605: Partial element documentation should have summary¶
Why: Same as SA1604 for partial elements.
To revisit: With SA1604.
SA1606: Element documentation should have summary text¶
Why: An empty <summary>; the fix would be placeholder text (no stubs, user decision).
To revisit: Revisit with the stub decision.
SA1607: Partial element documentation should have summary text¶
Why: Same as SA1606 for partial elements.
To revisit: With SA1606.
SA1608: Element documentation should not have default summary¶
Why: The default "Summary description for X" text has to be replaced by a person.
To revisit: Nothing automatic.
SA1609: Property documentation should have value¶
Why: Missing <value>; the fix would be placeholder text (no stubs, user decision).
To revisit: Revisit with the stub decision. A <value> derived from the summary ("Gets the name." -> "The name.") is conceivable.
SA1610: Property documentation should have value text¶
Why: An empty <value>; the fix would be placeholder text.
To revisit: Removing the empty tag would be a real fix, but trades one diagnostic for SA1609. Decide with SA1609.
SA1611: Element parameters should be documented¶
Why: Missing <param>; the fix would be placeholder text (no stubs, user decision).
To revisit: Revisit with the stub decision.
SA1614: Element parameter documentation should have text¶
Why: An empty <param>; the fix would be placeholder text.
To revisit: Revisit with the stub decision.
SA1615: Element return value should be documented¶
Why: Missing <returns>; the fix would be placeholder text.
To revisit: Revisit with the stub decision.
SA1616: Element return value documentation should have text¶
Why: An empty <returns>; the fix would be placeholder text.
To revisit: Revisit with the stub decision.
SA1618: Generic type parameters should be documented¶
Why: Missing <typeparam>; the fix would be placeholder text.
To revisit: Revisit with the stub decision.
SA1619: Generic type parameters should be documented partial class¶
Why: Same as SA1618 for partial types.
To revisit: With SA1618.
SA1622: Generic type parameter documentation should have text¶
Why: An empty <typeparam>; the fix would be placeholder text.
To revisit: Revisit with the stub decision.
SA1625: Element documentation should not contain duplicate entries¶
Why: Identical text copied between tags has to be rewritten by a person.
To revisit: Nothing automatic.
SA1639: File header should have summary¶
Why: The header's <summary> has to be written by a person.
To revisit: Nothing automatic.
SA1645: Included documentation file does not exist¶
Why: A missing <include> file can't be fixed automatically.
To revisit: Nothing automatic.
SA1646: Included documentation XPath does not exist¶
Why: A wrong <include> XPath can't be fixed automatically.
To revisit: Nothing automatic.
SA1647: Include node does not contain valid file and path¶
Why: An <include> without file/path can't be fixed automatically.
To revisit: Nothing automatic.
SA1648: inheritdoc should be used with inheriting class¶
Why: <inheritdoc/> where there is nothing to inherit: the fix is real documentation.
To revisit: Nothing automatic. (BRO1601 only adds <inheritdoc/> where there is something to inherit.)
SA1649: File name should match first type name¶
Why: Renaming files isn't something dotnet format can do.
To revisit: Would need a separate tool (bro could do it as a one-off, with git mv).
SA1653: Only one partial declaration should contain summary documentation¶
Why: Which part of a partial type keeps the <summary> is a person's choice; a fix that picks the declaration it is applied to gives a result that depends on which diagnostic comes first.
To revisit: Only with a deterministic choice (for example the declaration in the file named after the type).
Nothing to replace¶
SA1109: Block statements should not contain embedded regions¶
Why: The rule id reports nothing, even on a region between if (b) and its block (probed).
To revisit: Nothing to port. Regions are BRO1112/BRO1113.
SA1126: Prefix calls correctly¶
Why: The rule id reports nothing, even on an unprefixed member call (probed).
To revisit: Nothing to port.
SA1301: Element should begin with lower-case letter¶
Why: The rule id reports nothing (probed); it is kept only for compatibility.
To revisit: Nothing to port.
SA1409: Remove unnecessary code¶
Why: The rule id reports nothing, even on an empty try { } finally { } (probed).
To revisit: Nothing to port.
SA1628: Documentation text should begin with a capital letter¶
Why: The rule id reports nothing (probed while building BRO16xx).
To revisit: Nothing to port. A capitalization fix would be easy if a team wants it.
SA1630: Documentation text should contain whitespace¶
Why: The rule id reports nothing, even on a one-word summary (probed).
To revisit: Nothing to port.
SA1631: Documentation should meet character percentage¶
Why: The rule id reports nothing, even on a summary of symbols (probed).
To revisit: Nothing to port.
SA1632: Documentation text should meet minimum character length¶
Why: The rule id reports nothing, even on a one-letter summary (probed).
To revisit: Nothing to port.
SA1644: Documentation headers should not contain blank lines¶
Why: The rule id reports nothing (probed while building BRO16xx).
To revisit: Nothing to port.
SA1650: Element documentation should be spelled correctly¶
Why: The rule id reports nothing, even on misspelled words (probed).
To revisit: Nothing to port.
Not applicable¶
SA0001: XML comment analysis disabled¶
Why: A setup diagnostic, not a code rule: XML comment analysis is disabled (no GenerateDocumentationFile).
To revisit: Nothing to port. bro migrate already detects the same condition and keeps the XML documentation rules (BRO1603-BRO1611) off.
SA0002: Invalid settings file¶
Why: A setup diagnostic, not a code rule: stylecop.json is invalid.
To revisit: Nothing to port. bro migrate parses stylecop.json leniently (comments, trailing commas).
Partly covered¶
SA1206: Declaration keywords should follow order¶
Covered by: SDK: IDE0036 (csharp_preferred_modifier_order), which checks the whole modifier order
Scope: IDE0036 (csharp_preferred_modifier_order) enforces the whole modifier order, not only the access modifier first and static next, so it can also reorder modifiers such as async override.
To revisit: Only if a team reports reorders it wants to keep (async override vs override async); then a BRO rule that only moves access modifiers and static.
SA1600: Elements should be documented¶
Covered by: BRO1601, for overrides and implementations (<inheritdoc/>); other missing documentation isn't covered
Scope: BRO1601 adds <inheritdoc/> to overrides and implementations; other missing documentation isn't reported (no stubs, user decision).
To revisit: Revisit with the stub decision (also SA1601, SA1602, SA1604-SA1607, SA1609-SA1611, SA1614-SA1616, SA1618, SA1619, SA1622).