Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1This folder contains lint scripts.3Running locally4===============6To run linters locally with the same versions as the CI environment use7the _lint.py_ helper script which runs checks inside the CI container:9```sh10./ci/lint.py11```13Extra arguments are passed to `cargo run -- ...` in the container so you can do:15```sh16./ci/lint.py --help17./ci/lint.py --lint=py_lint18```20test runner21===========23To run all the lint checks in the test runner outside the container you first need24to install the rust toolchain using your package manager of choice or25[rustup](https://www.rust-lang.org/tools/install).27Then you can use:29```sh30( cd ./test/lint/test_runner/ && cargo fmt && cargo clippy && RUST_BACKTRACE=1 cargo run )31```33If you wish to run individual lint checks, run the test_runner with34`--lint=TEST_TO_RUN` arguments. If running with `cargo run`, arguments after35`--` are passed to the binary you are running e.g.:37```sh38( cd ./test/lint/test_runner/ && RUST_BACKTRACE=1 cargo run -- --lint=doc --lint=trailing_whitespace )39```41To see a list of all individual lint checks available in test_runner, use `-h`42or `--help`:44```sh45( cd ./test/lint/test_runner/ && RUST_BACKTRACE=1 cargo run -- --help )46```48#### Dependencies50| Lint test | Dependency |51|-----------|:----------:|52| [`lint-python.py`](/test/lint/lint-python.py) | [lief](https://github.com/lief-project/LIEF)53| [`lint-python.py`](/test/lint/lint-python.py) | [mypy](https://github.com/python/mypy)54| [`lint-python.py`](/test/lint/lint-python.py) | [pyzmq](https://github.com/zeromq/pyzmq)55| [`lint-shell.py`](/test/lint/lint-shell.py) | [ShellCheck](https://github.com/koalaman/shellcheck)56| `py_lint` | [ruff](https://github.com/astral-sh/ruff)57| markdown link check | [mlc](https://github.com/becheran/mlc)59Dependency versions and installation instructions are available in the [CI setup](../../ci/lint/01_install.sh) and the [lint_imagefile](../../ci/lint_imagefile) (for tools where an OCI imagefile exists).61Please be aware that on Linux distributions all dependencies are usually available as packages, but could be outdated.63#### Running the tests65Individual tests can be run by directly calling the test script, e.g.:67```68test/lint/lint-files.py69```71check-doc.py72============73Check for missing documentation of command line options.75commit-script-check.sh76======================77Verification of [scripted diffs](/doc/developer-notes.md#scripted-diffs).78Scripted diffs are only assumed to run on the latest LTS release of Ubuntu. Running them on other operating systems79might require installing GNU tools, such as GNU sed.81git-subtree-check.sh82====================83Run this script from the root of the repository to verify that a subtree matches the contents of84the commit it claims to have been updated to.86```87Usage: test/lint/git-subtree-check.sh [-r] DIR [COMMIT]88test/lint/git-subtree-check.sh -?89```91- `DIR` is the prefix within the repository to check.92- `COMMIT` is the commit to check, if it is not provided, HEAD will be used.93- `-r` checks that subtree commit is present in repository.95To do a full check with `-r`, make sure that you have fetched the upstream repository branch in which the subtree is96maintained:97* for `src/crc32c`: https://github.com/bitcoin-core/crc32c-subtree.git (branch bitcoin-fork)98* for `src/crypto/ctaes`: https://github.com/bitcoin-core/ctaes.git (branch master)99* for `src/ipc/libmultiprocess`: https://github.com/bitcoin-core/libmultiprocess (branch master)100* for `src/leveldb`: https://github.com/bitcoin-core/leveldb-subtree.git (branch bitcoin-fork)101* for `src/minisketch`: https://github.com/bitcoin-core/minisketch.git (branch master)102* for `src/secp256k1`: https://github.com/bitcoin-core/secp256k1.git (branch master)104Keep this list in sync with `fn get_subtrees()` in the lint runner.106To do so, add the upstream repository as remote:108```109git remote add --fetch secp256k1 https://github.com/bitcoin-core/secp256k1.git110```112lint_ignore_dirs.py113===================114Add list of common directories to ignore when running tests
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.