mirror of
https://github.com/Karaka-Management/Build.git
synced 2026-02-08 07:38:41 +00:00
Add html/tpl attribute tests
This commit is contained in:
parent
f03d879a9f
commit
a7429fa17e
|
|
@ -27,6 +27,24 @@ if [[ "$FILE" =~ ^.+(php)$ ]]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Html checks
|
||||||
|
if [[ "$FILE" =~ ^.+(tpl\.php|html)$ ]]; then
|
||||||
|
if [[ -n $(grep -E '=\"[\#\$\%\^\&\*\(\)\\/\ ]+\"' $FILE) ]]; then
|
||||||
|
echo -e "\e[1;31m\tFound invalid attribute.\e[0m" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n $(grep -E '(id|class)=\"[a-zA-Z]*[\#\$\%\^\&\*\(\)\\/\ ]+[a-zA-Z]*\"' $FILE) ]]; then
|
||||||
|
echo -e "\e[1;31m\tFound invalid class/id.\e[0m" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n $(grep -P '(\<img)((?!.*?alt=).)*(>)' $FILE) ]]; then
|
||||||
|
echo -e "\e[1;31m\tFound missing image alt attribute.\e[0m" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$FILE" =~ ^.+(sh)$ ]]; then
|
if [[ "$FILE" =~ ^.+(sh)$ ]]; then
|
||||||
if [[ -f $FILE ]]; then
|
if [[ -f $FILE ]]; then
|
||||||
# sh lint
|
# sh lint
|
||||||
|
|
@ -38,10 +56,12 @@ if [[ "$FILE" =~ ^.+(sh)$ ]]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check whitespace end of line
|
# Check whitespace end of line in code
|
||||||
if [[ -n $(find $FILE -type f -exec egrep -l " +$" {} \;) ]]; then
|
if [[ "$FILE" =~ ^.+(sh|js|php)$ ]]; then
|
||||||
echo -e "\e[1;31m\tFound whitespace at end of line.\e[0m" >&2
|
if [[ -n $(find $FILE -type f -exec egrep -l " +$" {} \;) ]]; then
|
||||||
exit 1
|
echo -e "\e[1;31m\tFound whitespace at end of line.\e[0m" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done || exit $?
|
done || exit $?
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user