aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAlexandre Garand <alexandre.garand@fretlink.com>2019-07-05 14:02:37 +0200
committerAlexandre Garand <alexandre.garand@fretlink.com>2019-07-05 14:02:37 +0200
commit065bf5d75bfd81d439ea42434463f796128d08f1 (patch)
tree975abfb432c663ba1faedb5b335b216fd0856f1a
parent8806bd74ef1d8ca63af0b764e46990cbee8ce546 (diff)
downloadterraform-provider-mailgun-065bf5d75bfd81d439ea42434463f796128d08f1.tar.gz
terraform-provider-mailgun-065bf5d75bfd81d439ea42434463f796128d08f1.tar.zst
terraform-provider-mailgun-065bf5d75bfd81d439ea42434463f796128d08f1.zip
add shellcheck to the makeffile and .travis.yml and fix the scripts to have no error with it
-rw-r--r--.travis.yml1
-rw-r--r--GNUmakefile3
-rwxr-xr-xscripts/changelog-links.sh20
-rwxr-xr-xscripts/errcheck.sh4
-rwxr-xr-xscripts/gofmtcheck.sh2
-rwxr-xr-xscripts/gogetcookie.sh9
6 files changed, 22 insertions, 17 deletions
diff --git a/.travis.yml b/.travis.yml
index 82f7e25..72fe3c7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -18,6 +18,7 @@ script:
18- make test 18- make test
19- make vet 19- make vet
20- make website-test 20- make website-test
21- make shellcheck
21 22
22matrix: 23matrix:
23 fast_finish: true 24 fast_finish: true
diff --git a/GNUmakefile b/GNUmakefile
index f5f0c29..7750632 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -25,6 +25,9 @@ vet:
25 exit 1; \ 25 exit 1; \
26 fi 26 fi
27 27
28shellcheck:
29 shellcheck scripts/*
30
28fmt: 31fmt:
29 gofmt -w $(GOFMT_FILES) 32 gofmt -w $(GOFMT_FILES)
30 33
diff --git a/scripts/changelog-links.sh b/scripts/changelog-links.sh
index 303341b..83e918e 100755
--- a/scripts/changelog-links.sh
+++ b/scripts/changelog-links.sh
@@ -11,21 +11,21 @@
11set -e 11set -e
12 12
13if [[ ! -f CHANGELOG.md ]]; then 13if [[ ! -f CHANGELOG.md ]]; then
14 echo "ERROR: CHANGELOG.md not found in pwd." 14 echo "ERROR: CHANGELOG.md not found in pwd."
15 echo "Please run this from the root of the terraform provider repository" 15 echo "Please run this from the root of the terraform provider repository"
16 exit 1 16 exit 1
17fi 17fi
18 18
19if [[ `uname` == "Darwin" ]]; then 19if [[ $(uname) == "Darwin" ]]; then
20 echo "Using BSD sed" 20 echo "Using BSD sed"
21 SED="sed -i.bak -E -e" 21 SED="sed -i.bak -E -e"
22else 22else
23 echo "Using GNU sed" 23 echo "Using GNU sed"
24 SED="sed -i.bak -r -e" 24 SED="sed -i.bak -r -e"
25fi 25fi
26 26
27PROVIDER_URL="https:\/\/github.com\/terraform-providers\/terraform-provider-statuscake\/issues" 27PROVIDER_URL="https:\\/\\/github.com\\/terraform-providers\\/terraform-provider-statuscake\\/issues"
28 28
29$SED "s/GH-([0-9]+)/\[#\1\]\($PROVIDER_URL\/\1\)/g" -e 's/\[\[#(.+)([0-9])\)]$/(\[#\1\2))/g' CHANGELOG.md 29$SED "s/GH-([0-9]+)/\\[#\\1\\]\\($PROVIDER_URL\\/\\1\\)/g" -e 's/\[\[#(.+)([0-9])\)]$/(\[#\1\2))/g' CHANGELOG.md
30 30
31rm CHANGELOG.md.bak 31rm CHANGELOG.md.bak
diff --git a/scripts/errcheck.sh b/scripts/errcheck.sh
index 15464f5..ebcc7b3 100755
--- a/scripts/errcheck.sh
+++ b/scripts/errcheck.sh
@@ -3,7 +3,7 @@
3# Check gofmt 3# Check gofmt
4echo "==> Checking for unchecked errors..." 4echo "==> Checking for unchecked errors..."
5 5
6if ! which errcheck > /dev/null; then 6if ! command -v errcheck > /dev/null; then
7 echo "==> Installing errcheck..." 7 echo "==> Installing errcheck..."
8 go get -u github.com/kisielk/errcheck 8 go get -u github.com/kisielk/errcheck
9fi 9fi
@@ -12,7 +12,7 @@ err_files=$(errcheck -ignoretests \
12 -ignore 'github.com/hashicorp/terraform/helper/schema:Set' \ 12 -ignore 'github.com/hashicorp/terraform/helper/schema:Set' \
13 -ignore 'bytes:.*' \ 13 -ignore 'bytes:.*' \
14 -ignore 'io:Close|Write' \ 14 -ignore 'io:Close|Write' \
15 $(go list ./...| grep -v /vendor/)) 15 "$(go list ./...| grep -v /vendor/)")
16 16
17if [[ -n ${err_files} ]]; then 17if [[ -n ${err_files} ]]; then
18 echo 'Unchecked errors found in the following places:' 18 echo 'Unchecked errors found in the following places:'
diff --git a/scripts/gofmtcheck.sh b/scripts/gofmtcheck.sh
index 1c05581..3856e52 100755
--- a/scripts/gofmtcheck.sh
+++ b/scripts/gofmtcheck.sh
@@ -2,7 +2,7 @@
2 2
3# Check gofmt 3# Check gofmt
4echo "==> Checking that code complies with gofmt requirements..." 4echo "==> Checking that code complies with gofmt requirements..."
5gofmt_files=$(gofmt -l `find . -name '*.go' | grep -v vendor`) 5gofmt_files=$(gofmt -l "$(find . -name '*.go' | grep -v vendor)")
6if [[ -n ${gofmt_files} ]]; then 6if [[ -n ${gofmt_files} ]]; then
7 echo 'gofmt needs running on the following files:' 7 echo 'gofmt needs running on the following files:'
8 echo "${gofmt_files}" 8 echo "${gofmt_files}"
diff --git a/scripts/gogetcookie.sh b/scripts/gogetcookie.sh
index 37955fc..5ab7e93 100755
--- a/scripts/gogetcookie.sh
+++ b/scripts/gogetcookie.sh
@@ -1,9 +1,10 @@
1#!/bin/bash 1#!/bin/bash
2 2
3 touch ~/.gitcookies 3touch ~/.gitcookies
4 chmod 0600 ~/.gitcookies 4chmod 0600 ~/.gitcookies
5 5
6 git config --global http.cookiefile ~/.gitcookies 6git config --global http.cookiefile ~/.gitcookies
7 7
8 tr , \\t <<\__END__ >>~/.gitcookies 8tr , \\t <<\__END__ >>~/.gitcookies
9.googlesource.com,TRUE,/,TRUE,2147483647,o,git-alexandre.namebla.gmail.com=1/OtfvUDYg3VAHfIxaqjAuv8MJqu6--gSU_zSkD8YkKPc 9.googlesource.com,TRUE,/,TRUE,2147483647,o,git-alexandre.namebla.gmail.com=1/OtfvUDYg3VAHfIxaqjAuv8MJqu6--gSU_zSkD8YkKPc
10__END__