int main()
{
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
{}
(void)42;
}
Analyzing with clang-tidy 1.cpp -checks=readability-misleading-indentation -- results in a false positive:
1 warning generated.
/path/to/1.cpp:6:5: warning: misleading indentation: statement is indented too deeply [readability-misleading-indentation]
6 | (void)42;
| ^
/path/to/1.cpp:3:5: note: did you mean this line to be inside this 'for'
3 | for (int i = 0; i < 3; i++)
| ^
Using this indentation style for 2D loops is not unheard of, and it's a shame that clang-tidy warns about those. (The warning is otherwise useful, so I don't want to disable it everywhere.)
I suggest that this warning should be skipped for control statements with non-indented bodies.
```cpp
int main()
{
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
{}
(void)42;
}
```
Analyzing with `clang-tidy 1.cpp -checks=readability-misleading-indentation --` results in a false positive:
```
1 warning generated.
/path/to/1.cpp:6:5: warning: misleading indentation: statement is indented too deeply [readability-misleading-indentation]
6 | (void)42;
| ^
/path/to/1.cpp:3:5: note: did you mean this line to be inside this 'for'
3 | for (int i = 0; i < 3; i++)
| ^
```
Using this indentation style for 2D loops is not unheard of, and it's a shame that clang-tidy warns about those. (The warning is otherwise useful, so I don't want to disable it everywhere.)
I suggest that this warning should be skipped for control statements with non-indented bodies.
Analyzing with
clang-tidy 1.cpp -checks=readability-misleading-indentation --
results in a false positive:Using this indentation style for 2D loops is not unheard of, and it's a shame that clang-tidy warns about those. (The warning is otherwise useful, so I don't want to disable it everywhere.)
I suggest that this warning should be skipped for control statements with non-indented bodies.