StyleCopAid

StyleCopAid is a Visual Studio extension that helps to automatically fix code formatting warnings identified by the StyleCop tool.

Benefits

  • - Automatically fix over 40 different StyleCop violations, including some the most labor-intensive ordering and documentation ones
  • - Automatically suppress rules that otherwise require code refactoring
  • - As a safety feature, undo the last change when making fixes


Donate to support tool development

While free for general use, donations of any size are welcomed and greatly appreciated.



Installation

The tool is hosted by the Microsoft Visual Studio Gallery. Use Visual Studio Extension Manager’s search to locate and install the StyleCopAid.

Usage Guide

Analyze your code using the StyleCop tool. Select a rule violation that you want to fix or suppress and use the right-click contextual menu to pick appropriate action. Verify that the change is acceptable. Use the Undo feature as needed.

Fixing/suppressing of multiple warnings is supported but we recommend you do them in smaller chunks before you familiarize yourself with the tool.

Supported Visual Studio versions

The tool supports Visual Studio 2010, 2012, and 2013 versions.

Supported Rules

Fix automatically

Spacing Rules

SA1001: CommasMustBeSpacedCorrectly
SA1003: SymbolsMustBeSpacedCorrectly
SA1005: SingleLineCommentsMustBeginWithSingeSpace
SA1012: OpeningCurlyBracketsMustBeSpacedCorrectly
SA1013: ClosingCurlyBracketsMustBeSpacedCorrectly
SA1014: OpeningGenericBracketsMustBeSpacedCorrectly
SA1025: CodeMustNotContainMultipleWhitespaceInARow
SA1027: TabsMustNotBeUsed

Readability Rules

SA1101: PrefixLocalCallsWithThis
SA1102: QueryClauseMustFollowPreviousClause
SA1111: ClosingParenthesisMustBeOnLineOfOpeningParenthesis
SA1115: ParameterMustFollowComma
SA1116: SplitParametersMustStartOnLineAfterDeclaration
SA1118: ParameterMustNotSpanMultipleLines
SA1120: CommentsMustContainText
SA1122: UseStringEmptyForEmptyStrings

Ordering Rules

SA1200: UsingDirectivesMustBePlacedWithinNamespace
SA1201: ElementsMustAppearInTheCorrectOrder
SA1202: ElementsMustBeOrderedByAccess
SA1204: StaticElementsMustAppearBeforeInstanceElements
SA1206: ElementsMustBeOrderedByAccess
SA1208: SystemUsingDirectivesMustBePlacedBeforeOtherUsingDirectives
SA1210: UsingDirectivesMustBeOrderedAlphabeticallyByNamespace
SA1215: InstanceReadonlyElementsMustAppearBeforeInstanceNonReadonlyElements

Maintainability Rules

SA1407: ArithmeticExpressionsMustDeclarePrecedence

Layout Rules

SA1500: CurlyBracketsForMultiLineStatementsMustNotShareLine
SA1501: StatementMustNotBeOnSingleLine
SA1502: ElementMustNotBeOnSingleLine
SA1503: CurlyBracketsMustNotBeOmitted
SA1505: OpeningCurlyBracketsMustNotBeFollowedByBlankLine
SA1507: CodeMustNotContainMultipleBlankLinesInARow
SA1508: ClosingCurlyBracketsMustNotBePrecededByBlankLine
SA1512: SingleLineCommentsMustNotBeFollowedByBlankLine
SA1513: ClosingCurlyBracketMustBeFollowedByBlankLine
SA1514: ElementDocumentationHeaderMustBePrecededByBlankLine
SA1515: SingleLineCommentMustBePrecededByBlankLine
SA1516: ElementsMustBeSeparatedByBlankLine
SA1517: CodeMustNotContainBlankLinesAtStartOfFile
SA1518: CodeMustNotContainBlankLinesAtEndOfFile

Documentation Rules

SA1600: ElementsMustBeDocumented
SA1615: ElementReturnValueMustBeDocumented
SA1622: GenericTypeParameterDocumentationMustHaveText
SA1626: SingleLineCommentsMustNotUseDocumentationStyleSlashes
SA1627: DocumentationTextMustNotBeEmpty
SA1633: FileMustHaveHeader

Suppress automatically

Naming Rules

SA1300: ElementMustBeginWithUpperCaseLetter
SA1304: NonPrivateReadonlyFieldsMustBeginWithUpperCaseLetter
SA1306: FieldNamesMustBeginWithLowerCaseLetter
SA1307: AccessibleFieldsMustBeginWithUpperCaseLetter
SA1309: FieldNamesMustNotBeginWithUnderscore
SA1310: FieldNamesMustNotContainUnderscore
SA1311: StaticReadonlyFieldsMustBeginWithUpperCaseLetter

Maintainability Rules

SA1400: AccessModifierMustBeDeclared
SA1401: FieldsMustBePrivate
SA1407: ArithmeticExpressionsMustDeclarePrecedence
SA1409: RemoveUnnecessaryCode

Layout Rules

SA1500: CurlyBracketsForMultiLineStatementsMustNotShareLine

Documentation Rules

SA1644: DocumentationHeadersMustNotContainBlankLines
SA1650: ElementDocumentationMustBeSpelledCorrectly

Contact Us

Please direct all you questions and comments to support@mroodles.com

Version History

v2.11.12: releasing the app for free
v2.11.11: implemented SA1407: ArithmeticExpressionsMustDeclarePrecedence
v2.10.11: suppression for SA1407: ArithmeticExpressionsMustDeclarePrecedence
v2.9.11: implemented: SA1615: ElementReturnValueMustBeDocumented, suppressions: SA1400, SA1650
v2.8.11: implemented – SA1600: ElementsMustBeDocumented
v2.7.11: implemented SA1206: ElementsMustBeOrderedByAccess
v2.6.11: fix for SA1115
v2.6.10: implemented SA1120: CommentsMustContainText
v2.5.10: implemented SA1025: CodeMustNotContainMultipleWhitespaceInARow
v2.4.10: fix for closed document changes; fix for SA1101
v2.4.9: implemented SA1101: PrefixLocalCallsWithThis
v2.3.9: implemented SA1633: FileMustHaveHeader; added templates
v2.2.9: rules SA1517: CodeMustNotContainBlankLinesAtStartOfFile, SA1518: CodeMustNotContainBlankLinesAtEndOfFile implemented
v2.1.9: only one ordering rule can be executed; execution ceases when one such rule is executed
v2.1.8: delete Undo temp folder on initialization
v2.1.7: rule SA1122: UseStringEmptyForEmptyStrings implementation
v2.1.6: fix for the 1027 rule (no tabs)
v2.1.5: rules SA1501 and SA1502 implemented
v2.1.4: fix for Undo with read-only files
v2.1.3: RELEASED (June 11, 2015)