feat(ledger): CSS derive families are names, never bodies — name floor 2 for css, dup: grouping sym-only; derive line says "repeated name" and dismisses scoped-css; plugin 0.1.41 (note #2917)
CI & Build / Python lint (push) Successful in 4s
CI & Build / Plugin hooks (push) Successful in 10s
CI & Build / integration (push) Successful in 25s
CI & Build / TypeScript typecheck (push) Successful in 32s
CI & Build / Python tests (push) Successful in 1m0s
CI & Build / Build & push image (push) Successful in 25s
CI & Build / Python lint (push) Successful in 4s
CI & Build / Plugin hooks (push) Successful in 10s
CI & Build / integration (push) Successful in 25s
CI & Build / TypeScript typecheck (push) Successful in 32s
CI & Build / Python tests (push) Successful in 1m0s
CI & Build / Build & push image (push) Successful in 25s
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1061,17 +1061,27 @@ def _derive_line(path: str, derive: list[dict]) -> str:
|
||||
)
|
||||
continue
|
||||
f = d["family"]
|
||||
how = "identical body" if f.get("identical") else "same name defined"
|
||||
files = ", ".join(f"`{x}`" for x in f.get("files") or [])
|
||||
more = f.get("file_count", 0) - len(f.get("files") or [])
|
||||
if more > 0:
|
||||
files += f" +{more} more"
|
||||
n = f.get("file_count", 0)
|
||||
if f.get("identical"):
|
||||
what = f"is a duplicate family with no canon — identical body in {n} other file(s)"
|
||||
else:
|
||||
# A name family: the same definition name living in several
|
||||
# files. CSS is only ever grouped this way (note 2917) — a class
|
||||
# is a recipe, and the recipe is what gets derived or dismissed.
|
||||
what = f"is a repeated name with no canon — defined in {n} other file(s)"
|
||||
# The dismissal reason the family most likely earns: a class name
|
||||
# reused for different purposes is scoped styling; a code name reused
|
||||
# across modules is convention plumbing.
|
||||
dismiss = "scoped-css" if d.get("kind") == "css" else "convention-plumbing"
|
||||
parts.append(
|
||||
f"`{f['label']}` is a duplicate family with no canon — {how} in "
|
||||
f"{f.get('file_count', 0)} other file(s): {files}; derive it now: "
|
||||
f"`{f['label']}` {what}: {files}; derive it now: "
|
||||
"record the canon (create_snippet) and make the copies instances "
|
||||
"(classify_shapes) — or, if these are convention not copies, "
|
||||
"`classify_shapes(..., status=\"exempt\", reason_code=\"convention-plumbing\")` "
|
||||
f"`classify_shapes(..., status=\"exempt\", reason_code=\"{dismiss}\")` "
|
||||
"dismisses the family — rather than adding another copy"
|
||||
)
|
||||
return f"> Shape ledger at `{path}`: " + "; ".join(parts) + "."
|
||||
|
||||
Reference in New Issue
Block a user