xref: /llvm-project/clang-tools-extra/docs/clang-tidy/checks/readability/braces-around-statements.rst (revision 6e566bc5523f743bc34a7e26f050f1f2b4d699a8)
1.. title:: clang-tidy - readability-braces-around-statements
2
3readability-braces-around-statements
4====================================
5
6`google-readability-braces-around-statements` redirects here as an alias for
7this check.
8
9Checks that bodies of ``if`` statements and loops (``for``, ``do while``, and
10``while``) are inside braces.
11
12Before:
13
14.. code-block:: c++
15
16  if (condition)
17    statement;
18
19After:
20
21.. code-block:: c++
22
23  if (condition) {
24    statement;
25  }
26
27Options
28-------
29
30.. option:: ShortStatementLines
31
32   Defines the minimal number of lines that the statement should have in order
33   to trigger this check.
34
35   The number of lines is counted from the end of condition or initial keyword
36   (``do``/``else``) until the last line of the inner statement. Default value
37   `0` means that braces will be added to all statements (not having them
38   already).
39