Skip to content

Commit

Permalink
merge bitcoin#24982: Port lint-all.sh to lint-all.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kwvg committed Nov 25, 2024
1 parent f04ba76 commit 9113858
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 50 deletions.
2 changes: 1 addition & 1 deletion ci/dash/build_src.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if [ "$CHECK_DOC" = 1 ]; then
# TODO: Check docs (re-enable after all Bitcoin PRs have been merged and docs fully fixed)
#test/lint/check-doc.py
# Run all linters
test/lint/lint-all.sh
test/lint/lint-all.py
fi

ccache --zero-stats --max-size=$CCACHE_SIZE
Expand Down
2 changes: 1 addition & 1 deletion ci/lint/06_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test/lint/git-subtree-check.sh src/minisketch
test/lint/git-subtree-check.sh src/univalue
test/lint/git-subtree-check.sh src/leveldb
test/lint/check-doc.py
test/lint/lint-all.sh
test/lint/lint-all.py

if [ "$CIRRUS_REPO_FULL_NAME" = "dashpay/dash" ] && [ -n "$CIRRUS_CRON" ]; then
git log --merges --before="2 days ago" -1 --format='%H' > ./contrib/verify-commits/trusted-sha512-root-commit
Expand Down
2 changes: 1 addition & 1 deletion test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ test/lint/lint-files.py
You can run all the shell-based lint tests by running:

```
test/lint/lint-all.sh
test/lint/lint-all.py
```

# Writing functional tests
Expand Down
2 changes: 1 addition & 1 deletion test/lint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ To do so, add the upstream repository as remote:
git remote add --fetch secp256k1 https://github.com/bitcoin-core/secp256k1.git
```

lint-all.sh
lint-all.py
===========
Calls other scripts with the `lint-` prefix.
36 changes: 36 additions & 0 deletions test/lint/lint-all.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env python3
#
# Copyright (c) 2017-2022 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# This script runs all test/lint/lint-* files, and fails if any exit
# with a non-zero status code.

from glob import glob
from os import path as os_path, remove
from pathlib import Path
from shutil import which
from subprocess import run

exit_code = 0
mod_path = Path(__file__).parent
lints = [x for x in glob(f"{mod_path}/lint-*") if x != __file__]
if which("parallel") and which("column"):
logfile = "parallel_out.log"
command = ["parallel", "--jobs", "100%", "--will-cite", "--joblog", logfile, ":::"] + lints
result = run(command)
if result.returncode != 0:
print(f"^---- failure generated")
exit_code = result.returncode
result = run(["column", "-t", logfile])
if os_path.isfile(logfile):
remove(logfile)
else:
for lint in lints:
result = run([lint])
if result.returncode != 0:
print(f"^---- failure generated from {lint.split('/')[-1]}")
exit_code |= result.returncode

exit(exit_code)
46 changes: 0 additions & 46 deletions test/lint/lint-all.sh

This file was deleted.

0 comments on commit 9113858

Please sign in to comment.