CI: lint: check js, json too (MR 19)

This commit is contained in:
Oliver Smith 2021-12-04 16:30:34 +01:00
parent 0b38379d61
commit 6f4285e957
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -35,7 +35,7 @@ lint_spdx() {
fi fi
} }
lint_file() { lint_spaces() {
lint \ lint \
"tabs found, indent with 4 spaces instead" \ "tabs found, indent with 4 spaces instead" \
-P '\t' -P '\t'
@ -47,18 +47,31 @@ lint_file() {
lint \ lint \
"spaces at the end of lines are not allowed" \ "spaces at the end of lines are not allowed" \
-E ' $' -E ' $'
lint_spdx
} }
lint_files() { lint_files() {
# shellcheck disable=SC2044 # shellcheck disable=SC3043
for CURRENT_FILE in $(find . -name '*.css'); do local files="$(find . -name '*.css' -o -name '*.js' -o -name '*.json')"
if ! [ -e "$CURRENT_FILE" ]; then
echo "ERROR: no CSS files found in current work dir" if [ -z "$files" ]; then
exit 1 echo "ERROR: no files to lint found in current work dir"
fi exit 1
lint_file fi
for CURRENT_FILE in $files; do
case ${CURRENT_FILE##*.} in
css)
lint_spaces
lint_spdx
;;
js)
lint_spaces
lint_spdx
;;
json)
lint_spaces
;;
esac
done done
} }