1
0

5 Ревизии 1e9ec01cb8 ... e2096d96ea

Автор SHA1 Съобщение Дата
  Robert Kosten e2096d96ea produce some output in error case преди 2 години
  Robert Kosten 439142ed9c more debugging преди 2 години
  Robert Kosten 5c701e6e72 missing fi преди 2 години
  Robert Kosten bf535aea8f executable bit преди 2 години
  Robert Kosten f26cfe3835 picky about exact file extension преди 2 години
променени са 2 файла, в които са добавени 8 реда и са изтрити 8 реда
  1. 2 2
      .pre-commit-hooks.yml
  2. 6 6
      pre_commit_hooks/shellharden.sh

+ 2 - 2
.pre-commit-hooks.yml

@@ -2,8 +2,8 @@
 
 - id: shellharden
   name: Shell Syntax Check
-  description: "Runs https://github.com/anordal/shellharden on shell scripts."
+  description: "Runs https://github.com/anordal/shellharden on bash scripts."
   entry: pre_commit_hooks/shellharden.sh
   language: script
   types:
-    - shell
+    - bash

+ 6 - 6
pre_commit_hooks/shellharden.sh

@@ -4,15 +4,15 @@ set -eu -o pipefail
 DEBUG=${DEBUG:=0}
 if [[ "$DEBUG" = "1" ]]; then
   set -o xtrace
+fi
 
 if ! hash shellharden 2>/dev/null; then
   cat <<< "[ERROR] 'shellharden' not found." 1>&2;
   exit 78
 fi
 
-echo "$@"
-exit 1
-
-shellharden "$@"
-
-
+shellharden --check "$@"
+if [[ $? -ne 0 ]]; then
+  shellharden "$@"
+  exit 2
+fi