mirror of
https://github.com/Karaka-Management/Build.git
synced 2026-02-11 00:38:40 +00:00
Add more html checks based on css debug selectors
This commit is contained in:
parent
6fcd0ec1ee
commit
a99882999f
|
|
@ -27,7 +27,7 @@ if [[ "$FILE" =~ ^.+(php)$ ]]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Html checks
|
# Html/template checks
|
||||||
if [[ "$FILE" =~ ^.+(tpl\.php|html)$ ]]; then
|
if [[ "$FILE" =~ ^.+(tpl\.php|html)$ ]]; then
|
||||||
# Invalid and empty attributes
|
# Invalid and empty attributes
|
||||||
if [[ -n $(grep -E '=\"[\#\$\%\^\&\*\(\)\\/\ ]*\"' $FILE) ]]; then
|
if [[ -n $(grep -E '=\"[\#\$\%\^\&\*\(\)\\/\ ]*\"' $FILE) ]]; then
|
||||||
|
|
@ -50,6 +50,33 @@ if [[ "$FILE" =~ ^.+(tpl\.php|html)$ ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Input elements must have a type= attribute *error*
|
||||||
|
if [[ -n $(grep -P '(\<input)((?!.*?type=).)*(>)' $FILE) ]]; then
|
||||||
|
echo -e "\e[1;31m\tFound missing input type attribute.\e[0m" >&2
|
||||||
|
grep -P '(\<input)((?!.*?type=).)*(>)' $FILE >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Form fields must have a name *error*
|
||||||
|
if [[ -n $(grep -P '(\<input|select|textarea)((?!.*?name=).)*(>)' $FILE) ]]; then
|
||||||
|
echo -e "\e[1;31m\tFound missing form element name.\e[0m" >&2
|
||||||
|
grep -P '(\<input|select|textarea)((?!.*?name=).)*(>)' $FILE >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Form must have a id, action and method *error*
|
||||||
|
if [[ -n $(grep -P '(\<form)((?!.*?(action|method|id)=).)*(>)' $FILE) ]]; then
|
||||||
|
echo -e "\e[1;31m\tFound missing form element action, method or id.\e[0m" >&2
|
||||||
|
grep -P '(\<form)((?!.*?(action|method|id)=).)*(>)' $FILE >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Inline css is invalid *warning*
|
||||||
|
if [[ -n $(grep -P '(style=)' $FILE) ]]; then
|
||||||
|
echo -e "\e[1;31m\tFound missing form element action, method or id.\e[0m" >&2
|
||||||
|
grep -P '(style=)' $FILE >&2
|
||||||
|
fi
|
||||||
|
|
||||||
# Value fields should not be hard coded *warning*
|
# Value fields should not be hard coded *warning*
|
||||||
if [[ -n $(grep -P '(value=\")((?!\<\?).)*(>)' $FILE) ]]; then
|
if [[ -n $(grep -P '(value=\")((?!\<\?).)*(>)' $FILE) ]]; then
|
||||||
echo -e "\e[1;31m\tValue field should not be hard coded.\e[0m" >&2
|
echo -e "\e[1;31m\tValue field should not be hard coded.\e[0m" >&2
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user