Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pre-commit/1-json-syntax.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function test_file {
# Set +e before and -e after for _optional_ linters (i.e.: that will only
# output messages upon commit, e.g.: style linters).
set -e
jsonlint -c "$file"
jsonlint "$file"
set +e
else
echo "Can't run JSON syntax linter because the jsonlint executable isn't in the PATH."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function test_file {
fi

if which -s csslint ; then
echo "Running CSS style lint..."
echo "Running CSS style lint with csslint..."

# Set -e before and +e after for _required_ linters (i.e.: that will prevent
# commit, e.g.: syntax linters).
Expand All @@ -27,7 +27,7 @@ function test_file {

case "${1}" in
--about )
echo "CSS style lint."
echo "CSS style lint (with csslint)."
;;

* )
Expand Down
38 changes: 38 additions & 0 deletions pre-commit/2-css-style-stylelint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

# shellcheck disable=SC2034
GREP_OPTIONS=""

function test_file {
file="${1}"

if [ ! -f "${file}" ] ; then
return
fi

if which -s stylelint ; then
echo "Running CSS style lint with stylelint..."

# Set -e before and +e after for _required_ linters (i.e.: that will prevent
# commit, e.g.: syntax linters).
# Set +e before and -e after for _optional_ linters (i.e.: that will only
# output messages upon commit, e.g.: style linters).
set +e
stylelint "$file"
set -e
else
echo "Can't run the CSS style linter because the stylelint executable isn't in the PATH."
fi
}

case "${1}" in
--about )
echo "CSS style lint (with stylelint)."
;;

* )
for file in $(git diff-index --cached --name-only HEAD | grep -E '\.(css)') ; do
test_file "${file}"
done
;;
esac
2 changes: 1 addition & 1 deletion pre-commit/2-drupal-style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ case "${1}" in
;;

* )
for file in $(git diff-index --cached --name-only HEAD | grep -E '\.(php|inc|module|install|profile|test)') ; do
for file in $(git diff-index --cached --name-only HEAD | grep -E '\.(php|inc|module|theme|profile|install|test|js|css|yml)') ; do
test_file "${file}"
done
;;
Expand Down
2 changes: 1 addition & 1 deletion pre-commit/3-drupal-practice.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ case "${1}" in
;;

* )
for file in $(git diff-index --cached --name-only HEAD | grep -E '\.(php|inc|module|install|profile|test)') ; do
for file in $(git diff-index --cached --name-only HEAD | grep -E '\.(php|inc|module|theme|profile|install|test|yml)') ; do
test_file "${file}"
done
;;
Expand Down