mirror of
https://github.com/ovh/debian-cis.git
synced 2025-07-31 12:36:34 +02:00
feat: add some precommit (#274)
- ensure correct formatting with shfmt - ensure correct syntax with shellcheck Co-authored-by: damien cavagnini <damien.cavagnini@corp.ovh.com>
This commit is contained in:
@@ -8,3 +8,17 @@ repos:
|
||||
language: script
|
||||
pass_filenames: true
|
||||
files: "^bin/hardening/"
|
||||
- id: shfmt
|
||||
name: shfmt.sh
|
||||
description: Ensure correct formatting
|
||||
entry: hooks/shfmt.sh
|
||||
language: script
|
||||
pass_filenames: true
|
||||
files: "^(bin|tests)/hardening/"
|
||||
- id: shellcheck
|
||||
name: shellcheck.sh
|
||||
description: Ensure correct syntax
|
||||
entry: hooks/shellcheck.sh
|
||||
language: script
|
||||
pass_filenames: true
|
||||
files: "^(bin|tests)/hardening/"
|
||||
|
7
hooks/shellcheck.sh
Executable file
7
hooks/shellcheck.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
for script in "$@"; do
|
||||
/usr/bin/shellcheck --exclude=SC2317 --color=always --shell=bash -x --source-path=SCRIPTDIR "$script"
|
||||
done
|
||||
|
||||
exit 0
|
7
hooks/shfmt.sh
Executable file
7
hooks/shfmt.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
for script in "$@"; do
|
||||
shfmt -l -i 4 -w "$script"
|
||||
done
|
||||
|
||||
exit 0
|
Reference in New Issue
Block a user