Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit bb28e70

Browse files
malikkotobgrasmash
authored andcommitted
Fixes #1104: Git pre-commit hook is slow. (#1242)
1 parent 7ddb2ba commit bb28e70

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

scripts/git-hooks/pre-commit

+10-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@ fi
1212

1313
echo "Sniffing staged files via PHP Code Sniffer..."
1414
${ROOT_DIR}/vendor/bin/blt validate:phpcs:files -Dfiles="$LIST" -silent -emacs || exit 1;
15-
echo "Linting custom twig files..."
16-
${ROOT_DIR}/vendor/bin/blt validate:twig -silent -emacs || exit 1;
17-
echo "Validating composer.json..."
18-
composer validate --quiet --no-check-all || (echo 'composer.json is not valid. Run `composer validate` for more information.' && exit 1;)
15+
if [[ $LIST == *".twig"* ]];
16+
then
17+
echo "Linting custom twig files..."
18+
${ROOT_DIR}/vendor/bin/blt validate:twig -silent -emacs || exit 1;
19+
fi
20+
if [[ $LIST == *"composer."* ]];
21+
then
22+
echo "Validating composer.json..."
23+
composer validate --quiet --no-check-all || (echo 'composer.json is not valid. Run `composer validate` for more information.' && exit 1;)
24+
fi
1925
echo "Ok!"
2026

2127
# Return the status of the last run command.

0 commit comments

Comments
 (0)