mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
Merge bitcoin/bitcoin#24762: lint: Start to use py lint scripts
fae211c0ae0dd90876a3390eb21449b7b0bb45c4 lint: Start to use py lint scripts (MarcoFalke) fa82e890e7950fe5ba6d4fa88fcd922cc929dc47 Move lint script and data file to avoid lint- prefix (MarcoFalke) Pull request description: ACKs for top commit: fjahr: tACK fae211c0ae0dd90876a3390eb21449b7b0bb45c4 Tree-SHA512: f8272a1bab9efb8203cac121710baae68f01f79e520ad71ff15aa516d19763d61c088b411b019de105a6a30e7ee3c274814d59963f6ac22ba1084560fb601f45
This commit is contained in:
parent
85013e99d6
commit
f226e8dc1f
@ -4,7 +4,7 @@
|
|||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
#
|
#
|
||||||
# This script runs all contrib/devtools/lint-*.sh files, and fails if any exit
|
# This script runs all contrib/devtools/lint-* files, and fails if any exit
|
||||||
# with a non-zero status code.
|
# with a non-zero status code.
|
||||||
|
|
||||||
# This script is intentionally locale dependent by not setting "export LC_ALL=C"
|
# This script is intentionally locale dependent by not setting "export LC_ALL=C"
|
||||||
@ -19,7 +19,7 @@ LINTALL=$(basename "${BASH_SOURCE[0]}")
|
|||||||
EXIT_CODE=0
|
EXIT_CODE=0
|
||||||
|
|
||||||
if ! command -v parallel > /dev/null; then
|
if ! command -v parallel > /dev/null; then
|
||||||
for f in "${SCRIPTDIR}"/lint-*.sh; do
|
for f in "${SCRIPTDIR}"/lint-*; do
|
||||||
if [ "$(basename "$f")" != "$LINTALL" ]; then
|
if [ "$(basename "$f")" != "$LINTALL" ]; then
|
||||||
if ! "$f"; then
|
if ! "$f"; then
|
||||||
echo "^---- failure generated from $f"
|
echo "^---- failure generated from $f"
|
||||||
|
@ -13,6 +13,7 @@ import sys
|
|||||||
from subprocess import check_output
|
from subprocess import check_output
|
||||||
from typing import Optional, NoReturn
|
from typing import Optional, NoReturn
|
||||||
|
|
||||||
|
CMD_TOP_LEVEL = ["git", "rev-parse", "--show-toplevel"]
|
||||||
CMD_ALL_FILES = "git ls-files -z --full-name"
|
CMD_ALL_FILES = "git ls-files -z --full-name"
|
||||||
CMD_SOURCE_FILES = 'git ls-files -z --full-name -- "*.[cC][pP][pP]" "*.[hH]" "*.[pP][yY]" "*.[sS][hH]"'
|
CMD_SOURCE_FILES = 'git ls-files -z --full-name -- "*.[cC][pP][pP]" "*.[hH]" "*.[pP][yY]" "*.[sS][hH]"'
|
||||||
CMD_SHEBANG_FILES = "git grep --full-name --line-number -I '^#!'"
|
CMD_SHEBANG_FILES = "git grep --full-name --line-number -I '^#!'"
|
||||||
@ -184,6 +185,8 @@ def check_shebang_file_permissions() -> int:
|
|||||||
|
|
||||||
|
|
||||||
def main() -> NoReturn:
|
def main() -> NoReturn:
|
||||||
|
root_dir = check_output(CMD_TOP_LEVEL).decode("utf8").strip()
|
||||||
|
os.chdir(root_dir)
|
||||||
failed_tests = 0
|
failed_tests = 0
|
||||||
failed_tests += check_all_filenames()
|
failed_tests += check_all_filenames()
|
||||||
failed_tests += check_source_filenames()
|
failed_tests += check_source_filenames()
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
export LC_ALL=C
|
|
||||||
|
|
||||||
set -e
|
|
||||||
cd "$(dirname $0)/../.."
|
|
||||||
test/lint/lint-files.py
|
|
@ -29,7 +29,7 @@ FUNCTION_NAMES_AND_NUMBER_OF_LEADING_ARGUMENTS=(
|
|||||||
)
|
)
|
||||||
|
|
||||||
EXIT_CODE=0
|
EXIT_CODE=0
|
||||||
if ! python3 -m doctest test/lint/lint-format-strings.py; then
|
if ! python3 -m doctest "test/lint/run-lint-format-strings.py"; then
|
||||||
EXIT_CODE=1
|
EXIT_CODE=1
|
||||||
fi
|
fi
|
||||||
for S in "${FUNCTION_NAMES_AND_NUMBER_OF_LEADING_ARGUMENTS[@]}"; do
|
for S in "${FUNCTION_NAMES_AND_NUMBER_OF_LEADING_ARGUMENTS[@]}"; do
|
||||||
@ -37,7 +37,7 @@ for S in "${FUNCTION_NAMES_AND_NUMBER_OF_LEADING_ARGUMENTS[@]}"; do
|
|||||||
for MATCHING_FILE in $(git grep --full-name -l "${FUNCTION_NAME}" -- "*.c" "*.cpp" "*.h" | sort | grep -vE "^src/(dashbls|leveldb|secp256k1|tinyformat|univalue|test/fuzz/strprintf.cpp)"); do
|
for MATCHING_FILE in $(git grep --full-name -l "${FUNCTION_NAME}" -- "*.c" "*.cpp" "*.h" | sort | grep -vE "^src/(dashbls|leveldb|secp256k1|tinyformat|univalue|test/fuzz/strprintf.cpp)"); do
|
||||||
MATCHING_FILES+=("${MATCHING_FILE}")
|
MATCHING_FILES+=("${MATCHING_FILE}")
|
||||||
done
|
done
|
||||||
if ! test/lint/lint-format-strings.py --skip-arguments "${SKIP_ARGUMENTS}" "${FUNCTION_NAME}" "${MATCHING_FILES[@]}"; then
|
if ! "test/lint/run-lint-format-strings.py" --skip-arguments "${SKIP_ARGUMENTS}" "${FUNCTION_NAME}" "${MATCHING_FILES[@]}"; then
|
||||||
EXIT_CODE=1
|
EXIT_CODE=1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -14,7 +14,7 @@ if ! command -v codespell > /dev/null; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
IGNORE_WORDS_FILE=test/lint/lint-spelling.ignore-words.txt
|
IGNORE_WORDS_FILE="test/lint/spelling.ignore-words.txt"
|
||||||
if ! codespell --check-filenames --disable-colors --quiet-level=7 --ignore-words=${IGNORE_WORDS_FILE} $(git ls-files -- ":(exclude)build-aux/m4/" ":(exclude)contrib/seeds/*.txt" ":(exclude)depends/" ":(exclude)doc/release-notes/" ":(exclude)src/bip39_english.h" ":(exclude)src/dashbls/" ":(exclude)src/crc32c/" ":(exclude)src/crypto/" ":(exclude)src/ctpl_stl.h" ":(exclude)src/cxxtimer.hpp" ":(exclude)src/util/expected.h" ":(exclude)src/immer/" ":(exclude)src/leveldb/" ":(exclude)src/qt/locale/" ":(exclude)src/qt/*.qrc" ":(exclude)src/secp256k1/" ":(exclude)src/univalue/" ":(exclude)contrib/builder-keys/" ":(exclude)contrib/guix/patches"); then
|
if ! codespell --check-filenames --disable-colors --quiet-level=7 --ignore-words=${IGNORE_WORDS_FILE} $(git ls-files -- ":(exclude)build-aux/m4/" ":(exclude)contrib/seeds/*.txt" ":(exclude)depends/" ":(exclude)doc/release-notes/" ":(exclude)src/bip39_english.h" ":(exclude)src/dashbls/" ":(exclude)src/crc32c/" ":(exclude)src/crypto/" ":(exclude)src/ctpl_stl.h" ":(exclude)src/cxxtimer.hpp" ":(exclude)src/util/expected.h" ":(exclude)src/immer/" ":(exclude)src/leveldb/" ":(exclude)src/qt/locale/" ":(exclude)src/qt/*.qrc" ":(exclude)src/secp256k1/" ":(exclude)src/univalue/" ":(exclude)contrib/builder-keys/" ":(exclude)contrib/guix/patches"); then
|
||||||
echo "^ Warning: codespell identified likely spelling errors. Any false positives? Add them to the list of ignored words in ${IGNORE_WORDS_FILE}"
|
echo "^ Warning: codespell identified likely spelling errors. Any false positives? Add them to the list of ignored words in ${IGNORE_WORDS_FILE}"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user