Add Ruff, pre-commit hooks, and incremental lint checks in CI#325
Add Ruff, pre-commit hooks, and incremental lint checks in CI#325QuanCheng-QC wants to merge 1 commit intodevelopfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
JiwaniZakir
left a comment
There was a problem hiding this comment.
The CI lint job installs ruff without a version pin (pip install ruff), while .pre-commit-config.yaml pins rev: v0.6.9. This means CI could run a newer Ruff version that rejects code the pre-commit hook accepts (or vice versa), creating inconsistent feedback between local dev and CI. Consider installing via pip install "ruff==0.6.9" or deriving the version from pyproject.toml (e.g., pip install -e ".[dev]" filtered to just ruff).
The workflow_dispatch event is listed in the on: trigger at the top of the file, but the "Collect changed Python files" step falls through to the else branch and silently exits with has_python=false, meaning manually-triggered linting is a no-op. That's likely unintentional — a workflow_dispatch run should probably lint all Python files or at least warn that it's unsupported.
The checkout uses fetch-depth: 0 (full history), but for the PR case immediately follows with git fetch --no-tags --prune --depth=1 origin "$base_ref", which only needs the tip of the base branch. A shallow clone (fetch-depth: 1) at checkout with an explicit deepen for the merge-base would be faster on repos with long history.
Summary
This PR introduces a minimal Ruff-based quality gate for the Python codebase.
Changes
blackandflake8indevextras withruffpyproject.toml.pre-commit-config.yamlwithruff-checkandruff-formatlintjob topytest.ymlCI behavior
Scope
This PR intentionally does not:
Fixes [DX] Add Python code formatting & linting infrastructure (ruff, pre-commit, CI) #318