Skip to content

Commit 4262100

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#24762: lint: Start to use py lint scripts
fae211c lint: Start to use py lint scripts (MarcoFalke) fa82e89 Move lint script and data file to avoid lint- prefix (MarcoFalke) Pull request description: ACKs for top commit: fjahr: tACK fae211c Tree-SHA512: f8272a1bab9efb8203cac121710baae68f01f79e520ad71ff15aa516d19763d61c088b411b019de105a6a30e7ee3c274814d59963f6ac22ba1084560fb601f45
2 parents 47bac47 + fae211c commit 4262100

File tree

7 files changed

+8
-15
lines changed

7 files changed

+8
-15
lines changed

test/lint/lint-all.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Distributed under the MIT software license, see the accompanying
55
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
66
#
7-
# This script runs all contrib/devtools/lint-*.sh files, and fails if any exit
7+
# This script runs all contrib/devtools/lint-* files, and fails if any exit
88
# with a non-zero status code.
99

1010
# This script is intentionally locale dependent by not setting "export LC_ALL=C"
@@ -18,7 +18,7 @@ LINTALL=$(basename "${BASH_SOURCE[0]}")
1818

1919
EXIT_CODE=0
2020

21-
for f in "${SCRIPTDIR}"/lint-*.sh; do
21+
for f in "${SCRIPTDIR}"/lint-*; do
2222
if [ "$(basename "$f")" != "$LINTALL" ]; then
2323
if ! "$f"; then
2424
echo "^---- failure generated from $f"

test/lint/lint-files.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from subprocess import check_output
1414
from typing import Optional, NoReturn
1515

16+
CMD_TOP_LEVEL = ["git", "rev-parse", "--show-toplevel"]
1617
CMD_ALL_FILES = "git ls-files -z --full-name"
1718
CMD_SOURCE_FILES = 'git ls-files -z --full-name -- "*.[cC][pP][pP]" "*.[hH]" "*.[pP][yY]" "*.[sS][hH]"'
1819
CMD_SHEBANG_FILES = "git grep --full-name --line-number -I '^#!'"
@@ -184,6 +185,8 @@ def check_shebang_file_permissions() -> int:
184185

185186

186187
def main() -> NoReturn:
188+
root_dir = check_output(CMD_TOP_LEVEL).decode("utf8").strip()
189+
os.chdir(root_dir)
187190
failed_tests = 0
188191
failed_tests += check_all_filenames()
189192
failed_tests += check_source_filenames()

test/lint/lint-files.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

test/lint/lint-format-strings.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ FUNCTION_NAMES_AND_NUMBER_OF_LEADING_ARGUMENTS=(
2929
)
3030

3131
EXIT_CODE=0
32-
if ! python3 -m doctest test/lint/lint-format-strings.py; then
32+
if ! python3 -m doctest "test/lint/run-lint-format-strings.py"; then
3333
EXIT_CODE=1
3434
fi
3535
for S in "${FUNCTION_NAMES_AND_NUMBER_OF_LEADING_ARGUMENTS[@]}"; do
3636
IFS="," read -r FUNCTION_NAME SKIP_ARGUMENTS <<< "${S}"
3737
for MATCHING_FILE in $(git grep --full-name -l "${FUNCTION_NAME}" -- "*.c" "*.cpp" "*.h" | sort | grep -vE "^src/(leveldb|secp256k1|minisketch|tinyformat|univalue|test/fuzz/strprintf.cpp)"); do
3838
MATCHING_FILES+=("${MATCHING_FILE}")
3939
done
40-
if ! test/lint/lint-format-strings.py --skip-arguments "${SKIP_ARGUMENTS}" "${FUNCTION_NAME}" "${MATCHING_FILES[@]}"; then
40+
if ! "test/lint/run-lint-format-strings.py" --skip-arguments "${SKIP_ARGUMENTS}" "${FUNCTION_NAME}" "${MATCHING_FILES[@]}"; then
4141
EXIT_CODE=1
4242
fi
4343
done

test/lint/lint-spelling.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if ! command -v codespell > /dev/null; then
1414
exit 0
1515
fi
1616

17-
IGNORE_WORDS_FILE=test/lint/lint-spelling.ignore-words.txt
17+
IGNORE_WORDS_FILE="test/lint/spelling.ignore-words.txt"
1818
mapfile -t FILES < <(git ls-files -- ":(exclude)build-aux/m4/" ":(exclude)contrib/seeds/*.txt" ":(exclude)depends/" ":(exclude)doc/release-notes/" ":(exclude)src/leveldb/" ":(exclude)src/crc32c/" ":(exclude)src/qt/locale/" ":(exclude)src/qt/*.qrc" ":(exclude)src/secp256k1/" ":(exclude)src/minisketch/" ":(exclude)src/univalue/" ":(exclude)contrib/builder-keys/keys.txt" ":(exclude)contrib/guix/patches")
1919
if ! codespell --check-filenames --disable-colors --quiet-level=7 --ignore-words=${IGNORE_WORDS_FILE} "${FILES[@]}"; then
2020
echo "^ Warning: codespell identified likely spelling errors. Any false positives? Add them to the list of ignored words in ${IGNORE_WORDS_FILE}"

0 commit comments

Comments
 (0)