Our website uses cookies to enhance your browsing experience.
Accept
to the top

Webinar: Let's make a programming language. Lexer - 29.04

>
>
>
V7020. Suspicious code formatting....
menu mobile close menu
Additional information
toggle menu Contents

V7020. Suspicious code formatting. Curly brackets may be missing.

Apr 03 2026

The analyzer has detected a potential error: the formatting of the code following the control statement does not align with the program's execution logic. Braces may be missing.

The example:

if (a == 1)
  b = c;
  d = b;    // <=

In this example, the d = b; statement is executed regardless of the condition, because if there is no block following the control statement, its body consists only of the first expression. However, the formatting indicates that the d = b; statement was expected to execute only if the a == 1 condition was true.

The Google JavaScript Style Guide recommends using braces for all control statements, even those with a single operation in their body. This prevents confusion caused by misleading code.

The fixed code options:

// Option N1
if (a == 1) {
  b = c;
}
d = b; 

// Option N2
if (a == 1) {
  b = c;
  d = b;
}

Misleading code may also look like this:

if (a == 1) b = c; d = b;

In this case, the d = b; statement is also executed regardless of the condition.

Possible ways to fix the issue:

if (a == 1) { b = c; d = b; }

if (a == 1) { b = c; }
d = b;

if (a == 1) b = c;
d = b;

Note. The analyzer treats if, for, and while as control statements.