]> git.immae.eu Git - github/fretlink/terraform-provider-mailgun.git/commitdiff
add shellcheck to the makeffile and .travis.yml and fix the scripts to have no error...
authorAlexandre Garand <alexandre.garand@fretlink.com>
Fri, 5 Jul 2019 12:02:37 +0000 (14:02 +0200)
committerAlexandre Garand <alexandre.garand@fretlink.com>
Fri, 5 Jul 2019 12:02:37 +0000 (14:02 +0200)
.travis.yml
GNUmakefile
scripts/changelog-links.sh
scripts/errcheck.sh
scripts/gofmtcheck.sh
scripts/gogetcookie.sh

index 82f7e2550aebafff4fb214008cf0406ed5575115..72fe3c79e7fda4f5e5a24b63610b4e934063dadb 100644 (file)
@@ -18,6 +18,7 @@ script:
 - make test
 - make vet
 - make website-test
+- make shellcheck
 
 matrix:
   fast_finish: true
index f5f0c29c086397a8a03abf23f73aee201a5826a6..7750632f454dedd1a34e6168376d583c1e160a68 100644 (file)
@@ -25,6 +25,9 @@ vet:
                exit 1; \
        fi
 
+shellcheck:
+       shellcheck scripts/*
+
 fmt:
        gofmt -w $(GOFMT_FILES)
 
index 303341b24b767e0786d892f20126181e00df5465..83e918ea9a6cfd1bd70d5ed839b853abbf46cc71 100755 (executable)
 set -e
 
 if [[ ! -f CHANGELOG.md ]]; then
-  echo "ERROR: CHANGELOG.md not found in pwd."
-  echo "Please run this from the root of the terraform provider repository"
-  exit 1
+    echo "ERROR: CHANGELOG.md not found in pwd."
+    echo "Please run this from the root of the terraform provider repository"
+    exit 1
 fi
 
-if [[ `uname` == "Darwin" ]]; then
-  echo "Using BSD sed"
-  SED="sed -i.bak -E -e"
+if [[ $(uname) == "Darwin" ]]; then
+    echo "Using BSD sed"
+    SED="sed -i.bak -E -e"
 else
-  echo "Using GNU sed"
-  SED="sed -i.bak -r -e"
+    echo "Using GNU sed"
+    SED="sed -i.bak -r -e"
 fi
 
-PROVIDER_URL="https:\/\/github.com\/terraform-providers\/terraform-provider-statuscake\/issues"
+PROVIDER_URL="https:\\/\\/github.com\\/terraform-providers\\/terraform-provider-statuscake\\/issues"
 
-$SED "s/GH-([0-9]+)/\[#\1\]\($PROVIDER_URL\/\1\)/g" -e 's/\[\[#(.+)([0-9])\)]$/(\[#\1\2))/g' CHANGELOG.md
+$SED "s/GH-([0-9]+)/\\[#\\1\\]\\($PROVIDER_URL\\/\\1\\)/g" -e 's/\[\[#(.+)([0-9])\)]$/(\[#\1\2))/g' CHANGELOG.md
 
 rm CHANGELOG.md.bak
index 15464f5aa37fe72928e8b56b2186680784e3781d..ebcc7b3edcf2d5def2324439feec4d4cc73c1673 100755 (executable)
@@ -3,7 +3,7 @@
 # Check gofmt
 echo "==> Checking for unchecked errors..."
 
-if ! which errcheck > /dev/null; then
+if ! command -v errcheck > /dev/null; then
     echo "==> Installing errcheck..."
     go get -u github.com/kisielk/errcheck
 fi
@@ -12,7 +12,7 @@ err_files=$(errcheck -ignoretests \
                      -ignore 'github.com/hashicorp/terraform/helper/schema:Set' \
                      -ignore 'bytes:.*' \
                      -ignore 'io:Close|Write' \
-                     $(go list ./...| grep -v /vendor/))
+                     "$(go list ./...| grep -v /vendor/)")
 
 if [[ -n ${err_files} ]]; then
     echo 'Unchecked errors found in the following places:'
index 1c055815f8db82af8d0f7893c448dafdd7b86cf8..3856e52ea0e32d4d8e5148cbdc04d0d7eb0b43c1 100755 (executable)
@@ -2,7 +2,7 @@
 
 # Check gofmt
 echo "==> Checking that code complies with gofmt requirements..."
-gofmt_files=$(gofmt -l `find . -name '*.go' | grep -v vendor`)
+gofmt_files=$(gofmt -l "$(find . -name '*.go' | grep -v vendor)")
 if [[ -n ${gofmt_files} ]]; then
     echo 'gofmt needs running on the following files:'
     echo "${gofmt_files}"
index 37955fc67cfcb52b5f0c058678942d624f2046b4..5ab7e93f1e57cba4cbbf5470b964741d5a3fb563 100755 (executable)
@@ -1,9 +1,10 @@
 #!/bin/bash
 
- touch ~/.gitcookies
- chmod 0600 ~/.gitcookies
+touch ~/.gitcookies
+chmod 0600 ~/.gitcookies
 
- git config --global http.cookiefile ~/.gitcookies
+git config --global http.cookiefile ~/.gitcookies
 
- tr , \\t <<\__END__ >>~/.gitcookies
+tr , \\t <<\__END__ >>~/.gitcookies
 .googlesource.com,TRUE,/,TRUE,2147483647,o,git-alexandre.namebla.gmail.com=1/OtfvUDYg3VAHfIxaqjAuv8MJqu6--gSU_zSkD8YkKPc
+__END__