mirror of
https://github.com/Karaka-Management/Build.git
synced 2026-02-05 22:38:41 +00:00
Fix new hooks
This commit is contained in:
parent
d8750c90dd
commit
f56dd74de6
|
|
@ -64,11 +64,13 @@ git diff --cached --name-only | while read FILE; do
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$FILE" =~ ^.+(sh|js|php|json|css)$ ]]; then
|
if [[ "$FILE" =~ ^.+(sh|js|php|json|css)$ ]]; then
|
||||||
|
echo 0
|
||||||
|
echo $FILE
|
||||||
echo 1
|
echo 1
|
||||||
GEN_SYNTAX=$(hasInvalidBasicSyntax "$FILE")
|
GEN_SYNTAX=$(hasInvalidBasicSyntax "$FILE")
|
||||||
|
|
||||||
echo 2
|
echo 2
|
||||||
|
|
||||||
|
|
||||||
if [[ $GEN_SYNTAX = 1 ]]; then
|
if [[ $GEN_SYNTAX = 1 ]]; then
|
||||||
echo -e "\e[1;31m\tFound whitespace at end of line in $FILE.\e[0m" >&2
|
echo -e "\e[1;31m\tFound whitespace at end of line in $FILE.\e[0m" >&2
|
||||||
grep -P ' $' $FILE >&2
|
grep -P ' $' $FILE >&2
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,7 @@ isValidBashScript() {
|
||||||
}
|
}
|
||||||
|
|
||||||
hasInvalidBasicSyntax() {
|
hasInvalidBasicSyntax() {
|
||||||
# Check whitespace end of line in code
|
|
||||||
if [[ -n $(grep -P ' $' "$1") ]]; then
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check for tabs
|
# Check for tabs
|
||||||
if [[ -n $(grep -P '\t' "$1") ]]; then
|
if [[ -n $(grep -P '\t' "$1") ]]; then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user