From 557f573df2bf40adb83e5a0f6f76eee76f495d08 Mon Sep 17 00:00:00 2001 From: Defame1297 Date: Sat, 14 Nov 2026 13:20:06 +0000 Subject: [PATCH] ci(lint): add ruff and shellcheck hooks Add ruff-check and ruff-format from astral-sh/ruff-pre-commit and shellcheck from shellcheck-py, with ruff.toml at ruff's defaults plus C901, PLR0912 and PLR0915 (#112). ruff.toml is repository tooling, so it joins galaxy.yml build_ignore. The existing scripts are formatted and fixed in the commits that follow. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_014uGZTNmHMc85bomfevwUDG --- .pre-commit-config.yaml | 18 ++++++++++++++++++ galaxy.yml | 1 + ruff.toml | 7 +++++++ 3 files changed, 26 insertions(+) create mode 100644 ruff.toml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f32dc6a..c805a24 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,6 +20,24 @@ repos: args: [--strict] stages: ['pre-commit'] + # Python and shell scripts under scripts/ and tests/scripts/ (#112). ruff.toml holds the + # configuration. No --fix: a finding fails the hook instead of rewriting files in CI. + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.17.5 + hooks: + - id: ruff-check + stages: ['pre-commit'] + - id: ruff-format + stages: ['pre-commit'] + + # shellcheck-py ships the shellcheck binary as a wheel, so no system package is needed. + # Default severity, no .shellcheckrc. actionlint (below) covers the run: blocks of workflows. + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.11.0.1 + hooks: + - id: shellcheck + stages: ['pre-commit'] + - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: diff --git a/galaxy.yml b/galaxy.yml index 10f4e60..2f28407 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -49,6 +49,7 @@ build_ignore: - scripts - tests/scripts - renovate.json + - ruff.toml - requirements-dev.txt - gitleaks-report.json - importer_result.json diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 0000000..b3509be --- /dev/null +++ b/ruff.toml @@ -0,0 +1,7 @@ +# Ruff configuration for the Python under scripts/ and tests/scripts/ (#112). +# Ruff's defaults (pycodestyle E4/E7/E9 and pyflakes F) plus the complexity and function-size +# rules, all at their default thresholds. Do not tune a threshold or ignore a rule globally: +# suppress a finding inline with its rule code and a reason. + +[lint] +extend-select = ["C901", "PLR0912", "PLR0915"]