Merge pull request #74 from paulirish/shellcheck

Add Shellcheck to CI tests
This commit is contained in:
Paul Irish 2017-05-29 12:47:11 -07:00 committed by GitHub
commit abd822a486
3 changed files with 15 additions and 7 deletions

View file

@ -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

View file

@ -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

View file

@ -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"