Skip to content

Commit

Permalink
test: Refactor subtree exclusion in lint tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonOdiwuor committed Feb 26, 2024
1 parent 1ac627c commit b4d7b7a
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 19 deletions.
4 changes: 4 additions & 0 deletions test/lint/lint-ignore-dirs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
leveldb
crc32c
secp256k1
minisketch
8 changes: 4 additions & 4 deletions test/lint/lint-include-guards.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

EXCLUDE_FILES_WITH_PREFIX = ['contrib/devtools/bitcoin-tidy',
'src/crypto/ctaes',
'src/leveldb',
'src/crc32c',
'src/secp256k1',
'src/minisketch',
'src/tinyformat.h',
'src/bench/nanobench.h',
'src/test/fuzz/FuzzedDataProvider.h']

with open('test/lint/lint-ignore-dirs.txt', 'r', encoding='utf-8') as file:
EXCLUDE_FILES_WITH_PREFIX += [f"src/{line.strip()}/" for line in file]



def _get_header_file_lst() -> list[str]:
""" Helper function to get a list of header filepaths to be
Expand Down
10 changes: 3 additions & 7 deletions test/lint/lint-includes.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@

from subprocess import check_output, CalledProcessError


EXCLUDED_DIRS = ["contrib/devtools/bitcoin-tidy/",
"src/leveldb/",
"src/crc32c/",
"src/secp256k1/",
"src/minisketch/",
]
EXCLUDED_DIRS = ["contrib/devtools/bitcoin-tidy/"]
with open('test/lint/lint-ignore-dirs.txt', 'r', encoding='utf-8') as file:
EXCLUDED_DIRS += [f"src/{line.strip()}/" for line in file]

EXPECTED_BOOST_INCLUDES = ["boost/date_time/posix_time/posix_time.hpp",
"boost/multi_index/detail/hash_index_iterator.hpp",
Expand Down
5 changes: 2 additions & 3 deletions test/lint/lint-python-utf8-encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@

from subprocess import check_output, CalledProcessError

EXCLUDED_DIRS = ["src/crc32c/", "src/secp256k1/"]


def get_exclude_args():
return [":(exclude)" + dir for dir in EXCLUDED_DIRS]
with open('test/lint/lint-ignore-dirs.txt', 'r', encoding='utf-8') as file:
return [f":(exclude)src/{line.strip()}/" for line in file]


def check_fileopens():
Expand Down
5 changes: 4 additions & 1 deletion test/lint/lint-spelling.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@

from subprocess import check_output, STDOUT, CalledProcessError

with open('test/lint/lint-ignore-dirs.txt', 'r', encoding='utf-8') as file:
EXCLUDE_FILES = [f":(exclude)src/{line.strip()}/" for line in file]

IGNORE_WORDS_FILE = 'test/lint/spelling.ignore-words.txt'
FILES_ARGS = ['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)contrib/guix/patches"]
FILES_ARGS = ['git', 'ls-files', '--', ":(exclude)build-aux/m4/", ":(exclude)contrib/seeds/*.txt", ":(exclude)depends/", ":(exclude)doc/release-notes/", ":(exclude)src/qt/locale/", ":(exclude)src/qt/*.qrc", ":(exclude)contrib/guix/patches", ":(exclude)test/lint/lint-ignore-dirs.txt"] + EXCLUDE_FILES


def check_codespell_install():
Expand Down
7 changes: 3 additions & 4 deletions test/lint/lint-whitespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@

EXCLUDED_DIRS = ["depends/patches/",
"contrib/guix/patches/",
"src/leveldb/",
"src/crc32c/",
"src/secp256k1/",
"src/minisketch/",
"doc/release-notes/",
"src/qt/locale"]

with open('test/lint/lint-ignore-dirs.txt', 'r', encoding='utf-8') as file:
EXCLUDED_DIRS += [f"src/{line.strip()}/" for line in file]

def parse_args():
"""Parse command line arguments."""
parser = argparse.ArgumentParser(
Expand Down

0 comments on commit b4d7b7a

Please sign in to comment.