Fix #2909, add a pre-commit hook

This commit is contained in:
Wu Zhenyu 2024-02-10 23:59:51 +08:00
commit d63ed2398c
No known key found for this signature in database
GPG key ID: 0E07E1F8C0EC10AD
2 changed files with 24 additions and 0 deletions

13
.pre-commit-hooks.yaml Normal file
View file

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

View file

@ -262,6 +262,17 @@ repos:
# args: ["--severity=warning"] # Optionally only show errors and warnings # 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
Travis CI has now integrated ShellCheck by default, so you don't need to manually install it. Travis CI has now integrated ShellCheck by default, so you don't need to manually install it.