mirror of
https://github.com/yogeshojha/rengine.git
synced 2026-10-20 15:21:30 +02:00
The comment rule in CLAUDE.md is one line maximum, never narration: no multi-line blocks, no module-header explainers, no sentences that explain or justify the code to the reader. The tree had drifted a long way from it, and most of the drift is mine. Removed: 232 lines of multi-line comment blocks 203 single-line comments that argued instead of stating 154 comments joined by so/because/otherwise/rather-than 143 narrating comments in the frontend 112 test docstrings (the test name already says what it asserts) 25 test module docstrings and 25 decorative section dividers Collapsed: 324 multi-line docstrings to one factual line 271 one-line docstrings that had a justifying clause bolted on Kept: functional directives, section dividers, short field labels, alembic revision headers, and the eight FastAPI route docstrings that render in /docs. Where a fact was load-bearing it is in CLAUDE.md, which is where it belongs. 284 python tests and 34 frontend tests pass, ruff and ruff-format clean across ten packages, svelte-check 0 errors, prettier and eslint clean, app.main imports. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013dKUV96WkQQETZBMoAG98C
31 lines
934 B
Python
31 lines
934 B
Python
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
_MAX_URL = 2000
|
|
|
|
|
|
def parse_ffuf_record(record: dict[str, Any]) -> dict[str, Any] | None:
|
|
"""One ffuf NDJSON hit."""
|
|
url = record.get("url")
|
|
status = record.get("status")
|
|
if not isinstance(url, str) or not url or len(url) > _MAX_URL:
|
|
return None
|
|
if not isinstance(status, int):
|
|
return None
|
|
redirect = record.get("redirectlocation") or None
|
|
return {
|
|
"url": url,
|
|
"status_code": status,
|
|
"content_length": _number(record.get("length")),
|
|
"words": _number(record.get("words")),
|
|
"lines": _number(record.get("lines")),
|
|
"content_type": (record.get("content-type") or None),
|
|
"redirect_location": redirect if isinstance(redirect, str) else None,
|
|
"host": record.get("host") or None,
|
|
}
|
|
|
|
|
|
def _number(value) -> int | None:
|
|
return value if isinstance(value, int) else None
|