mirror of
https://github.com/Karaka-Management/Build.git
synced 2026-02-12 01:08:39 +00:00
Escape file name
This commit is contained in:
parent
1ee10359de
commit
b1b3f4ee84
|
|
@ -4,7 +4,7 @@ isValidFileName() {
|
||||||
allownonascii="false"
|
allownonascii="false"
|
||||||
|
|
||||||
if [ "$allownonascii" != "true" ] &&
|
if [ "$allownonascii" != "true" ] &&
|
||||||
test $(git diff --cached --name-only --diff-filter=A -z $1 |
|
test $(git diff --cached --name-only --diff-filter=A -z "$1" |
|
||||||
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
|
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
|
||||||
then
|
then
|
||||||
return 0
|
return 0
|
||||||
|
|
|
||||||
|
|
@ -24,37 +24,37 @@ hasInvalidPhpSyntax() {
|
||||||
|
|
||||||
hasInvalidHtmlTemplateContent() {
|
hasInvalidHtmlTemplateContent() {
|
||||||
# Images must have a alt= attribute *error*
|
# Images must have a alt= attribute *error*
|
||||||
if [[ -n $(grep -P '(\<img)((?!.*?alt=).)*(>)' $1) ]]; then
|
if [[ -n $(grep -P '(\<img)((?!.*?alt=).)*(>)' "$1") ]]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Input elements must have a type= attribute *error*
|
# Input elements must have a type= attribute *error*
|
||||||
if [[ -n $(grep -P '(<input)((?!.*?type=).)*(>)' $1) ]]; then
|
if [[ -n $(grep -P '(<input)((?!.*?type=).)*(>)' "$1") ]]; then
|
||||||
return 2
|
return 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Form fields must have a name *error*
|
# Form fields must have a name *error*
|
||||||
if [[ -n $(grep -P '(<input|<select|<textarea)((?!.*?name=).)*(>)' $1) ]]; then
|
if [[ -n $(grep -P '(<input|<select|<textarea)((?!.*?name=).)*(>)' "$1") ]]; then
|
||||||
return 3
|
return 3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Form must have a id, action and method *error*
|
# Form must have a id, action and method *error*
|
||||||
if [[ -n $(grep -P '(\<form)((?!.*?(action|method|id)=).)*(>)' $1) ]]; then
|
if [[ -n $(grep -P '(\<form)((?!.*?(action|method|id)=).)*(>)' "$1") ]]; then
|
||||||
return 4
|
return 4
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Inline css is invalid *warning*
|
# Inline css is invalid *warning*
|
||||||
if [[ -n $(grep -P '(style=)' $1) ]]; then
|
if [[ -n $(grep -P '(style=)' "$1") ]]; then
|
||||||
return 5
|
return 5
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Attribute descriptions should not be hard coded *warning*
|
# Attribute descriptions should not be hard coded *warning*
|
||||||
if [[ -n $(grep -P '(value|title|alt|aria\-label)(=\")((?!\<\?).)*(>)' $1) ]]; then
|
if [[ -n $(grep -P '(value|title|alt|aria\-label)(=\")((?!\<\?).)*(>)' "$1") ]]; then
|
||||||
return 6
|
return 6
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Hard coded language *warning*
|
# Hard coded language *warning*
|
||||||
if [[ -n $(grep -P '(\<td\>|\<th\>|\<caption\>|\<label.*?(\"|l)\>)[0-9a-zA-Z\.\?]+' $1) ]]; then
|
if [[ -n $(grep -P '(\<td\>|\<th\>|\<caption\>|\<label.*?(\"|l)\>)[0-9a-zA-Z\.\?]+' "$1") ]]; then
|
||||||
return 7
|
return 7
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -72,12 +72,12 @@ isValidBashScript() {
|
||||||
|
|
||||||
hasInvalidBasicSyntax() {
|
hasInvalidBasicSyntax() {
|
||||||
# Check whitespace end of line in code
|
# Check whitespace end of line in code
|
||||||
if [[ -n $(grep -P ' $' $1) ]]; then
|
if [[ -n $(grep -P ' $' "$1") ]]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for tabs
|
# Check for tabs
|
||||||
if [[ -n $(grep -P '\t' $1) ]]; then
|
if [[ -n $(grep -P '\t' "$1") ]]; then
|
||||||
return 2
|
return 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user