From 3de5b43447ddef1432f81d61ee309dad27635b7a Mon Sep 17 00:00:00 2001
From: Casey Faist <caseylfaist@gmail.com>
Date: Sun, 11 Nov 2018 16:36:16 -0600
Subject: [PATCH] add bash pre-commit hook and correct shellcheck warnings

---
 .pre-commit-config.yaml |  5 +++++
 bin/steps/python        | 26 +++++++++++++-------------
 2 files changed, 18 insertions(+), 13 deletions(-)
 create mode 100644 .pre-commit-config.yaml

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 00000000..c1938639
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,5 @@
+repos:
+-   repo: git://github.com/detailyang/pre-commit-shell
+    rev: 1.0.4
+    hooks:
+    - id: shell-lint
diff --git a/bin/steps/python b/bin/steps/python
index cfd267f9..cb697830 100755
--- a/bin/steps/python
+++ b/bin/steps/python
@@ -10,32 +10,32 @@ VENDORED_PYTHON="${VENDOR_URL}/runtimes/$PYTHON_VERSION.tar.gz"
 SECURITY_UPDATE="Python has released a security update! Please consider upgrading to "
 
 # check if runtime exists
-if curl --output /dev/null --silent --head --fail $VENDORED_PYTHON; then
-  if [[ $PYTHON_VERSION == $PY37* ]]; then
+if curl --output /dev/null --silent --head --fail "$VENDORED_PYTHON"; then
+  if [[ "$PYTHON_VERSION" == $PY37* ]]; then
     # do things to alert the user of security release available
-    if [ $PYTHON_VERSION != $LATEST_37 ]; then
-      puts-warn $SECURITY_UPDATE $LATEST_37
+    if [ "$PYTHON_VERSION" != "$LATEST_37" ]; then
+      puts-warn "$SECURITY_UPDATE" "$LATEST_37"
       echo "       Learn More: https://devcenter.heroku.com/articles/python-runtimes"
     fi
   fi
-  if [[ $PYTHON_VERSION == $PY36* ]]; then
+  if [[ "$PYTHON_VERSION" == $PY36* ]]; then
     # security update note
-    if [ $PYTHON_VERSION != $LATEST_36 ]; then
-      puts-warn $SECURITY_UPDATE $LATEST_36
+    if [ "$PYTHON_VERSION" != "$LATEST_36" ]; then
+      puts-warn "$SECURITY_UPDATE" "$LATEST_36"
       echo "       Learn More: https://devcenter.heroku.com/articles/python-runtimes"
     fi
   fi
-  if [[ $PYTHON_VERSION == $PY35* ]]; then
+  if [[ "$PYTHON_VERSION" == $PY35* ]]; then
     # security update note
-    if [ $PYTHON_VERSION != $LATEST_35 ]; then
-      puts-warn $SECURITY_UPDATE $LATEST_35
+    if [ "$PYTHON_VERSION" != "$LATEST_35" ]; then
+      puts-warn "$SECURITY_UPDATE" "$LATEST_35"
       echo "       Learn More: https://devcenter.heroku.com/articles/python-runtimes"
     fi
   fi
-  if [[ $PYTHON_VERSION == $PY27* ]]; then
+  if [[ "$PYTHON_VERSION" == $PY27* ]]; then
     # security update note
-    if [ $PYTHON_VERSION != $LATEST_27 ]; then
-      puts-warn $SECURITY_UPDATE $LATEST_27
+    if [ "$PYTHON_VERSION" != "$LATEST_27" ]; then
+      puts-warn "$SECURITY_UPDATE" "$LATEST_27"
       echo "       Learn More: https://devcenter.heroku.com/articles/python-runtimes"
     fi
   fi
-- 
GitLab