We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 06a3780 + c57f37e commit e83f2fbCopy full SHA for e83f2fb
scripts/pre-commit.hook
@@ -207,6 +207,21 @@ for FILE in $C_FILES; do
207
fi
208
done
209
210
+# Check syntax for changed shell scripts
211
+SHELL_FILES=()
212
+for file in "${FILES[@]}"; do
213
+ if [[ "$file" =~ ^scripts/common\.sh$ || "$file" =~ ^scripts/.*\.hook$ ]]; then
214
+ SHELL_FILES+=("$file")
215
+ fi
216
+done
217
+if [ "${#SHELL_FILES[@]}" -gt 0 ]; then
218
+ for file in "${SHELL_FILES[@]}"; do
219
+ if ! bash -n "$file"; then
220
+ throw "Syntax errors detected in $file." >&2
221
222
+ done
223
+fi
224
+
225
# Show insertion and deletion counts.
226
if [ "${#FILES[@]}" -gt 0 ]; then
227
echo "Following files were changed:"
0 commit comments