Skip to content

Commit 2ac6315

Browse files
committed
Merge #13281: test: Move linters to test/lint, add readme
fa3c910 test: Move linters to test/lint, add readme (MarcoFalke) Pull request description: This moves the checks and linters from `devtools` to a subfolder in `test`. (Motivated by my opinion that the dev tools are mostly for generating code and updating the repo whereas the linters are read-only checks.) Also, adds a readme to clarify that checks and linters are only meant to prevent bugs and user facing issues, not merely stylistic preference or inconsistencies. (This is motivated by the diversity in developers and work flows as well as existing code styles. It would be too disruptive to change all existing code to a single style or too burdensome to force all developers to adhere to a single style. Also note that our style guide is changing, so locking in at the wrong style "too early" would only waste resources.) Tree-SHA512: 9b10e89f2aeaf0c8a9ae248aa891d74e0abf0569f8e5dfd266446efa8bfaf19f0ea0980abf0b0b22f0d8416ee90d7435d21a9f9285b66df43f370b7979173406
2 parents 70d3541 + fa3c910 commit 2ac6315

18 files changed

+42
-28
lines changed

.travis.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,17 @@ jobs:
8585
- python3-pip
8686
- shellcheck
8787
install:
88-
- if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then travis_retry pip3 install flake8 --user; fi
88+
- travis_retry pip3 install flake8 --user
8989
before_script:
9090
- git fetch --unshallow
91-
- if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then contrib/devtools/commit-script-check.sh $TRAVIS_COMMIT_RANGE; fi
92-
- contrib/devtools/git-subtree-check.sh src/crypto/ctaes
93-
- contrib/devtools/git-subtree-check.sh src/secp256k1
94-
- contrib/devtools/git-subtree-check.sh src/univalue
95-
- contrib/devtools/git-subtree-check.sh src/leveldb
96-
- contrib/devtools/check-doc.py
97-
- contrib/devtools/check-rpc-mappings.py .
98-
- if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then contrib/devtools/lint-all.sh; fi
91+
- if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then test/lint/commit-script-check.sh $TRAVIS_COMMIT_RANGE; fi
92+
- test/lint/git-subtree-check.sh src/crypto/ctaes
93+
- test/lint/git-subtree-check.sh src/secp256k1
94+
- test/lint/git-subtree-check.sh src/univalue
95+
- test/lint/git-subtree-check.sh src/leveldb
96+
- test/lint/check-doc.py
97+
- test/lint/check-rpc-mappings.py .
98+
- test/lint/lint-all.sh
9999
script:
100100
- if [ "$TRAVIS_REPO_SLUG" = "bitcoin/bitcoin" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then while read LINE; do travis_retry gpg --keyserver hkp://subset.pool.sks-keyservers.net --recv-keys $LINE; done < contrib/verify-commits/trusted-keys; fi
101101
- if [ "$TRAVIS_REPO_SLUG" = "bitcoin/bitcoin" -a "$TRAVIS_EVENT_TYPE" = "cron" ]; then travis_wait 30 contrib/verify-commits/verify-commits.sh; fi

contrib/devtools/README.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -93,23 +93,6 @@ example:
9393
BUILDDIR=$PWD/build contrib/devtools/gen-manpages.sh
9494
```
9595

96-
git-subtree-check.sh
97-
====================
98-
99-
Run this script from the root of the repository to verify that a subtree matches the contents of
100-
the commit it claims to have been updated to.
101-
102-
To use, make sure that you have fetched the upstream repository branch in which the subtree is
103-
maintained:
104-
* for `src/secp256k1`: https://github.com/bitcoin-core/secp256k1.git (branch master)
105-
* for `src/leveldb`: https://github.com/bitcoin-core/leveldb.git (branch bitcoin-fork)
106-
* for `src/univalue`: https://github.com/bitcoin-core/univalue.git (branch master)
107-
* for `src/crypto/ctaes`: https://github.com/bitcoin-core/ctaes.git (branch master)
108-
109-
Usage: `git-subtree-check.sh DIR (COMMIT)`
110-
111-
`COMMIT` may be omitted, in which case `HEAD` is used.
112-
11396
github-merge.py
11497
===============
11598

doc/developer-notes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ Others are external projects without a tight relationship with our project. Cha
647647
be sent upstream but bugfixes may also be prudent to PR against Bitcoin Core so that they can be integrated
648648
quickly. Cosmetic changes should be purely taken upstream.
649649

650-
There is a tool in contrib/devtools/git-subtree-check.sh to check a subtree directory for consistency with
650+
There is a tool in `test/lint/git-subtree-check.sh` to check a subtree directory for consistency with
651651
its upstream repository.
652652

653653
Current subtrees include:
@@ -778,7 +778,7 @@ To create a scripted-diff:
778778
- `-BEGIN VERIFY SCRIPT-`
779779
- `-END VERIFY SCRIPT-`
780780

781-
The scripted-diff is verified by the tool `contrib/devtools/commit-script-check.sh`
781+
The scripted-diff is verified by the tool `test/lint/commit-script-check.sh`
782782

783783
Commit [`bb81e173`](https://github.com/bitcoin/bitcoin/commit/bb81e173) is an example of a scripted-diff.
784784

test/functional/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ don't have test cases for.
2020
- Where possible, try to adhere to [PEP-8 guidelines](https://www.python.org/dev/peps/pep-0008/)
2121
- Use a python linter like flake8 before submitting PRs to catch common style
2222
nits (eg trailing whitespace, unused imports, etc)
23+
- See [the python lint script](/test/lint/lint-python.sh) that checks for violations that
24+
could lead to bugs and issues in the test code.
2325
- Avoid wildcard imports where possible
2426
- Use a module-level docstring to describe what the test is testing, and how it
2527
is testing it.

test/lint/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
This folder contains lint scripts.
2+
3+
check-doc.py
4+
============
5+
Check for missing documentation of command line options.
6+
7+
commit-script-check.sh
8+
======================
9+
Verification of [scripted diffs](/doc/developer-notes.md#scripted-diffs).
10+
11+
git-subtree-check.sh
12+
====================
13+
Run this script from the root of the repository to verify that a subtree matches the contents of
14+
the commit it claims to have been updated to.
15+
16+
To use, make sure that you have fetched the upstream repository branch in which the subtree is
17+
maintained:
18+
* for `src/secp256k1`: https://github.com/bitcoin-core/secp256k1.git (branch master)
19+
* for `src/leveldb`: https://github.com/bitcoin-core/leveldb.git (branch bitcoin-fork)
20+
* for `src/univalue`: https://github.com/bitcoin-core/univalue.git (branch master)
21+
* for `src/crypto/ctaes`: https://github.com/bitcoin-core/ctaes.git (branch master)
22+
23+
Usage: `git-subtree-check.sh DIR (COMMIT)`
24+
25+
`COMMIT` may be omitted, in which case `HEAD` is used.
26+
27+
lint-all.sh
28+
===========
29+
Calls other scripts with the `lint-` prefix.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)