Skip to content

Pre commit hooks#73

Merged
miguelgfierro merged 4 commits into
mainfrom
chore/pre-commit-hooks
Apr 27, 2026
Merged

Pre commit hooks#73
miguelgfierro merged 4 commits into
mainfrom
chore/pre-commit-hooks

Conversation

@miguelgfierro
Copy link
Copy Markdown
Contributor

Summary

Add pre commit hooks

Changes

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/CD changes

Checklist

  • My code follows the project coding standards
  • I have added or updated tests that prove my fix or feature works
  • mvn verify passes locally with no new warnings
  • I have updated documentation where needed
  • New files include the Apache 2.0 license header
  • No new compiler or linter warnings are introduced

Configures pre-commit with ruff (lint + format), file hygiene checks
(trailing whitespace, EOF, yaml/toml/json validation, merge conflicts,
large files, AST), gitleaks for secret scanning, and a guard against
direct commits to main/master.

Adds pre-commit to the dev extras so contributors can install via
`uv sync --extra dev && uv run pre-commit install`.
Comment thread .pre-commit-config.yaml
args: [--maxkb=500]
- id: check-ast
- id: no-commit-to-branch
args: [--branch, main, --branch, master]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

podriamos poner esto en los CI checks también por si alguien se salta el pre-commit hook?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • name: Run pre-commit on all files
    run: pre-commit run --all-files

Catches violations when contributors bypass the local hook with
--no-verify. Uses the same .pre-commit-config.yaml as the local
install so there's no duplication.
Comment thread .github/workflows/ci.yml Fixed
- Bump ruff-pre-commit to v0.15.12 to match the local ruff version,
  fixing 'Unknown rule selector: UP046' from the v0.9.0 pin.
- Exclude bundled frontend dist directories (studio-desktop/frontend-dist
  and studio/static) from all hooks — they're build outputs, not source.
- Exclude tsconfig*.json from check-json: tsconfig uses JSONC (comments,
  trailing commas).
- Switch CI step to plain 'pre-commit run --all-files' instead of the
  pre-commit/action wrapper for transparency.
@miguelgfierro miguelgfierro merged commit b72280f into main Apr 27, 2026
13 checks passed
@miguelgfierro miguelgfierro deleted the chore/pre-commit-hooks branch April 27, 2026 14:59
ancongui pushed a commit that referenced this pull request May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants