From 93ca90558aa6016e77625c627a70640e693e3303 Mon Sep 17 00:00:00 2001 From: blasty Date: Fri, 21 Aug 2026 12:14:27 +0200 Subject: adopt ruff: pinned formatter + import sorting, opt-in pre-commit hook PR #1 arrived black-formatted, which forced the question. ruff's formatter is black's output, it is one static binary rather than a dependency chain, and it is fast enough that a hook is free. ruff.toml pins the version (a formatter whose output moves between releases turns 'formatted' into 'formatted by whoever committed last') and selects only import sorting on the lint side -- a hook that refused a commit over an unused variable would be a different feature. .githooks/pre-commit (install: git config core.hooksPath .githooks) formats exactly what is staged, refuses partly-staged files rather than quietly widening a commit built with git add -p, and prefers the pinned .venv ruff. Also drops the blanket '# ruff: noqa' PR #1 left in remote_ops.py -- it would have exempted that file from the only lint rule we enforce. --- CONTRIBUTING.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'CONTRIBUTING.md') diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b66df1c..5cf7765 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -51,6 +51,20 @@ The IDA-backed suites need an interpreter that has `textual`, `idapro` and import instead of doing it at module top. Please don't break that — it's what keeps the fast gate fast and lets people without IDA contribute at all. +## Formatting + +Python is formatted by ruff (`ruff.toml` pins the exact version; the config is +deliberately default: black-style layout plus import sorting, nothing else). +Install the pre-commit hook once and forget about it: + +```bash +uv sync --extra dev # puts the pinned ruff in .venv +git config core.hooksPath .githooks # formats what you stage +``` + +Mechanical reformat commits are listed in `.git-blame-ignore-revs`; +`git config blame.ignoreRevsFile .git-blame-ignore-revs` keeps blame useful. + ## Sending a change - Run at least `python3 tests/run.py --fast` before you push. If your change -- cgit v1.3.1-sl0p