From 9f519afc5dbe86dcb82ba4688d35ed9c2c614768 Mon Sep 17 00:00:00 2001 From: Jan Sarenik Date: Mon, 2 Jul 2018 18:05:20 +0200 Subject: [PATCH] tools/check-includes.sh: shellcheck recommended fixes $ shellcheck --version ShellCheck - shell script analysis tool version: 0.5.0 license: GNU General Public License, version 3 website: https://www.shellcheck.net $ make check-source ... In tools/check-includes.sh line 14: if [[ $(grep -cE "^#((ifndef|define) ${HEADER_ID}|endif /\* ${HEADER_ID} \*/)$" "${HEADER_FILE}") != 3 ]]; then ^-- SC1117: Backslash is literal in "\*". Prefer explicit escaping: "\\*". In tools/check-includes.sh line 28: git ls-files | grep -v 'ccan/' | grep -E "\.${1}"'$' ^-- SC1117: Backslash is literal in "\.". Prefer explicit escaping: "\\.". --- tools/check-includes.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/check-includes.sh b/tools/check-includes.sh index ca9e39c11..9de36c1fb 100755 --- a/tools/check-includes.sh +++ b/tools/check-includes.sh @@ -11,7 +11,7 @@ for HEADER_FILE in $(git ls-files -- "*.h" | grep -vE "^${REGEXP_EXCLUDE_FILES_W do HEADER_ID_BASE=$(tr / _ <<< "${HEADER_FILE/%.h/}" | tr "[:lower:]" "[:upper:]") HEADER_ID="${HEADER_ID_PREFIX}${HEADER_ID_BASE}${HEADER_ID_SUFFIX}" - if [[ $(grep -cE "^#((ifndef|define) ${HEADER_ID}|endif /\* ${HEADER_ID} \*/)$" "${HEADER_FILE}") != 3 ]]; then + if [[ $(grep -cE "^#((ifndef|define) ${HEADER_ID}|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}" @@ -25,7 +25,7 @@ done # Check redundant includes filter_suffix() { - git ls-files | grep -v 'ccan/' | grep -E "\.${1}"'$' + git ls-files | grep -v 'ccan/' | grep -E "\\.${1}"'$' } for HEADER_FILE in $(filter_suffix h); do