mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
improve chk_tree and trailblank
The chk_tree will check for files in distlist that would otherwise be ignored by trailblank or that are used, by convention, as tempory / test files. Fixed a shellcheck nit in trailblank.
This commit is contained in:
28
chk_tree
28
chk_tree
@@ -260,6 +260,9 @@ fi
|
|||||||
# We ignore .*.swp files as they are a result of vim sessions.
|
# We ignore .*.swp files as they are a result of vim sessions.
|
||||||
# We ignore *.out files as they are used to collect information.
|
# We ignore *.out files as they are used to collect information.
|
||||||
# We ignore single letter files as they are used for temporary files.
|
# We ignore single letter files as they are used for temporary files.
|
||||||
|
# We ignore files containing the any of the following in any letter case:
|
||||||
|
#
|
||||||
|
# foo bar baz curds whey rmme
|
||||||
#
|
#
|
||||||
declare -a FINDFILE
|
declare -a FINDFILE
|
||||||
mapfile -t FINDFILE < <(find . -type f \
|
mapfile -t FINDFILE < <(find . -type f \
|
||||||
@@ -267,7 +270,9 @@ mapfile -t FINDFILE < <(find . -type f \
|
|||||||
! -path './.git/*' ! -name .git \
|
! -path './.git/*' ! -name .git \
|
||||||
! -path './.github/*' ! -name .github \
|
! -path './.github/*' ! -name .github \
|
||||||
! -name 'CODE_OF_CONDUCT.md' ! -name 'CONTRIBUTING.md' ! -name '.gitignore' ! -name 'SECURITY.md' \
|
! -name 'CODE_OF_CONDUCT.md' ! -name 'CONTRIBUTING.md' ! -name '.gitignore' ! -name 'SECURITY.md' \
|
||||||
! -name '*.swp' ! -name '*.out' ! -name '?' |
|
! -name '*.swp' ! -name '?' ! -iname '*.out*' \
|
||||||
|
! -iname '*foo*' ! -iname '*bar*' ! -iname '*baz*' \
|
||||||
|
! -iname '*curds*' ! -iname '*whey*' ! -iname '*rmmee' -print |
|
||||||
sed -e 's/^\.\///' | sort -u)
|
sed -e 's/^\.\///' | sort -u)
|
||||||
if [[ ${#FINDFILE[@]} -le 0 ]]; then
|
if [[ ${#FINDFILE[@]} -le 0 ]]; then
|
||||||
echo "$0: ERROR: find file is empty" 1>&2
|
echo "$0: ERROR: find file is empty" 1>&2
|
||||||
@@ -316,6 +321,27 @@ if [[ ${#UNKNOWN_FILE[@]} -ne 0 ]]; then
|
|||||||
echo "$0: Warning: set EXIT_CODE: $EXIT_CODE" 1>&2
|
echo "$0: Warning: set EXIT_CODE: $EXIT_CODE" 1>&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Look for a find in distlist that would otherwise be ignored
|
||||||
|
#
|
||||||
|
# We ignore for trailblank and FINDFILE, filenames with a single letter, and files
|
||||||
|
# that end in .out, and files containing the any of the following
|
||||||
|
# in any letter case:
|
||||||
|
#
|
||||||
|
# foo bar baz curds whey rmme
|
||||||
|
#
|
||||||
|
# So we will object is any distlist file is one of these ignored filenames.
|
||||||
|
#
|
||||||
|
INVALID_DISTLIST=$(printf '%s\n' "${DISTLIST[@]}" | \
|
||||||
|
tr '[:upper:]' '[:lower:]' | \
|
||||||
|
sed -n -e '/^.$/p' -e '/.*foo.*/p' -e '/.*bar.*/p' -e '/.*baz.*/p' \
|
||||||
|
-e '/.*curds.*/p' -e '/.*whey.*/p' -e '/.*rmme.*/p' |
|
||||||
|
tr '\n' ' ')
|
||||||
|
if [[ -n $INVALID_DISTLIST ]]; then
|
||||||
|
echo "$0: ERROR: distlist contains invalid filename(s): $INVALID_DISTLIST" 1>&2
|
||||||
|
EXIT_CODE=28
|
||||||
|
echo "$0: Warning: set EXIT_CODE: $EXIT_CODE" 1>&2
|
||||||
|
fi
|
||||||
|
|
||||||
# All Done!!! -- Jessica Noll, Age 2
|
# All Done!!! -- Jessica Noll, Age 2
|
||||||
#
|
#
|
||||||
if [[ $EXIT_CODE -ne 0 ]]; then
|
if [[ $EXIT_CODE -ne 0 ]]; then
|
||||||
|
@@ -212,7 +212,7 @@ if [[ -n $BACKUP_MAKEILES ]]; then
|
|||||||
echo
|
echo
|
||||||
echo "# You need execute the following to remove backup Makefiles:"
|
echo "# You need execute the following to remove backup Makefiles:"
|
||||||
echo
|
echo
|
||||||
echo "$BACKUP_MAKEILES" | while read file; do
|
echo "$BACKUP_MAKEILES" | while read -r file; do
|
||||||
echo "rm -f $file"
|
echo "rm -f $file"
|
||||||
done
|
done
|
||||||
EXIT_CODE=7
|
EXIT_CODE=7
|
||||||
|
Reference in New Issue
Block a user