lint: upgrade lint scripts for worktrees

Add a ci/lint.py script to run the linter both locally or inside the CI
(replacing .github/ci-lint-exec.py) which supports running from a
worktree.

Determines whether we are in a worktree, and mounts the real `.git`
directory as a read-only volume if we are.
This commit is contained in:
will
2026-01-23 12:09:22 +00:00
parent 1b079becf1
commit c17a2adb8d
4 changed files with 88 additions and 63 deletions

View File

@@ -3,20 +3,17 @@ This folder contains lint scripts.
Running locally
===============
To run linters locally with the same versions as the CI environment, use the included
Dockerfile:
To run linters locally with the same versions as the CI environment use
the _lint.py_ helper script which runs checks inside the CI container:
```sh
DOCKER_BUILDKIT=1 docker build --platform=linux --tag=bitcoin-linter --file="./ci/lint_imagefile" ./ && docker run --rm -v $(pwd):/bitcoin -it bitcoin-linter
./ci/lint.py
```
Building the container can be done every time, because it is fast when the
result is cached and it prevents issues when the image changes.
test runner
===========
To run all the lint checks in the test runner outside the docker you first need
To run all the lint checks in the test runner outside the container you first need
to install the rust toolchain using your package manager of choice or
[rustup](https://www.rust-lang.org/tools/install).