Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bracing Rules #46

Open
amanda-mitchell opened this issue Feb 8, 2019 · 1 comment
Open

Bracing Rules #46

amanda-mitchell opened this issue Feb 8, 2019 · 1 comment
Labels
new analyzer Suggestion for a new analyzer to add

Comments

@amanda-mitchell
Copy link
Contributor

StyleCop does not appear to support our preferred rules, and a quick search did not turn up any analyzers that do.

Our main rule is

Omit optional braces around single line blocks.

However, it has some exceptions and nuances:

  • The emphasis is on single line, rather than single statement. If a statement is split onto multiple lines, it should be surrounded by braces.
  • If the control flow mechanism (if condition, using declaration, etc.) is split onto multiple lines, include braces.
  • If the statement is part of an if-else chain in which any of the blocks require braces, use braces on all of them. (this part is covered by SA1520)
@amanda-mitchell amanda-mitchell added the new analyzer Suggestion for a new analyzer to add label Feb 8, 2019
@amanda-mitchell
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new analyzer Suggestion for a new analyzer to add
Development

No branches or pull requests

1 participant