From 524af2095128e7108bdfc34a78e50888d13c331e Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Fri, 12 May 2017 21:31:43 +0300 Subject: [PATCH] - Corrected issue with shell-lint hook, the hook only checked the first script listed. - Bumped patch version. - Added pre-commit hooks to test the shell-lint script added. --- .pre-commit-config.yaml | 7 +++++++ .travis.yml | 7 +++++++ VERSION | 2 +- hooks.yaml | 5 ++--- shell-lint | 6 ++++++ 5 files changed, 23 insertions(+), 4 deletions(-) create mode 100755 shell-lint diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8bc4f30..5cf891c 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 a0f51c1..911a70a 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 79a2734..5d4294b 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 d97f46b..821dc76 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 0000000..e38501a --- /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 -- GitLab