From 8687e0d97262dea7545095c0baf2d46a622b63ba Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Tue, 31 Oct 2017 23:26:32 +0200 Subject: [PATCH] - Updated pre-commit hooks versions. - Use types instead of files regex, set minimal version of pre-commit to 0.15.0 accordingly. - Now that the minimum version of pre-commit is 0.15.0, remove legacy hooks.yaml file. - Updated README. - Bumped minore version. --- .pre-commit-config.yaml | 5 +++-- .pre-commit-hooks.yaml | 17 ++++++++++++++++- README.rst | 22 +++++++++++++++------- VERSION | 2 +- hooks.yaml | 14 -------------- 5 files changed, 35 insertions(+), 25 deletions(-) mode change 120000 => 100644 .pre-commit-hooks.yaml delete mode 100644 hooks.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3ff2e35..ab7f371 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,7 @@ --- -- repo: git://github.com/pre-commit/pre-commit-hooks - sha: v0.7.1 +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + sha: v1.1.1 hooks: - id: check-added-large-files - id: check-yaml diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml deleted file mode 120000 index 4641bf3..0000000 --- a/.pre-commit-hooks.yaml +++ /dev/null @@ -1 +0,0 @@ -hooks.yaml \ No newline at end of file diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100644 index 0000000..7786864 --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,16 @@ +--- +- id: shell-lint + name: Lint shell scripts + description: Run /bin/sh -en against shell scripts. + language: script + entry: ./shell-lint + types: [shell] + minimum_pre_commit_version: 0.15.0 # Because of types. +- id: shellcheck + name: shellcheck + description: A shell script static analysis tool + language: system + entry: shellcheck + args: ['--external-sources'] + types: [shell] + minimum_pre_commit_version: 0.15.0 # Because of types. diff --git a/README.rst b/README.rst index 4ad9308..7b16d98 100644 --- a/README.rst +++ b/README.rst @@ -1,17 +1,25 @@ -Shell lint pre-commit hook -########################## +Shell pre-commit hooks +###################### .. image:: https://travis-ci.org/adarnimrod/shell-pre-commit.svg?branch=master :target: https://travis-ci.org/adarnimrod/shell-pre-commit -Shell lint `pre-commit <http://pre-commit.com/>`_ hook. The hook runs -:code:`/bin/sh -en` against found shell scripts. +Shell `pre-commit <http://pre-commit.com/>`_ hooks. + +Hooks +----- + +- :code: `shell-lint` - Runs :code:`/bin/sh -en` against identified shell + scripts. +- :code: `shellcheck` - Runs `shellcheck + <https://github.com/koalaman/shellcheck/>`_ agains identified shell scripts. Dependencies ------------ -- :code:`/bin/sh` -- Pre-commit +- :code: `/bin/sh` +- :code: `shellcheck` +- Pre-commit 0.15.0 or later. Installation ------------ @@ -21,7 +29,7 @@ Add the following to your :code:`.pre-commit-config.yaml`: .. code:: yaml - repo: https://www.shore.co.il/git/shell-pre-commit/ - sha: v0.4.0 + sha: v0.6.0 hooks: - id: shell-lint - id: shellcheck diff --git a/VERSION b/VERSION index 167b000..09a3acf 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5.4 \ No newline at end of file +0.6.0 \ No newline at end of file diff --git a/hooks.yaml b/hooks.yaml deleted file mode 100644 index 74771c9..0000000 --- a/hooks.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -- id: shell-lint - name: Lint shell scripts - description: Run /bin/sh -en against shell scripts. - language: script - entry: ./shell-lint - files: &shell_scripts \.(sh|bash|ksh|zsh)$ -- id: shellcheck - name: shellcheck - description: A shell script static analysis tool - language: system - entry: shellcheck - args: ['--external-sources'] - files: *shell_scripts -- GitLab