In May 2020, clang-tidy
was added as a CI step to the Flutter Engine. Previously the only lint checks that were happening in the engine were formatting, there were no semantic checks. Now there are, but that means there is work to be done migrating all the code to conform to all the lint checks.
If a file has // FLUTTER_NOLINT
at the top, it has issues with the lint that haven't been addressed and the linter will ignore it. As the issues are fixed the comments should be removed.
You can run the linter locally by running flutter/ci/lint.sh
.
You can ask on the hackers-engine
discord channel. Ping @gaaclarke or @zanderso if you don't get the response you want.
The checks that are enabled are negotiable. If you think we are missing something, please discuss it on hacker-engine
.
NOLINT
to turn off the error?You can, but please get explicit approval to do from someone on the team.
Here are things that can make it easier to land large new lints.
Instead of running clang-tidy fix locally on your machines 4 times you can get the CI bots to print out the fix. Here's steps on how to do that:
//ci/clang_tidy.sh
:# To run on CI, just uncomment the following line: -# FLUTTER_LINT_PRINT_FIX=1 +FLUTTER_LINT_PRINT_FIX=1
This will run on all files, and print out the patch generated by clang-tidy fix
in the CI bots.
git apply
, paste the patch, press ctrl+d then enter. Watch out that there can be overlapping patches between the mac runs and the linux runs since we don't shard across platforms.