Skip to content

Commit 224f517

Browse files
dguidoclaude
andauthored
ci: enforce pre-commit formatting hooks in CI (#99)
* ci: enforce pre-commit formatting hooks in CI check-yaml, check-json, end-of-file-fixer, and trailing-whitespace only ran locally via pre-commit. Contributors who skip pre-commit can introduce formatting drift (see #97). Add a CI job using pre-commit/action to enforce these four hooks on every PR. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ci: consolidate lint jobs into single pre-commit pass Run all pre-commit hooks (ruff, shellcheck, shfmt, check-yaml, check-json, end-of-file-fixer, trailing-whitespace) in one job instead of separate CI jobs per tool. Fixes the extra_args error where pre-commit run only accepts one hook ID positionally. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style: fix trailing whitespace and EOF in semgrep-rule-creator Pre-commit hooks caught two files missed by the earlier formatting PR: trailing blank line in quick-reference.md and trailing whitespace plus missing final newline in workflow.md. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9f7f8ad commit 224f517

File tree

3 files changed

+7
-34
lines changed

3 files changed

+7
-34
lines changed

.github/workflows/lint.yml

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,43 +14,17 @@ concurrency:
1414
cancel-in-progress: true
1515

1616
jobs:
17-
ruff:
18-
name: Python (ruff)
17+
pre-commit:
18+
name: Pre-commit
1919
runs-on: ubuntu-latest
2020
steps:
2121
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2222
with:
2323
persist-credentials: false
24-
- uses: astral-sh/ruff-action@4919ec5cf1f49eff0871dbcea0da843445b837e6 # v3.6.1
24+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
2525
with:
26-
args: check --output-format=github
27-
- uses: astral-sh/ruff-action@4919ec5cf1f49eff0871dbcea0da843445b837e6 # v3.6.1
28-
with:
29-
args: format --check
30-
31-
shellcheck:
32-
name: Shell (shellcheck)
33-
runs-on: ubuntu-latest
34-
steps:
35-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
36-
with:
37-
persist-credentials: false
38-
- name: Run shellcheck
39-
run: find plugins -name "*.sh" -type f -exec shellcheck --severity=warning -x {} +
40-
41-
shfmt:
42-
name: Shell (shfmt)
43-
runs-on: ubuntu-latest
44-
steps:
45-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
46-
with:
47-
persist-credentials: false
48-
- name: Install shfmt
49-
run: |
50-
curl -sS https://webinstall.dev/shfmt | bash
51-
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
52-
- name: Run shfmt
53-
run: find plugins -name "*.sh" -type f -exec shfmt -i 2 -ci -d {} +
26+
python-version: "3.13"
27+
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
5428

5529
bats:
5630
name: Shell (bats)

plugins/semgrep-rule-creator/skills/semgrep-rule-creator/references/quick-reference.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,4 +200,3 @@ semgrep -f <rule-id>.yaml <rule-id>.<ext>
200200
2. Add sanitizers for validation functions
201201
3. Use `pattern-inside` to limit scope
202202
4. Use `metavariable-regex` to filter
203-

plugins/semgrep-rule-creator/skills/semgrep-rule-creator/references/workflow.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,6 @@ Run the Semgrep rule you created using: `semgrep --config <rule-id>.yaml <rule-i
235235

236236
Ensure that message:
237237
1. Contains a short and concise explanation of the matched pattern
238-
2. Has no uninterpolated metavariables (e.g., $OP, $VAR). All metavariables referenced in the message must be captured by the pattern so they interpolate to actual code.
238+
2. Has no uninterpolated metavariables (e.g., $OP, $VAR). All metavariables referenced in the message must be captured by the pattern so they interpolate to actual code.
239239

240-
Fix any message issues and re-run that Semgrep rule after each fix.
240+
Fix any message issues and re-run that Semgrep rule after each fix.

0 commit comments

Comments
 (0)