From d63ed2398c6c014feba5b7e7ebd55e134eb93a91 Mon Sep 17 00:00:00 2001 From: Wu Zhenyu Date: Sat, 10 Feb 2024 23:59:51 +0800 Subject: [PATCH] Fix #2909, add a pre-commit hook --- .pre-commit-hooks.yaml | 13 +++++++++++++ README.md | 11 +++++++++++ 2 files changed, 24 insertions(+) create mode 100644 .pre-commit-hooks.yaml diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100644 index 0000000..9b1d047 --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,13 @@ +--- +- id: shellcheck + name: ShellCheck v0.9.0 + description: Static analysis tool for shell scripts + language: haskell + # https://pre-commit.com/#haskell + minimum_pre_commit_version: 3.4.0 + entry: shellcheck + types: + - shell + # https://github.com/koalaman/shellcheck/issues/809 + exclude_types: + - zsh diff --git a/README.md b/README.md index 6542ac2..6ba1918 100644 --- a/README.md +++ b/README.md @@ -262,6 +262,17 @@ repos: # args: ["--severity=warning"] # Optionally only show errors and warnings ``` +Or (pre-commit version > 3.4.0) + +```yaml +repos: +- repo: https://github.com/koalaman/shellcheck + rev: v0.7.2 + hooks: + - id: shellcheck +# args: ["--severity=warning"] # Optionally only show errors and warnings +``` + ### Travis CI Travis CI has now integrated ShellCheck by default, so you don't need to manually install it.