aboutsummaryrefslogtreecommitdiff
path: root/test/lint/lint-include-guards.sh
diff options
context:
space:
mode:
authorbrydinh <bdinh98@gmail.com>2022-04-17 12:16:29 -0400
committerbrydinh <bdinh98@gmail.com>2022-04-20 09:52:58 -0400
commitd5fdec5cf8cffe8ece5460cd8c6e83ea6eebf625 (patch)
treeffa7f707842db0683bbab5d61da66887192aaaac /test/lint/lint-include-guards.sh
parentd1b3dfb275fd98e37cfe8a0f7cea7d03595af2e8 (diff)
downloadbitcoin-d5fdec5cf8cffe8ece5460cd8c6e83ea6eebf625.tar.xz
Convert lint-include-guards.sh to python
Specify encoding when reading header files, add docstring Update test/lint/lint-include-guards.py include guard count logic Co-authored-by: Kevin Musgrave <tkm45@cornell.edu> Update test/lint/lint-include-guards.py by removing whitespace
Diffstat (limited to 'test/lint/lint-include-guards.sh')
-rwxr-xr-xtest/lint/lint-include-guards.sh30
1 files changed, 0 insertions, 30 deletions
diff --git a/test/lint/lint-include-guards.sh b/test/lint/lint-include-guards.sh
deleted file mode 100755
index f14218aa74..0000000000
--- a/test/lint/lint-include-guards.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env bash
-#
-# Copyright (c) 2018-2021 The Bitcoin Core developers
-# Distributed under the MIT software license, see the accompanying
-# file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#
-# Check include guards.
-
-export LC_ALL=C
-HEADER_ID_PREFIX="BITCOIN_"
-HEADER_ID_SUFFIX="_H"
-
-REGEXP_EXCLUDE_FILES_WITH_PREFIX="src/(crypto/ctaes/|leveldb/|crc32c/|secp256k1/|minisketch/|test/fuzz/FuzzedDataProvider.h|tinyformat.h|bench/nanobench.h|univalue/)"
-
-EXIT_CODE=0
-for HEADER_FILE in $(git ls-files -- "*.h" | grep -vE "^${REGEXP_EXCLUDE_FILES_WITH_PREFIX}")
-do
- HEADER_ID_BASE=$(cut -f2- -d/ <<< "${HEADER_FILE}" | sed "s/\.h$//g" | tr / _ | tr - _ | tr "[:lower:]" "[:upper:]")
- HEADER_ID="${HEADER_ID_PREFIX}${HEADER_ID_BASE}${HEADER_ID_SUFFIX}"
- if [[ $(grep --count --extended-regexp "^#(ifndef|define|endif //) ${HEADER_ID}" "${HEADER_FILE}") != 3 ]]; then
- echo "${HEADER_FILE} seems to be missing the expected include guard:"
- echo " #ifndef ${HEADER_ID}"
- echo " #define ${HEADER_ID}"
- echo " ..."
- echo " #endif // ${HEADER_ID}"
- echo
- EXIT_CODE=1
- fi
-done
-exit ${EXIT_CODE}