Skip to content

Add Ruff, pre-commit hooks, and incremental lint checks in CI#325

Open
QuanCheng-QC wants to merge 1 commit intodevelopfrom
issuefix/add-ruff-quality-gates
Open

Add Ruff, pre-commit hooks, and incremental lint checks in CI#325
QuanCheng-QC wants to merge 1 commit intodevelopfrom
issuefix/add-ruff-quality-gates

Conversation

@QuanCheng-QC
Copy link
Copy Markdown
Collaborator

Summary

This PR introduces a minimal Ruff-based quality gate for the Python codebase.

Changes

  • replace black and flake8 in dev extras with ruff
  • add baseline Ruff configuration in pyproject.toml
  • add .pre-commit-config.yaml with ruff-check and ruff-format
  • add a dedicated lint job to pytest.yml

CI behavior

  • linting now runs only on changed Python files in the current PR/push
  • if no Python files are changed, the lint job is skipped successfully
  • this avoids blocking adoption on existing repo-wide lint/format debt

Scope

This PR intentionally does not:

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openagents-studio Ready Ready Preview, Comment Mar 28, 2026 9:27am
openagents-workspace Ready Ready Preview, Comment Mar 28, 2026 9:27am

Request Review

Copy link
Copy Markdown

@JiwaniZakir JiwaniZakir left a comment

Choose a reason for hiding this comment

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

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.

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.

[DX] Add Python code formatting & linting infrastructure (ruff, pre-commit, CI)

2 participants