You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and run clang-tidy.exe --config="{Checks: 'readability-braces-around-statements', FormatStyle: file}" --export-fixes=<path>/out.yaml <path>/test.cpp --
which doesn't have the formatting applied -- in particular, the } has no indentation.
The bug doesn't repro when --export-fixes isn't used: clang-tidy.exe --config="{Checks: 'readability-braces-around-statements', FormatStyle: file}" --fix <path>/test.cpp -- gives the expected result:
int main()
{
if (true)
{
return 0;
}
}
It also repros with clang-tidy.exe --config="{Checks: 'modernize-concat-nested-namespaces', FormatStyle: file}" --export-fixes=<path>/out.yaml <path>/test.cpp -- -std=c++17.
with test.cpp
namespacefoo1
{
namespacefoo2
{
int i;
}
}
so it seems like it may repro with all checks.
I'm guessing we could work around the issue via running clang-format on the edited lines afterwards.
The text was updated successfully, but these errors were encountered:
sean-mcmanus
changed the title
clang-tidy with --export-fixes doesn't apply formatting with readability-braces-around-statements (but it works with --fix)
clang-tidy with --export-fixes doesn't apply formatting (but it works with --fix)
May 18, 2022
The --export-fixes option isn't meant to format any changes.
The idea is the formatting is done after all the fixes have been applied, using clang-apply-replacements.
I'm using clang-tidy 14.0.3 (on Windows 11, I could try Linux/Mac if you want, but I assume it doesn't matter).
Use test.cpp
with some .clang-format file in the folder like
and run
clang-tidy.exe --config="{Checks: 'readability-braces-around-statements', FormatStyle: file}" --export-fixes=<path>/out.yaml <path>/test.cpp --
Bug: The out.yaml is
which doesn't have the formatting applied -- in particular, the
}
has no indentation.The bug doesn't repro when --export-fixes isn't used:
clang-tidy.exe --config="{Checks: 'readability-braces-around-statements', FormatStyle: file}" --fix <path>/test.cpp --
gives the expected result:It also repros with
clang-tidy.exe --config="{Checks: 'modernize-concat-nested-namespaces', FormatStyle: file}" --export-fixes=<path>/out.yaml <path>/test.cpp -- -std=c++17
.with test.cpp
so it seems like it may repro with all checks.
I'm guessing we could work around the issue via running clang-format on the edited lines afterwards.
The text was updated successfully, but these errors were encountered: