test: Move linters to test/lint, add readme

pull/585/head
MarcoFalke 7 years ago
parent d9ebb63919
commit fa3c910bfe
No known key found for this signature in database
GPG Key ID: CE2B75697E69A548

@ -85,17 +85,17 @@ jobs:
- python3-pip - python3-pip
- shellcheck - shellcheck
install: install:
- if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then travis_retry pip3 install flake8 --user; fi - travis_retry pip3 install flake8 --user
before_script: before_script:
- git fetch --unshallow - git fetch --unshallow
- if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then contrib/devtools/commit-script-check.sh $TRAVIS_COMMIT_RANGE; fi - if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then test/lint/commit-script-check.sh $TRAVIS_COMMIT_RANGE; fi
- contrib/devtools/git-subtree-check.sh src/crypto/ctaes - test/lint/git-subtree-check.sh src/crypto/ctaes
- contrib/devtools/git-subtree-check.sh src/secp256k1 - test/lint/git-subtree-check.sh src/secp256k1
- contrib/devtools/git-subtree-check.sh src/univalue - test/lint/git-subtree-check.sh src/univalue
- contrib/devtools/git-subtree-check.sh src/leveldb - test/lint/git-subtree-check.sh src/leveldb
- contrib/devtools/check-doc.py - test/lint/check-doc.py
- contrib/devtools/check-rpc-mappings.py . - test/lint/check-rpc-mappings.py .
- if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then contrib/devtools/lint-all.sh; fi - test/lint/lint-all.sh
script: script:
- 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 - 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
- if [ "$TRAVIS_REPO_SLUG" = "bitcoin/bitcoin" -a "$TRAVIS_EVENT_TYPE" = "cron" ]; then travis_wait 30 contrib/verify-commits/verify-commits.sh; fi - if [ "$TRAVIS_REPO_SLUG" = "bitcoin/bitcoin" -a "$TRAVIS_EVENT_TYPE" = "cron" ]; then travis_wait 30 contrib/verify-commits/verify-commits.sh; fi

@ -93,23 +93,6 @@ example:
BUILDDIR=$PWD/build contrib/devtools/gen-manpages.sh BUILDDIR=$PWD/build contrib/devtools/gen-manpages.sh
``` ```
git-subtree-check.sh
====================
Run this script from the root of the repository to verify that a subtree matches the contents of
the commit it claims to have been updated to.
To use, make sure that you have fetched the upstream repository branch in which the subtree is
maintained:
* for `src/secp256k1`: https://github.com/bitcoin-core/secp256k1.git (branch master)
* for `src/leveldb`: https://github.com/bitcoin-core/leveldb.git (branch bitcoin-fork)
* for `src/univalue`: https://github.com/bitcoin-core/univalue.git (branch master)
* for `src/crypto/ctaes`: https://github.com/bitcoin-core/ctaes.git (branch master)
Usage: `git-subtree-check.sh DIR (COMMIT)`
`COMMIT` may be omitted, in which case `HEAD` is used.
github-merge.py github-merge.py
=============== ===============

@ -647,7 +647,7 @@ Others are external projects without a tight relationship with our project. Cha
be sent upstream but bugfixes may also be prudent to PR against Bitcoin Core so that they can be integrated be sent upstream but bugfixes may also be prudent to PR against Bitcoin Core so that they can be integrated
quickly. Cosmetic changes should be purely taken upstream. quickly. Cosmetic changes should be purely taken upstream.
There is a tool in contrib/devtools/git-subtree-check.sh to check a subtree directory for consistency with There is a tool in `test/lint/git-subtree-check.sh` to check a subtree directory for consistency with
its upstream repository. its upstream repository.
Current subtrees include: Current subtrees include:
@ -778,7 +778,7 @@ To create a scripted-diff:
- `-BEGIN VERIFY SCRIPT-` - `-BEGIN VERIFY SCRIPT-`
- `-END VERIFY SCRIPT-` - `-END VERIFY SCRIPT-`
The scripted-diff is verified by the tool `contrib/devtools/commit-script-check.sh` The scripted-diff is verified by the tool `test/lint/commit-script-check.sh`
Commit [`bb81e173`](https://github.com/bitcoin/bitcoin/commit/bb81e173) is an example of a scripted-diff. Commit [`bb81e173`](https://github.com/bitcoin/bitcoin/commit/bb81e173) is an example of a scripted-diff.

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

@ -0,0 +1,29 @@
This folder contains lint scripts.
check-doc.py
============
Check for missing documentation of command line options.
commit-script-check.sh
======================
Verification of [scripted diffs](/doc/developer-notes.md#scripted-diffs).
git-subtree-check.sh
====================
Run this script from the root of the repository to verify that a subtree matches the contents of
the commit it claims to have been updated to.
To use, make sure that you have fetched the upstream repository branch in which the subtree is
maintained:
* for `src/secp256k1`: https://github.com/bitcoin-core/secp256k1.git (branch master)
* for `src/leveldb`: https://github.com/bitcoin-core/leveldb.git (branch bitcoin-fork)
* for `src/univalue`: https://github.com/bitcoin-core/univalue.git (branch master)
* for `src/crypto/ctaes`: https://github.com/bitcoin-core/ctaes.git (branch master)
Usage: `git-subtree-check.sh DIR (COMMIT)`
`COMMIT` may be omitted, in which case `HEAD` is used.
lint-all.sh
===========
Calls other scripts with the `lint-` prefix.
Loading…
Cancel
Save