From 101d14b766fa14aa9f8c0a6bc4c73d5249bb84be Mon Sep 17 00:00:00 2001 From: Liam Keegan Date: Fri, 3 May 2024 10:07:46 +0200 Subject: [PATCH] replace `beautysh` with `shell-fmt-go` - beautysh hasn't been updated for a few years and doesn't work with Python 3.12 - shfmt tool is widely used & actively maintained: https://pkg.go.dev/mvdan.cc/sh/v3#readme-shfmt - add `shell` tag as identify doesn't check shebang if it can guess the tag from the extension, so bash scripts with .sh extension are always tagged `shell` and not `bash` --- .pre-commit-config.yaml | 6 +++--- precommend/.pre-commit-config.yaml | 6 +++--- precommend/rules.py | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 295b0da..c2db411 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -81,10 +81,10 @@ repos: hooks: - id: validate-cff # Validate CFF format - - repo: https://github.com/lovesegfault/beautysh - rev: v6.2.1 + - repo: https://github.com/pecigonzalo/pre-commit-shfmt + rev: v2.2.0 hooks: - - id: beautysh # Beautify Bash scripts + - id: shell-fmt-go # Format Bash scripts - repo: https://github.com/abravalheri/validate-pyproject rev: v0.16 diff --git a/precommend/.pre-commit-config.yaml b/precommend/.pre-commit-config.yaml index 295b0da..c2db411 100644 --- a/precommend/.pre-commit-config.yaml +++ b/precommend/.pre-commit-config.yaml @@ -81,10 +81,10 @@ repos: hooks: - id: validate-cff # Validate CFF format - - repo: https://github.com/lovesegfault/beautysh - rev: v6.2.1 + - repo: https://github.com/pecigonzalo/pre-commit-shfmt + rev: v2.2.0 hooks: - - id: beautysh # Beautify Bash scripts + - id: shell-fmt-go # Format Bash scripts - repo: https://github.com/abravalheri/validate-pyproject rev: v0.16 diff --git a/precommend/rules.py b/precommend/rules.py index 311ea14..fb61dfe 100644 --- a/precommend/rules.py +++ b/precommend/rules.py @@ -14,9 +14,9 @@ def actionlint(ctx): @rule -def beautysh(ctx): - if ctx.tag_exists("bash"): - return "beautysh" +def shell_fmt_go(ctx): + if ctx.tag_exists("shell") or ctx.tag_exists("bash"): + return "shell-fmt-go" @rule