-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 clangtidy fixer #2548
Add clangtidy fixer #2548
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just merged #2566, so the new options from there should be used. I think we should check the buffer's filetype and use the options for C++ when the buffer has the cpp
filetype, and use the options for C otherwise. Update the code to cover all of that, and fix the conflicts.
autoload/ale/fixers/clangtidy.vim
Outdated
endfunction | ||
|
||
function! ale#fixers#clangtidy#Fix(buffer) abort | ||
let l:executable = ale#fixers#clangtidy#GetExecutable(a:buffer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get the executable by just reading the option instead. clang-tidy
isn't a Node.js script.
How do I adapt the |
You can create the keys to set like |
Also, use cpp variables in cpp filetypes
autoload/ale/fixers/clangtidy.vim
Outdated
call s:set_variables() | ||
|
||
function! ale#fixers#clangtidy#Var(buffer, name) abort | ||
let l:ft = getbufvar(a:buffer, '&filetype') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The filetype could be a compound of 'c'
and something else. I recommend instead using 'cpp'
if the filetype contains 'cpp'
, and 'c'
otherwise.
Cheers! 🍻 |
* Add clangtidy fixer * Add extra_options to clangtidy fixer * Also, use cpp variables in cpp filetypes
This pull request adds a
clangtidy
fixer usingclang-tidy -fix
.I based the tests on the
clang-format
tests.Edit: force-pushed to try and fix the tests.
For some reason, the second test keeps failing with