Riff
Ruff + diff = Riff
Run Ruff⚡, and filter out violations not caused by your branch.
Riff uses git diff to detect code lines modified in the current branch, and filters Ruff's output accordingly.
Riff only fails when violations are detected in modified lines.
Rationale
Ruff doesn't have a baseline feature, so Riff can come handy for enforcing Ruff rules in larger repositories quickly, without having to fix every single existing violation.
Usage
As a CLI tool
- Make sure Ruff (>=0.0.291) is installed
- Run
riff, followed by (optional) Riff arguments, and (optional) Ruff arguments. - Running
riffwithout arguments will run it in the current directory. - Riff expects to be run in a repository folder.
As a pre-commit hook
Copy this to your .pre-commit-config file
- repo: https://github.com/dorschw/riff
rev: v0.1
hooks:
- id: riff
additional_dependencies: ["ruff>=0.0.291"] # minimal is 0.0.291, consider using the latest version
To pass other arguments to Riff (and Ruff), add the args key, e.g.
args: ["--base-branch=origin/master"]
Riff Arguments
always-fail-on: comma-separated list of Ruff error codes. When detected by Ruff, Riff will consider them as failures, even if they're not in lines modified in the current branch.print-github-annotation: boolean (defaultfalse). When set totrue, will add GitHub Annotations, making the violations more visible when reviewing code in GitHub'sModified Filestab.base-branch: string (defaultorigin/main). Change toorigin/masteror whatever your base branch is named.
Limitations
- When using Ruff's
--fixfeature, Ruff will fix everything it is configured to, regardless of the modified lines. Riff cannot control this behavior. - Riff cannot currently run Ruff with a
--output-formatconfiguration. (see here)
Alternatives
Metadata
Release files for riff 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| riff-0.2.tar.gz | 76.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| riff-0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 87.5 kB
Release files / riff-0.2.tar.gz
| Download URL | riff-0.2.tar.gz |
|---|---|
| Size | 76.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7afcfb6e3efe977f7c490b16fd697785336160e8a6c5f64aac858ba8b1b86018
|
|
BLAKE2b-256 checksum How to use checksums |
f9a7ca17b4e3a86f8d6615e4197b14e3f58838ce4c402b599e43cea944304118
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / riff-0.2-py3-none-any.whl
| Download URL | riff-0.2-py3-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5de6d154e9dec14608cc7543a3b02d26736c01f76ec065b3310a17cf73dfef8e
|
|
BLAKE2b-256 checksum How to use checksums |
0ec048fc13bee3842ed6da119a52749fab29045e7d773b7b3a72a363193af3d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|