CI: lint: check js, json too (MR 19)
This commit is contained in:
parent
0b38379d61
commit
6f4285e957
1 changed files with 23 additions and 10 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue