Kaynağa Gözat

initial for testing

Robert Kosten 2 yıl önce
ebeveyn
işleme
1e9ec01cb8
2 değiştirilmiş dosya ile 27 ekleme ve 0 silme
  1. 9 0
      .pre-commit-hooks.yml
  2. 18 0
      pre_commit_hooks/shellharden.sh

+ 9 - 0
.pre-commit-hooks.yml

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

+ 18 - 0
pre_commit_hooks/shellharden.sh

@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+set -eu -o pipefail
+
+DEBUG=${DEBUG:=0}
+if [[ "$DEBUG" = "1" ]]; then
+  set -o xtrace
+
+if ! hash shellharden 2>/dev/null; then
+  cat <<< "[ERROR] 'shellharden' not found." 1>&2;
+  exit 78
+fi
+
+echo "$@"
+exit 1
+
+shellharden "$@"
+
+