mirror of
https://github.com/ben-grande/qusal.git
synced 2025-05-06 16:25:17 -04:00
fix: uniform lint scripts name
This commit is contained in:
parent
155eaa8622
commit
4239032cfc
4 changed files with 4 additions and 4 deletions
47
scripts/unicode-lint.sh
Executable file
47
scripts/unicode-lint.sh
Executable file
|
@ -0,0 +1,47 @@
|
|||
#!/bin/sh
|
||||
|
||||
## SPDX-FileCopyrightText: 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
##
|
||||
## SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
##
|
||||
## Finds Unicode recursively and prints in hexadecimal format.
|
||||
|
||||
set -eu
|
||||
|
||||
command -v git >/dev/null || { echo "Missing program: git" >&2; exit 1; }
|
||||
repo_toplevel="$(git rev-parse --show-toplevel)"
|
||||
test -d "${repo_toplevel}" || exit 1
|
||||
unset repo_toplevel
|
||||
|
||||
files=""
|
||||
if test -n "${1-}"; then
|
||||
files="${*}"
|
||||
if test -z "${files}"; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
files="$(echo "${files}" | sort -u)"
|
||||
# shellcheck disable=SC2086
|
||||
unicode_match="$(grep -oPrHn --exclude-dir=.git --exclude-dir=LICENSES \
|
||||
-e "[^\x00-\x7F]" -- ${files} || true)"
|
||||
|
||||
match_found=""
|
||||
if test -n "${unicode_match}"; then
|
||||
for line in ${unicode_match}; do
|
||||
line_file="$(echo "${line}" | cut -d ":" -f1)"
|
||||
case "${line_file}" in
|
||||
git/*|LICENSES/*|.reuse/dep5|*.asc) continue;;
|
||||
*) ;;
|
||||
esac
|
||||
line_number="$(echo "${line}" | cut -d ":" -f2)"
|
||||
line_unicode="$(echo "${line}" | cut -d ":" -f3 | od -A n -vt c)"
|
||||
echo "${line_file}:${line_number}:${line_unicode}"
|
||||
match_found="1"
|
||||
done
|
||||
if test "${match_found}" = 1; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
Loading…
Add table
Add a link
Reference in a new issue