Sitelet https://github.com/TheAlgorithms/Python/pull/15745
Skip to content

ci: use pinned Ruff pre-commit hook in lint workflow - #15745

Open
matheusrodrigues2006 wants to merge 1 commit into
TheAlgorithms:masterfrom
matheusrodrigues2006:fix/ruff-version-parity-ci
Open

matheusrodrigues2006 wants to merge 1 commit into
TheAlgorithms:masterfrom
matheusrodrigues2006:fix/ruff-version-parity-ci

Conversation

@matheusrodrigues2006

Copy link
Copy Markdown

Describe your change

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Add or change doctests?
  • Documentation change?
  • Improve CI tooling: run the same pinned Ruff hook as local contributors.

Summary

The Ruff workflow previously used uvx ruff check --output-format=github ., which resolves Ruff independently from the ruff-pre-commit revision in .pre-commit-config.yaml (currently v0.17.3). That can result in different Ruff versions in local checks and GitHub Actions.

The workflow now runs:

uvx pre-commit run ruff-check --all-files

This reuses the existing pinned hook without duplicating its version in the workflow. The change touches only .github/workflows/ruff.yml and preserves the original triggers, checkout configuration and lint rules. It does not add Zizmor, which is already proposed in #15713, or claim to resolve every part of issue #15696.

Verification

  • Updated YAML parsed successfully.
  • The master push and pull-request triggers remained unchanged.
  • The actions/checkout and astral-sh/setup-uv steps remained unchanged.
  • The ruff-check hook exists in .pre-commit-config.yaml and uses pinned ruff-pre-commit@v0.17.3.
  • The pre-commit executable could not be run in the offline preparation environment; its package was not cached. The GitHub Actions run is therefore still required.

Trade-off: This loses Ruff's direct GitHub annotations (--output-format=github) and instead uses the normal pre-commit log output. If maintainers prefer the annotations, the version can alternatively be pinned explicitly to match the pre-commit hook, at the cost of keeping two pins synchronized.

Checklist

  • I have read CONTRIBUTING.md.
  • I understand the PR must pass required automated checks before it can be merged.
  • This changes CI configuration only; it adds no algorithm files or doctests.

Refs #15696

@algorithms-keeper algorithms-keeper Bot added awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files labels Nov 13, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant