Skip to content

AGENTS: Add instruction to format and check Python files with ruff after editing#63599

Merged
potiuk merged 2 commits intoapache:mainfrom
potiuk:worktree-joyful-bouncing-pizza
Mar 14, 2026
Merged

AGENTS: Add instruction to format and check Python files with ruff after editing#63599
potiuk merged 2 commits intoapache:mainfrom
potiuk:worktree-joyful-bouncing-pizza

Conversation

@potiuk
Copy link
Member

@potiuk potiuk commented Mar 14, 2026

Add instruction to AGENTS.md Coding Standards to always run ruff format and ruff check --fix on Python files immediately after writing or editing them.


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Opus 4.6 (1M context)

Generated-by: Claude Opus 4.6 (1M context) following the guidelines

@potiuk potiuk changed the title AGENTS: Add instruction to format Python files with ruff after editing AGENTS: Add instruction to format and check Python files with ruff after editing Mar 14, 2026
@shivaam
Copy link
Contributor

shivaam commented Mar 14, 2026

PR checklist already requires running static checks before pushing. Wouldn't running those once before commit/PR be sufficient rather than after every file edit?
Curious if there's a specific failure mode this is targeting that the batch approach doesn't catch.

@potiuk
Copy link
Member Author

potiuk commented Mar 14, 2026

PR checklist already requires running static checks before pushing. Wouldn't running those once before commit/PR be sufficient rather than after every file edit? Curious if there's a specific failure mode this is targeting that the batch approach doesn't catch.

Yes - ruff is VERY fast and can be done immediately, on the other hand runnig prek for the change takes a bit of time and often what happens when you run the checks after edit they fail first and then the agent looks at the output, re-adds the file and re-runs prek check. This takes usually a bit less than minute more for re-run and I get it practically every time when some files were edited.

By adding ruff at modification time - when everything else is fine, this will result in no rerun needed. So prek will only be run once and succeed. So this is rally an optimisation of speed of processing.

@shivaam
Copy link
Contributor

shivaam commented Mar 14, 2026

PR checklist already requires running static checks before pushing. Wouldn't running those once before commit/PR be sufficient rather than after every file edit? Curious if there's a specific failure mode this is targeting that the batch approach doesn't catch.

Yes - ruff is VERY fast and can be done immediately, on the other hand runnig prek for the change takes a bit of time and often what happens when you run the checks after edit they fail first and then the agent looks at the output, re-adds the file and re-runs prek check. This takes usually a bit less than minute more for re-run and I get it practically every time when some files were edited.

By adding ruff at modification time - when everything else is fine, this will result in no rerun needed. So prek will only be run once and succeed. So this is rally an optimisation of speed of processing.

That makes sense.

@potiuk potiuk merged commit 577c958 into apache:main Mar 14, 2026
63 checks passed
@potiuk potiuk deleted the worktree-joyful-bouncing-pizza branch March 14, 2026 18:51
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