Files
pipdock/.gitattributes
T
poli0981andClaude Opus 5 93285ad262 feat(core): three parsers, against captured output rather than a guess
The commit that earns the slice. Parsing is where P3's risk lives — three formats PipDock
does not control, bumped by Dependabot on its own schedule — and all of it is testable
without ever spawning a subprocess. Runners come next; if these are wrong nothing after
them can be right.

CODE-HEALTH-SPEC §5 is amended on three points, each because the tools were run:

deptry emits a **flat list**, one object per (code, module, location), keyed by `module`.
§5 sketched a per-dependency object with a `locations` array; that shape does not exist.
Grouping is therefore PipDock's job, done on (code, module) rather than module alone — one
dependency can be both DEP001 and DEP003, and merging those yields a row whose message
describes only one of them. `dep` is a **module** name: yaml is PyYAML, cv2 is
opencv-python, so anything handing it to a package operation must reconcile it first.

vulture has no machine-readable output at all. Its eighth message shape, `unreachable code
after '<token>'`, quotes the token the code follows rather than a dead identifier — so
`name` is optional and quoting alone cannot decide it. The line number is found by
splitting from the right, because `C:\proj\a.py:12:` has three colons and a left-to-right
split would ship broken on every Windows machine.

ruff's docs URL is keyed by rule **name**: I001 lives at .../rules/unsorted-imports, so
§6's .../rules/<code> 404s. Carried, never constructed. A syntax error arrives as
`invalid-syntax` with a null url — not a null code, which is what §6 assumed.

The exit-code table is the sharpest thing here. All three exit non-zero on findings and
they disagree about how — deptry 1, ruff 1, **vulture 3**, with vulture's 1 and 2 being
real failures. A plain !out.ok() reports every successful run over a real project as
PD-HLT-002, and a suite that only runs the tools over a clean directory agrees with it.

Fixtures are captured from the pinned versions and redacted: ruff's `filename` is absolute
and carried this machine's home directory, which is the exact failure CLAUDE.md records pip
shipping to a public repo. They are also `-text` in .gitattributes, as an exception to the
rule above them — under health/ the JSON *is* the tool's output, not a sidecar of ours, and
normalising a captured document's line endings makes it something no tool ever emitted.

One of these fixtures was captured with `2>&1` first and every parse failed: ruff writes
findings to stdout and its warnings to stderr. A test now says so.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-12 23:31:37 +07:00

36 lines
1.8 KiB
Plaintext

# NOTE: later rules win, so the general default comes first and the overrides follow.
# Repository default: normalise to LF in the blob, check out per platform.
* text=auto
# Windows-only scripts keep CRLF on checkout.
*.ps1 text eol=crlf
*.bat text eol=crlf
*.cmd text eol=crlf
# Shell scripts must keep LF even on Windows or they will not run.
*.sh text eol=lf
# Engine-output fixtures must be preserved byte-for-byte.
#
# pip and uv emit CRLF on Windows. Normalising those to LF in the blob would test the adapter
# parsers against line endings that never occur in production — a parser mishandling a trailing
# \r would pass CI and fail on every real Windows machine. docs/TESTING.md §1 makes adapter
# parsing the thing that must never regress, so: no normalisation.
#
# `-text` is what buys that. `-diff` does NOT: it only suppresses the textual diff, and it used
# to be set here too, which meant the weekly drift job — whose entire job is to show you which
# engine bytes moved — could report nothing but "Binary files differ". Byte-exactness and a
# readable diff are not in tension, so keep the first and drop the second.
crates/pipdock-core/tests/fixtures/**/*.txt -text
# The JSON sidecars are ours, not the engines'. They are ordinary text and must stay diffable:
# meta.json is the contract the drift job gates on, so its diff has to be legible.
crates/pipdock-core/tests/fixtures/**/*.json text eol=crlf
# ...except under health/, where the JSON *is* the tool's output rather than a sidecar of ours.
# deptry and ruff write it, so it gets the same byte-for-byte treatment the engine .txt captures
# get — the rule above would have rewritten a captured document's line endings and quietly made it
# something no tool ever emitted. Later rules win, which is what lets this sit as an exception.
crates/pipdock-core/tests/fixtures/health/** -text