When PRs are submitted against the primary Bitcoin Core repo a series of CI tests will automatically be run. These include a series of linters and formatters such as
shellcheck. It’s possible (and advised) to run these checks locally against any changes you make before you push them.
In order to run the lints yourself you’ll have to first make sure your python environment and system have the packages listed in the CI install script. You can then run a decent sub-set of the checks by running:
# requires requires 'flake8', 'mypy', 'pyzmq', 'codespell', 'vulture'
Or you can run all checks with:
cd ./test/lint/test_runner/ && cargo fmt && cargo clippy && cargo run
| Previously these checks were shell scripts (
*.sh), but they have now been migrated to python on master.
+ If you are following with tag v23.0 these may still exist as
Linting your changes reduces the chances of pushing them as a PR and then having them quickly being marked as failing CI. The GitHub PR page auto-updates the CI status.
|If you do fail a lint or any other CI check, force-pushing the fix to your branch will cancel the currently-running CI checks and restart them.
Some compile-time issues can be caused by an unclean build directory. The comments in issue 19330 provide some clarifications and tips on how other Contributors clean their directories, as well as some ideas for shell aliases to boost productivity.