1 .. title:: clang-tidy - readability-misleading-indentation
3 readability-misleading-indentation
4 ==================================
6 Correct indentation helps to understand code. Mismatch of the syntactical
7 structure and the indentation of the code may hide serious problems.
8 Missing braces can also make it significantly harder to read the code,
9 therefore it is important to use braces.
11 The way to avoid dangling else is to always check that an ``else`` belongs
12 to the ``if`` that begins in the same column.
14 You can omit braces when your inner part of e.g. an ``if`` statement has only
15 one statement in it. Although in that case you should begin the next statement
16 in the same column with the ``if``.
27 foo2(); // Wrong indentation: else belongs to if(cond2) statement.
32 foo2(); // Not guarded by if(cond1).
37 Note that this check only works as expected when the tabs or spaces are used
38 consistently and not mixed.