From 33f34fa516398ee759a12b6e0468d04788487125 Mon Sep 17 00:00:00 2001 From: Paul Irish Date: Mon, 29 May 2017 12:37:17 -0700 Subject: [PATCH 1/2] run shellcheck in CI --- .travis.yml | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3312495..0a708fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,11 @@ language: node_js node_js: "node" +addons: + apt: + sources: + - debian-sid # Grab ShellCheck from the Debian repo + packages: + - shellcheck cache: directories: - node_modules @@ -9,4 +15,6 @@ script: - npm run lint:package - npm run lint:readme - npm run lint:editorconfig + - shellcheck git-open + diff --git a/package.json b/package.json index 55670f1..d179701 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "git-home": "git-open" }, "scripts": { - "lint:editorconfig": "eclint check git-open* readme*", + "lint:editorconfig": "eclint check git-open* readme* .travis.yml", "lint:package": "pjv --recommendations --warnings", "lint:readme": "node ./node_modules/markdownlint/lib/markdownlint.js --config markdownlint.json README.md", "test": "npm run lint:package && npm run lint:readme && npm run lint:editorconfig" From 92dc862c02a087cf16d1db835eadd484e22343eb Mon Sep 17 00:00:00 2001 From: Paul Irish Date: Mon, 29 May 2017 12:41:01 -0700 Subject: [PATCH 2/2] correct shellcheck issues. --- git-open | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/git-open b/git-open index a8f14f6..b5c32b2 100755 --- a/git-open +++ b/git-open @@ -55,12 +55,12 @@ branch=${branch//%/%25} && branch=${branch//#/%23} # URL normalization # GitHub gists -if grep -q gist.github <<<$giturl; then +if grep -q gist.github <<<"$giturl"; then giturl=${giturl/git\@gist.github\.com\:/https://gist.github.com/} providerUrlDifference=tree # GitHub -elif grep -q github <<<$giturl; then +elif grep -q github <<<"$giturl"; then giturl=${giturl/git\@github\.com\:/https://github.com/} # handle SSH protocol (links like ssh://git@github.com/user/repo) @@ -69,7 +69,7 @@ elif grep -q github <<<$giturl; then providerUrlDifference=tree # Bitbucket -elif grep -q bitbucket <<<$giturl; then +elif grep -q bitbucket <<<"$giturl"; then giturl=${giturl/git\@bitbucket\.org\:/https://bitbucket.org/} # handle SSH protocol (change ssh://https://bitbucket.org/user/repo to https://bitbucket.org/user/repo) giturl=${giturl/#ssh\:\/\/git\@/https://} @@ -83,7 +83,7 @@ elif grep -q bitbucket <<<$giturl; then branch="?at=${branch}" # Atlassian Bitbucket Server -elif grep -q "/scm/" <<<$giturl; then +elif grep -q "/scm/" <<<"$giturl"; then re='(.*)/scm/(.*)/(.*)\.git' if [[ $giturl =~ $re ]]; then giturl=${BASH_REMATCH[1]}/projects/${BASH_REMATCH[2]}/repos/${BASH_REMATCH[3]} @@ -105,7 +105,7 @@ else fi if [ -n "$gitlab_domain" ]; then - if egrep -q "${gitlab_domain}|${gitlab_ssh_domain}" <<<$giturl; then + if egrep -q "${gitlab_domain}|${gitlab_ssh_domain}" <<<"$giturl"; then # Handle GitLab's default SSH notation (like git@gitlab.domain.com:user/repo) giturl=${giturl/git\@${gitlab_ssh_domain}\:/${gitlab_protocol}://${gitlab_domain}/} @@ -123,7 +123,7 @@ if [ -n "$gitlab_domain" ]; then providerUrlDifference=tree fi # hosted GitLab - elif grep -q gitlab <<<$giturl; then + elif grep -q gitlab <<<"$giturl"; then giturl=${giturl/git\@gitlab\.com\:/https://gitlab.com/} providerUrlDifference=tree fi