diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8bc4f30721d1d6f6f01daba351ec7c33c5bdef76..5cf891ccb1bf793d852e3546998adb05aecfbadb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,3 +5,10 @@ - id: check-added-large-files - id: check-yaml - id: check-merge-conflict +- repo: https://www.shore.co.il/git/shell-pre-commit/ + sha: v0.5.0 + hooks: + - id: shell-lint + files: shell-lint + - id: shellcheck + files: shell-lint diff --git a/.travis.yml b/.travis.yml index a0f51c1ba311b897dd1f5a8280cd72039e7e9c8b..911a70ab496adc1b13f2c333005d87948a683a49 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,13 @@ cache: - directories: - $HOME/.pre-commit +addons: + apt: + sources: + - sourceline: 'deb http://archive.ubuntu.com/ubuntu trusty-backports main universe multiverse' + packages: + - shellcheck + install: - pip install pre_commit diff --git a/VERSION b/VERSION index 79a2734bbf3de7aaf00e385c644d30704c03c7c8..5d4294b9120c5b004578efa6c4222c7d46106532 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5.0 \ No newline at end of file +0.5.1 \ No newline at end of file diff --git a/hooks.yaml b/hooks.yaml index d97f46b802089e8a8cb808ecc5893282d93b62f7..821dc760e04fbede5465e1dd8ee739bc1e9c7152 100644 --- a/hooks.yaml +++ b/hooks.yaml @@ -2,9 +2,8 @@ - id: shell-lint name: Lint shell scripts description: Run /bin/sh -en against shell scripts. - language: system - entry: /usr/bin/env - args: ['-i', '/bin/sh', '-en'] + language: script + entry: ./shell-lint files: &shell_scripts \.(sh|bash|ksh|zsh)$ - id: shellcheck name: shellcheck diff --git a/shell-lint b/shell-lint new file mode 100755 index 0000000000000000000000000000000000000000..e38501a2ceb21c49f68520761363cd1227432c9d --- /dev/null +++ b/shell-lint @@ -0,0 +1,6 @@ +#!/bin/sh +set -eu +for filename in "$@" +do + /usr/bin/env -i /bin/sh -en "$filename" +done