Skip to content

Commit da65147

Browse files
[FEATURE] More refactoring with new tool (- WIP #265 -)
Changes in file tests/check_cc_lines: * refactored to use new tool
1 parent 4bb904d commit da65147

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/check_cc_lines

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ check_command grep ;
9494
check_command curl ;
9595
check_command find ;
9696
check_command git ;
97+
check_command python3 ;
9798
check_command shlock ;
9899

99100

@@ -118,8 +119,7 @@ if [[ ( $(shlock -f "${LOCK_FILE}" -p $$ ) -eq 0 ) ]] ; then
118119
trap 'cleanup 2>/dev/null || rm -f "${LOCK_FILE}" 2>/dev/null > /dev/null || true ; wait ; exit ${EXIT_CODE} ;' EXIT || EXIT_CODE=1
119120
else
120121
# shellcheck disable=SC2046
121-
printf "%s\n" "Check for Copyright lines already in progress by "$(head "${LOCK_FILE}") >&2 ;
122-
false ;
122+
python3 -B .github/tools/cioutput.py -l info --file "${SCRIPT_FILE}" --line ${BASH_LINENO:-0} --title "SKIP" "Check for Copyright lines already in progress by "$(head "${LOCK_FILE}") >&2 ;
123123
exit 126 ;
124124
fi
125125

@@ -132,7 +132,7 @@ if _TEST_ROOT_DIR=$(git rev-parse --show-superproject-working-tree 2>/dev/null);
132132
_TEST_ROOT_DIR=$(git rev-parse --show-toplevel 2>/dev/null)
133133
fi
134134
else
135-
printf "\t%s\n" "FAIL: missing valid repository or source structure" >&2
135+
python3 -B .github/tools/cioutput.py -l error --file "${SCRIPT_FILE}" --line ${BASH_LINENO:-0} --title "FAIL" "FAIL: missing valid repository or source structure" >&2
136136
EXIT_CODE=40
137137
fi
138138

@@ -143,24 +143,24 @@ FILES_TO_CHECK=$(git ls-tree -r --full-tree --name-only HEAD -- *.md *.py *.txt
143143

144144
for _TEST_DOC in $FILES_TO_CHECK ; do
145145
if [[ ($(grep -cF 'Disclaimer' "${_TEST_DOC}" 2>&1 || : ;) -ne 0) ]] ; then
146-
printf "%s\n" "SKIP: ${_TEST_DOC} is disclaimed." ;
146+
python3 -B .github/tools/cioutput.py -l warning --file "${_TEST_DOC}" --title "SKIP" "SKIP: ${_TEST_DOC} is disclaimed." ;
147147
EXIT_CODE=126;
148148
else
149149
if [[ ($(grep -cF "Copyright" "${_TEST_DOC}" 2>&1 || : ;) -le 0) ]] ; then
150-
printf "%s\n" "FAIL: ${_TEST_DOC} is missing a copyright line" >&2 ;
150+
python3 -B .github/tools/cioutput.py -l error --file "${_TEST_DOC}" --title "COPYRIGHT" "FAIL: ${_TEST_DOC} is missing a copyright line" >&2 ;
151151
EXIT_CODE=127
152152
fi
153153
if [[ ( $(grep -F "Copyright" "${_TEST_DOC}" 2>&1 | grep -coF "Copyright (c)" 2>&1) -le 0) ]] ; then
154-
printf "%s\n" "SKIP: ${_TEST_DOC} is missing a valid copyright line begining with \"Copyright (c)\"" ;
154+
python3 -B .github/tools/cioutput.py -l info --file "${_TEST_DOC}" --title "COPYRIGHT" "SKIP: ${_TEST_DOC} is missing a valid copyright line begining with \"Copyright (c)\"" ;
155155
fi
156156
if [[ ( $(grep -F "Copyright (c)" "${_TEST_DOC}" 2>&1 | grep -oE "\d+(-\d+)?" 2>&1 | grep -oE "\d{3,}$" | sort -n | tail -n1) -lt "${_TEST_YEAR}") ]] ; then
157-
printf "%s\n" "WARN: ${_TEST_DOC} is out of date without a current copyright (year)" >&2 ;
157+
python3 -B .github/tools/cioutput.py -l info --file "${_TEST_DOC}" --title "DATE" "WARN: ${_TEST_DOC} is out of date without a current copyright (year)" >&2 ;
158158
fi
159159
# shellcheck disable=SC2086
160160
if [[ ( ${EXIT_CODE} -ne 0 ) ]] ; then
161161
case "$EXIT_CODE" in
162162
0|126) true ;;
163-
*) printf "%s\n" "SKIP: Unclassified issue with '${_TEST_DOC}'" ;;
163+
*) python3 -B .github/tools/cioutput.py -l info --file "${_TEST_DOC}" --title "SKIP" "SKIP: Unclassified issue with '${_TEST_DOC}'" ;;
164164
esac
165165
fi
166166
fi

0 commit comments

Comments
 (0)