Skip to content

Comments

Add standardized linting workflow and config#53

Merged
C-Achard merged 2 commits intocy/pre-release-fixes-2.0from
cy/lint-config
Feb 20, 2026
Merged

Add standardized linting workflow and config#53
C-Achard merged 2 commits intocy/pre-release-fixes-2.0from
cy/lint-config

Conversation

@C-Achard
Copy link

Standardized formatting

Updates the pre-commit workflow and configuration to ensure only changed files in a pull request are checked.
Introduces a clear separation between local autofix hooks and CI check-only hooks.
Updated hooks versions.

NOTE : Since pre-commit hooks were actively used in #38 no particular "Apply lint" PR is required as of now.


Workflow improvements:

  • The .github/workflows/format.yml workflow now detects changed files in a pull request and only runs pre-commit checks on those files, reducing unnecessary work and speeding up CI.
  • The workflow uses updated versions of actions/checkout and actions/setup-python, and now runs on Python 3.12.

Pre-commit configuration enhancements:

  • The .pre-commit-config.yaml file now clearly separates hooks that can autofix files (run locally) from those that only check (run in CI), using the stages field to control when each hook runs.
  • Adds new CI-only (manual stage) hooks for ruff-check and ruff-format, ensuring that CI checks do not modify files but only report issues.
  • Adds or updates hooks for checking merge conflicts, YAML, TOML, and pyproject validation, specifying their appropriate stages for local and CI runs.

Add default_stages and explicitly assign stages to hooks, separating local mutating hooks from CI-only checks. Configure check-* hooks (check-added-large-files, check-yaml, check-toml, check-merge-conflict) to run in pre-commit and manual where appropriate; mark end-of-file-fixer, trailing-whitespace and pyproject-fmt as local-only. Add validate-pyproject to pre-commit/manual. Rework ruff hooks into distinct local autofix entries (ruff-check with --fix/--unsafe-fixes and ruff-format write) and CI check-only entries (named ruff-check (ci) and ruff-format (ci) with non-writing args). Remove the prior name-tests-test entry and add clarifying comments and names for maintainability.
Switch workflow to run pre-commit only for pull requests and only on files changed in the PR. Adds a detect_changes job to fetch the base ref and output changed file list, then a conditional precommit job that runs only when there are changed files. Updates checkout and setup actions (actions/checkout@v4, setup-python@v5), bumps Python to 3.12, installs pre-commit, and runs pre-commit in a CI check-only mode on the changed files to speed up CI and avoid running on the whole repo.
@C-Achard C-Achard self-assigned this Feb 20, 2026
@C-Achard C-Achard added the CI Related to CI, tests, workflows... label Feb 20, 2026
@C-Achard C-Achard requested a review from deruyter92 February 20, 2026 10:03
Copy link

@deruyter92 deruyter92 left a comment

Choose a reason for hiding this comment

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

Great!!

@C-Achard C-Achard merged commit 490cd28 into cy/pre-release-fixes-2.0 Feb 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Related to CI, tests, workflows...

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants