| 1 |
.. title:: clang-tidy - readability-braces-around-statements |
| 2 |
|
| 3 |
readability-braces-around-statements |
| 4 |
==================================== |
| 5 |
|
| 6 |
`google-readability-braces-around-statements` redirects here as an alias for |
| 7 |
this check. |
| 8 |
|
| 9 |
Checks that bodies of ``if`` statements and loops (``for``, ``do while``, and |
| 10 |
``while``) are inside braces. |
| 11 |
|
| 12 |
Before: |
| 13 |
|
| 14 |
.. code-block:: c++ |
| 15 |
|
| 16 |
if (condition) |
| 17 |
statement; |
| 18 |
|
| 19 |
After: |
| 20 |
|
| 21 |
.. code-block:: c++ |
| 22 |
|
| 23 |
if (condition) { |
| 24 |
statement; |
| 25 |
} |
| 26 |
|
| 27 |
Options |
| 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). |