BATS: require `shellcheck` on test files
BATS: add `*.bats` to `.gitattributes`pull/2033/head
parent
3a778072db
commit
bf811cd38e
|
|
@ -1,5 +1,6 @@
|
|||
*.sh text eol=lf
|
||||
*.bash text eol=lf
|
||||
*.bats text eol=lf
|
||||
|
||||
# Docs allow trailing whitespaces
|
||||
*.md whitespace=-blank-at-eol
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ repos:
|
|||
hooks:
|
||||
- id: git-check # Configure in .gitattributes
|
||||
- id: shellcheck
|
||||
exclude: ".bats$"
|
||||
- id: shfmt
|
||||
exclude: ".bats$"
|
||||
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
||||
|
|
@ -38,10 +37,9 @@ repos:
|
|||
types: [file]
|
||||
- id: dot-bash
|
||||
name: Check .bash files against bash-it requirements
|
||||
exclude: "test/test_helper.bash"
|
||||
entry: ./hooks/dot-bash.sh
|
||||
language: system
|
||||
files: "\\.bash$"
|
||||
files: "\\.ba[ts][sh]$"
|
||||
types: [file]
|
||||
- id: clean-files-txt
|
||||
name: Check that clean_files.txt is sorted alphabetically.
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ for file in "$@"; do
|
|||
# Confirm expected schellcheck header
|
||||
#
|
||||
LINE1="$(head -n 1 "${file}")"
|
||||
if [[ "${LINE1}" != "# shellcheck shell=bash" ]]; then
|
||||
SCSH="${file##*.}"
|
||||
if [[ "${LINE1}" != "# shellcheck shell=${SCSH}" ]]; then
|
||||
echo "Bash include file \`${file}\` has bad/missing shellcheck header"
|
||||
exit_code=1
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in New Issue