question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New rule proposal: Curly braces must not be omitted when parent expression spans multiple lines

See original GitHub issue

Category: 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:open
  • Created 8 years ago
  • Reactions:1
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sharwellcommented, Feb 13, 2019

@jnm2 Yes that’s correct

0reactions
jnm2commented, Feb 14, 2019

SA1519BracesMustNotBeOmittedWhenParentOrChildPartsAreMultiLine, with more explanation in the description?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found