From 40b6e361350edb793a59fcd0e1cf4e2cca26ddbb Mon Sep 17 00:00:00 2001 From: Christopher Horrell Date: Tue, 26 May 2026 19:26:59 -0400 Subject: [PATCH] chore: add pre-commit hooks Add .pre-commit-config.yaml with the following hooks: - actionlint: lint GitHub Actions workflows - gitleaks: detect secrets and credentials - markdownlint-cli2-docker: lint markdown files - pre-commit-hooks: trailing whitespace, end-of-file fixer, check-yaml, check-json, check-merge-conflict, check-added-large-files, mixed-line-ending - shfmt-docker: format shell scripts - shellcheck: lint shell scripts - zizmor: GitHub Actions security auditing --- .pre-commit-config.yaml | 44 +++++++++++++++++++++++++++++++++++++++++ README.md | 1 - test.json | 2 +- 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..09844cf --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,44 @@ +repos: + - repo: https://github.com/rhysd/actionlint + rev: v1.7.12 + hooks: + - id: actionlint + + - repo: https://github.com/gitleaks/gitleaks + rev: v8.30.1 + hooks: + - id: gitleaks + + - repo: https://github.com/DavidAnson/markdownlint-cli2 + rev: v0.22.1 + hooks: + - id: markdownlint-cli2-docker + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-json + - id: check-merge-conflict + - id: check-added-large-files + - id: mixed-line-ending + + - repo: https://github.com/scop/pre-commit-shfmt + rev: v3.13.1-1 + hooks: + - id: shfmt-docker + args: [-sr, -i, '2', -w, -ci] + files: \.(sh|bats)$ + + - repo: https://github.com/koalaman/shellcheck-precommit + rev: v0.11.0 + hooks: + - id: shellcheck + files: \.(sh|bats)$ + + - repo: https://github.com/woodruffw/zizmor-pre-commit + rev: v1.25.2 + hooks: + - id: zizmor diff --git a/README.md b/README.md index a01e53c..7991072 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,6 @@ And setup an alias like this: alias json='docker run -i --rm chorrell/json:latest' ``` - ## Using the GitHub Container Registry image The lateset version of this image is published to the GitHub Container Registry. You can use it like this: diff --git a/test.json b/test.json index 4782899..07d77e2 100644 --- a/test.json +++ b/test.json @@ -1,4 +1,4 @@ { "name": "Christopher", "value": true -} \ No newline at end of file +}