-
Notifications
You must be signed in to change notification settings - Fork 10
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
Implement clang-tidy #64
Conversation
- This enables most things - Originally generated from -dump-config - I figure downstream consumers will need to walk some things back by disabling, but that it is nevertheless ideal to start out with most checks enabled
@@ -0,0 +1,28 @@ | |||
--- | |||
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.
Using *
here is very aggressive. But it does not reveal any more than a few problems inside node-cpp-skel and they are easily fixed. So I think starting with this is ideal. Downstream users of node-cpp-skel will be able to change this to disable some checks (based on https://clang.llvm.org/extra/clang-tidy/) but opt-ing into all of them seems wisest to me to help keep code robust from the start.
@@ -0,0 +1,28 @@ | |||
--- | |||
Checks: '*' | |||
WarningsAsErrors: '*' |
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.
Added this. However I can't seem to get run-clang-tidy.py
to return a non-zero error code. So this basically has no impact on the return code, just an minor impact on the stdout from clang-tidy.
# First run the clang-tidy target | ||
# This target does not currently return non-zero when problems | ||
# are fixed, but rather it fixes automatically. Changed files | ||
# will be detected by the format target and will trigger an error |
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.
Working around the lack of non-zero error code on error mentioned at https://github.com/mapbox/node-cpp-skel/pull/64/files#r133848127 here by running make tidy
first and depending on make format
to throw if it sees any changes. It would be ideal to error immediately in make tidy
but I can't figure out how to get that working...
🎉 travis properly caught the |
a. hello_async.cpp:225:5 use auto when initializing with a template cast to avoid duplicating the type name [modernize-use-auto] b. hello_async.cpp:321:2: error: namespace 'object_async' not terminated with a closing comment [google-readability-namespace-comments]
…rs [-Werror=effc++]'" This reverts commit e700180.
…hout copy override
Clang tidy fixes
Fixed landed. Will merge this once travis is green. |
This addresses #63 (see that ticket for context).
This PR builds in:
clang-tidy
checks. Ifclang-tidy
detects errors travis will fail-fix
command is passed so some fixes are automatically doneOther notes:
compile_commands.json
setup.sh
script - refs Upgrade to latest llvm + mason #58/cc @GretaCB for review
/cc @mapbox/directions @mapbox/gl-core - thank you for the examples of clang-tidy usage in OSRM and MBGL - I learned from them in order to apply here ✊