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
Added clang-tidy for C, too. #827
Conversation
A limited number of clang-tidy checks can be used with C, too. I pretty much copied and refactored the C++ clang-tidy linter, and added some documentation about C-compatible checks.
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.
See my comments here, and cover the new functions with Vader tests.
ale_linters/c/clangtidy.vim
Outdated
" C++ | ||
" | ||
" Here is an incomplete list of C-compatible checks for clang-tidy version 6: | ||
" bugprone-suspicious-memset-usage |
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.
This is an awfully large comment, here and below. Could you replace this with a link to the clang-tidy documentation?
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.
Sure. I put the list here because the documentation only lists all of the checks, without any indication if they work for C, or just C++. I actually went through all of them by hand and picked out those that work for C.
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.
Fixed.
70cd1d5
doc/ale-c.txt
Outdated
readability-simplify-boolean-expr | ||
|
||
|
||
g:ale_c_clangtidy_executable *g:ale_c_clangtidy_executable* |
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.
GitHub makes it look like the helptag isn't aligned to the right margin. Make sure they all are. There's an ALEFix
function for aligning help tags to the right margin you can use.
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.
Okay. Should I flatten the commits into one after I fix everything?
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.
Nah, I actually prefer having many commits for pull requests, so I can see the difference before and after reviews. Then I just squash the pull request into one commit after that via GitHub's button for --ff --squash
.
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.
Fixed.
e4a6da9
Cool, now you can add some Vader tests. |
I added a Vader test for this by copying the C++ one, and I linked the C++ documentation for the build directory options to the C file. |
A limited number of clang-tidy checks can be used with C, too. I pretty much
copied and refactored the C++ clang-tidy linter, and added some documentation
about C-compatible checks.