New rule proposal: Curly braces must not be omitted when parent expression spans multiple lines
See original GitHub issueCategory: Layout Rule: Curly braces must not be omitted when parent expression spans multiple lines. Rationale: Improve readability and maintainability of the code (when SA1503 is off). See also: SA1503:CurlyBracketsMustNotBeOmitted and SA1519:CurlyBracketsMustNotBeOmittedFromMultiLineChildStatement
Bad:
if (alpha == beta &&
beta == gamma)
alpha = delta;
Good:
if (alpha == beta &&
beta == gamma)
{
alpha = delta;
}
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:6 (5 by maintainers)
Top Results From Across the Web
curly - ESLint - Pluggable JavaScript Linter
However, it is considered by many to be best practice to never omit curly braces around blocks, even when they are optional, because...
Read more >c# - StyleCop Rule for Multiline Curly Brackets
I've wanted the same styles, and had to turn off the rules StatementMustNotBeOnSingleLine and CurlyBracketsMustNotBeOmitted to support it.
Read more >Multiline blocks should be enclosed in curly braces
Having inconsistent indentation and omitting curly braces from a control structure, such as an if statement or for loop, is misleading and can...
Read more >React, Part I: JSX Cheatsheet
A JSX expression that spans multiple lines must be wrapped in parentheses: ( and ) . In the example code, we see the...
Read more >jsguide.html - platform/external/google-styleguide
the code. Optional formatting choices made in examples must not be enforced as. rules.</p>. <h2 id="source-file-basics">2 Source file basics</h2>.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jnm2 Yes that’s correct
SA1519BracesMustNotBeOmittedWhenParentOrChildPartsAreMultiLine
, with more explanation in the description?