-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add auto-formatting support for clang-tidy fixes #9322
Comments
I'm seeing |
I've filed bug llvm/llvm-project#55569 ...it seems like we could work around that via doing a separate format range though. |
They said it's by design for --export-fixes to not format. |
This should be optional. Maybe even popup a dialog to ask for reformatting, so that the user can review the clang-tidy changes before applying the formatting. In any case I tried today the auto-fix feature and I guess Clang-Tidy generates invalid code by adding |
@H-G-Hristov Yeah, a setting to disable it sounds good. Do you have repro steps for the invalid `"%s" code? It may be a bug with our processing. |
@sean-mcmanus Sorry for the delay. I have filed some details here: llvm/llvm-project#56669 |
Some clang-tidy fix types such as for readability-braces-around-statements generates fixes that need to be formatted in order to give acceptable results (otherwise, } will have no indentation). Potentially, we just run the currently configured formatting on the lines that are changed.
One workaround is to add
--format-style=
to C_Cpp.codeAnalysis.clangTidy.args if clang-format style formatting is desired. Or add FormatStyle to a .clang-tidy file. UPDATE: The workaround doesn't work.UPDATE: I noticed with readability-else-after-return it is desirable to format the entire range, but the fix only applies it to the start/end lines...not sure if there's a way to improve that.
The text was updated successfully, but these errors were encountered: