From 78c598895348e9b2fbb6352f6635dc4a22bf72e3 Mon Sep 17 00:00:00 2001 From: devdanzin <74280297+devdanzin@users.noreply.github.com> Date: Tue, 23 Jun 2026 13:40:21 -0300 Subject: [PATCH] Fix CI: ruff format oom_dedup.py + document ruff format --check CI's "Ruff (format check)" step (`ruff format --check`, ruff 0.15.18) has been red since the first oom_dedup edit: that file was lint-clean (`ruff check` passes) but not format-clean, and I only ran `ruff check` locally. The diff is purely cosmetic (ruff collapsing/exploding multi-arg calls in the recently-added _cap_lines / classify / load_snapshot code) -- no behavior change; the oom_dedup suite stays green. - `ruff format fusil/python/oom_dedup.py` -> whole tree now format-clean (106 files). - CLAUDE.md: note CI runs BOTH `ruff check` AND `ruff format --check`, so both must be run before pushing (`ruff check` passing does not imply format-clean). Co-Authored-By: Claude Opus 4.8 (1M context) --- CLAUDE.md | 5 ++++- fusil/python/oom_dedup.py | 17 ++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 7c4252c..007e564 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -43,7 +43,10 @@ python -m unittest tests.python.test_values # single module python -m unittest tests.python.test_oom_dedup tests.python.test_oom_dedup_wiring # OOM dedup python test_doc.py # doctest-based tests over doc/*.rst and a few modules (not chmod +x) -ruff check fusil/ # lint — ruff is installed; pyflakes.sh needs pyflakes, which is not +# CI runs BOTH of these (ruff 0.15.18, pinned) over fusil/ tests/ fuzzers/fusil-python-threaded +# -- run both before pushing; `ruff check` passing does NOT imply `ruff format --check` passes. +ruff check fusil/ tests/ fuzzers/fusil-python-threaded # lint (pyflakes.sh needs pyflakes, not installed) +ruff format --check fusil/ tests/ fuzzers/fusil-python-threaded # format check; `ruff format ` to fix # Build/install. Packaging is defined entirely in pyproject.toml (setuptools # backend; no setup.py). pip install pulls in python-ptrace; build isolation diff --git a/fusil/python/oom_dedup.py b/fusil/python/oom_dedup.py index 92af24c..151f141 100644 --- a/fusil/python/oom_dedup.py +++ b/fusil/python/oom_dedup.py @@ -62,8 +62,7 @@ def _cap_lines(text): if _STDOUT_LINE_CAP <= 0: return text return "\n".join( - ln if len(ln) <= _STDOUT_LINE_CAP else ln[:_STDOUT_LINE_CAP] - for ln in text.split("\n") + ln if len(ln) <= _STDOUT_LINE_CAP else ln[:_STDOUT_LINE_CAP] for ln in text.split("\n") ) @@ -118,9 +117,7 @@ def classify(text): return dict( kind="segv", file=None, line=None, func=None, assert_expr=None, fatal_msg=None ) - return dict( - kind="fatal", file=None, line=None, func=None, assert_expr=None, fatal_msg=msg - ) + return dict(kind="fatal", file=None, line=None, func=None, assert_expr=None, fatal_msg=msg) if SEGV.search(text): return dict(kind="segv", file=None, line=None, func=None, assert_expr=None, fatal_msg=None) if IMPORTERR.search(text): @@ -160,8 +157,14 @@ def load_snapshot(lines): by_line.setdefault((f, int(ln)), set()).add(oid) per_file_lines[f].append((int(ln), oid)) return dict( - func=by_func, assert_=by_assert, line=by_line, fl=per_file_lines, msg=by_msg, - msgfam=by_msgfam, kind=kind_of, funcname=by_funcname, + func=by_func, + assert_=by_assert, + line=by_line, + fl=per_file_lines, + msg=by_msg, + msgfam=by_msgfam, + kind=kind_of, + funcname=by_funcname, )