Ruff: Make Automated Code Changes Reviewable
Ruff separates inspection, safe automatic fixes and verification. A small rule set and reviewable diff help teams apply routine corrections without losing sight of behaviour.
As of October 31, 2026, Ruff’s repository lists version 0.17.3, with release notes dated October 26. Ruff is a maintained Python linter and formatter. Its useful operational distinction is that identifying a problem, rewriting a file and confirming the application still behaves correctly are separate steps.
With Ruff installed, start by inspecting a repository without changing its files:
ruff check .
ruff format --check .
The first command reports violations of enabled lint rules; the second checks formatting without rewriting files. The result depends on the project’s configuration and Ruff version. Record both in the project so local runs and continuous integration use the same expectations.
For lint violations with available fixes, the next command applies fixes under the configured safety policy:
ruff check --fix .
By default, Ruff applies fixes classified as safe, intended to preserve runtime behaviour. Unsafe fixes require explicit opt-in and may change behaviour or remove comments. The distinction is concrete: Ruff’s documentation describes changing list(...)[0] to next(iter(...)). On an empty input, the exception changes from IndexError to StopIteration; a caller catching the former could then behave differently. That fix is classified as unsafe. Version 0.17.3 also fixes an incorrect f-string conversion in one lint rule; preview features remain separately opt-in.
Make the changed behaviour visible
Our engineering assessment is to begin with a small, agreed rule set in an existing codebase. Run the read-only checks first, decide which findings belong to the intended change, then apply automatic fixes in a reviewable batch. Separate large formatting sweeps from application logic changes so a reviewer can find the altered behaviour.
Inspect the diff after every fix run. A safety classification describes the tool’s intended transformation, not a proof that every application assumption has been preserved. Run tests relevant to the changed code path, especially where exception handling, string contents or data transformation are involved. If an unsafe fix is proposed, review it as a deliberate behaviour change and opt in only for that scoped case.
An automated gate can repeat the read-only checks for every pull request. That makes the configured expectations visible and consistent, but a passing result has a defined boundary: enabled lint and format checks passed. It cannot show that a business rule is correct, a dataset is complete or an integration covers every failure.
Ruff is most valuable when routine corrections are easy to repeat and the resulting changes remain easy to inspect. Reviewers can then devote their attention to decisions that require knowledge of the actual application.