28 lines
817 B
Plaintext
28 lines
817 B
Plaintext
![]() |
=== On 2018-03-06T17:22:14Z Tibor Blenessy Wrote:
|
||
|
Go requires curly braces for conditional statements.
|
||
|
|
||
|
=== On 2018-06-08T17:52:10Z Duncan Pocklington Wrote:
|
||
|
This rule seems to overlap almost completely with https://jira.sonarsource.com/browse/RSPEC-2681[S2681]
|
||
|
|
||
|
|
||
|
Given the non-compliant example:
|
||
|
|
||
|
|
||
|
----
|
||
|
if (condition) // Noncompliant
|
||
|
doTheThing();
|
||
|
doTheOtherThing(); // <- S2681 "This line will not be executed conditionally; only the first line of this 3-line block will be ..."
|
||
|
somethingElseEntirely();
|
||
|
|
||
|
foo();
|
||
|
----
|
||
|
|
||
|
Fixing the indentation or using blocks stops S2681 from raising. Do we need both rules?
|
||
|
|
||
|
|
||
|
\[UPDATE] The wording of this rule and S2681 and examples have been updated.
|
||
|
|
||
|
=== On 2019-02-01T10:31:32Z Amaury Levé Wrote:
|
||
|
Adding VB.NET and VB6 as irrelevant because by design you always have a block.
|
||
|
|