Why is this an issue?
For better readability, do not put more than one statement on a single line.
Noncompliant code example
foo(); bar(); // Noncompliant
Compliant solution
foo();
bar();
Exceptions
Control flow statements with a single nested statement are ignored.
if (condition) doSomething(); // Compliant
while (condition) doSomething(); // Compliant
case
or default
statements containing a single statement and followed by break
are ignored.
switch (foo) {
case 0: doSomething(); break; // Compliant
default: doSomething(); break; // Compliant
}
Statements enclosed in curly braces on the same line are ignored.
auto lambda = [](int x) { doSomething(x); return x; }; // Compliant