Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
4aed88b
refactor(checker): require the with-code space predicates and drop by…
dekobon Nov 12, 2026
a359774
test(loc,roles): pin the chain the doc-body callable test reads
dekobon Nov 12, 2026
e93b377
test(roles): add the byte-axis backstop and re-declare three gates it…
dekobon Nov 12, 2026
4bf33be
docs(lessons): bring lesson 120 up to the removal of byte-less is_func
dekobon Nov 12, 2026
ee68d23
refactor(roles): name a record's header once, beside the Java and Gro…
dekobon Nov 12, 2026
4c1f571
perf(roles): read a record header's types once per scan, and probe th…
dekobon Nov 12, 2026
5458959
perf(loc/python): fold the code-before-a-parenthesis question down th…
dekobon Nov 12, 2026
bacf760
test(roles): count the record-header type reads the hoist saves
dekobon Nov 12, 2026
678be30
refactor(tests,npm,loc): close the smaller follow-ups of the #1862 re…
dekobon Nov 12, 2026
1642a96
docs(changelog): record the #1863 follow-ups
dekobon Nov 12, 2026
6e9ab71
docs(bench): unlink a private const from a public shape's doc
dekobon Nov 12, 2026
9e09880
refactor(roles,nargs): apply the simplify-rust pass over the #1863 batch
dekobon Nov 12, 2026
8061e96
perf(loc/python): memoise the code-before climb per level, not on a f…
dekobon Nov 12, 2026
c799efd
test(node): make the answering level's memo observable
dekobon Nov 12, 2026
601a074
test(roles): check the byte-gate fixtures' table names in a test of t…
dekobon Nov 12, 2026
6198f3f
perf(loc/python): ask the level question from the run, so each level …
dekobon Nov 12, 2026
f0774c3
refactor(checker): leave no default on the with-code predicates or th…
dekobon Nov 12, 2026
e3d0cca
test(roles,npm): close the test gaps the reviews of the batch found
dekobon Nov 12, 2026
6dd823a
test(roles): name the gates each byte-gate fixture must move
dekobon Nov 12, 2026
8f7bbe6
docs(book): translate the new-language page's Getter bullet into Japa…
dekobon Nov 12, 2026
68b70b0
test(node,loc,roles): cover the five patch lines that have a reason t…
dekobon Nov 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 13 additions & 19 deletions .bca-baseline.toml
Original file line number Diff line number Diff line change
Expand Up @@ -215,19 +215,7 @@ value = 5.0
path = "big-code-analysis-ast/src/checker.rs"
qualified = "<file>"
metric = "loc.sloc"
value = 1285.0

[[entry]]
path = "big-code-analysis-ast/src/checker.rs"
qualified = "Checker"
metric = "nom"
value = 29.0

[[entry]]
path = "big-code-analysis-ast/src/getter.rs"
qualified = "Getter"
metric = "wmc"
value = 58.0
value = 1288.0

[[entry]]
path = "big-code-analysis-ast/src/getter.rs"
Expand Down Expand Up @@ -311,25 +299,25 @@ value = 43.0
path = "big-code-analysis-ast/src/node/ancestors.rs"
qualified = "<file>"
metric = "loc.ploc"
value = 646.0
value = 704.0

[[entry]]
path = "big-code-analysis-ast/src/node/ancestors.rs"
qualified = "<file>"
metric = "loc.sloc"
value = 1390.0
value = 1519.0

[[entry]]
path = "big-code-analysis-ast/src/node/ancestors.rs"
qualified = "Ancestors<'tree, 'chain>"
metric = "nom"
value = 41.0
value = 44.0

[[entry]]
path = "big-code-analysis-ast/src/node/ancestors.rs"
qualified = "Ancestors<'tree, 'chain>"
metric = "wmc"
value = 76.0
value = 84.0

[[entry]]
path = "big-code-analysis-ast/src/node/ancestors.rs"
Expand Down Expand Up @@ -371,13 +359,13 @@ value = 5.0
path = "big-code-analysis-ast/src/roles/mod.rs"
qualified = "<file>"
metric = "loc.ploc"
value = 894.0
value = 906.0

[[entry]]
path = "big-code-analysis-ast/src/roles/mod.rs"
qualified = "<file>"
metric = "loc.sloc"
value = 2268.0
value = 2325.0

[[entry]]
path = "big-code-analysis-ast/src/tools.rs"
Expand Down Expand Up @@ -1273,6 +1261,12 @@ qualified = "Mi::compute"
metric = "nargs"
value = 5.0

[[entry]]
path = "src/metrics/nargs.rs"
qualified = "<file>"
metric = "loc.ploc"
value = 524.0

[[entry]]
path = "src/metrics/npa/php.rs"
qualified = "PhpCode::compute"
Expand Down
39 changes: 22 additions & 17 deletions .claude/skills/add-lang/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -536,17 +536,21 @@ Create the file, add `mod <lang>;` to `checker.rs`, and write
answer `false`, which is right for a language with no doc
convention. Where one exists, `lang_helpers/doc_text.rs` has the
shared opener tests.
- `is_func_space` / `is_func_space_with_code`, `is_func`,
`is_closure` — forward to the table: `crate::roles::<lang>::opens_space`
(emitted once per table as the fold over every `opens K` annotation
on the `FuncOpener` and `Container` rows) for the space predicates,
`func_opener::is_callable` for `is_func`, `closure::owns` for
`is_closure` (#1696). Copy the Lua or Go shape, including the
byte-less `is_func_space` forwarding with `Ancestors::known(&[])`.
- `is_func_space_with_code`, `is_func_with_code`, `is_closure` —
forward to the table: `crate::roles::<lang>::opens_space` (emitted
once per table as the fold over every `opens K` annotation on the
`FuncOpener` and `Container` rows) for the space predicate,
`func_opener::is_callable` for `is_func_with_code`, `closure::owns`
for `is_closure` (#1696). The two `_with_code` predicates are
required: the trait gives them no default (#1863). Copy the Lua or
Go shape, including `impl_byte_less_func_space!`, which emits the
byte-less `is_func_space` with its build-time pin. That one is
required too, so the build fails without the macro.
- `is_call`, `is_call_with_code`, `is_string`,
`is_string_with_code` — one `impl_row_predicates!(<lang>, call, …)`
and one `impl_row_predicates!(<lang>, string_lit, …)` line each
(#1698).
(#1698). The two `_with_code` predicates are required (#1863), so
both lines are needed even where a row is `absent`.
- `is_non_arg` — punctuation kinds inside argument lists
(`LPAREN`, `COMMA`, `RPAREN`, etc.). Not a role; written by kind.
- `is_else_if` — `#[inline]`. **Do not blind-copy the Go
Expand Down Expand Up @@ -594,13 +598,14 @@ Create the file, add `mod <lang>;` to `checker.rs`, and write
Create the file, add `mod <lang>;` to `getter.rs`, and write
`impl Getter for <LangName>Code`. Required methods:

- `get_space_kind` / `get_space_kind_with_code` — forward to
`crate::roles::<lang>::opens_space`, the fold over every `opens K`
annotation on the `FuncOpener` and `Container` rows (#1696). The
byte-less spelling forwards with `Ancestors::known(&[])`, as the
Lua and Go impls do; `is_func_space` and `get_space_kind` must read
the same predicate or the space tree disagrees with itself
(`grammar-dispatch.md` §7).
- `get_space_kind_with_code` — **required** by the trait (no default,
#1863); forward to `crate::roles::<lang>::opens_space`, the fold
over every `opens K` annotation on the `FuncOpener` and `Container`
rows (#1696). `impl_byte_less_space_kind!(<lang>);` emits the
byte-less `get_space_kind` with its build-time pin, as the Lua and
Go impls do; it is required too. `is_func_space` and
`get_space_kind` must read the same predicate or the space tree
disagrees with itself (`grammar-dispatch.md` §7).
- `keyword_roles!(<lang>);` — emits `get_keyword_role`, which is
**required** by the trait (no default), from the `Modifier`,
`DeclKeyword` and `Primitive` rows. Pass `primitive: Operand` if the
Expand Down Expand Up @@ -893,8 +898,8 @@ Add real impls for the remaining metrics where the grammar exposes
the necessary nodes:

- **Nom** (`src/metrics/nom.rs`): default trait body usually works if
`Checker::is_func` and `Checker::is_closure` are correct. Verify
with a unit test before assuming.
`Checker::is_func_with_code` and `Checker::is_closure` are correct.
Verify with a unit test before assuming.
- **NArgs** (`src/metrics/nargs.rs`): default counts direct children
of the parameter list. Some grammars group same-typed parameters
into a single node (Go does this with `parameter_declaration`,
Expand Down
47 changes: 47 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,39 @@ for historical reference.
a survey of every production read found no consumer asking a
projection outside its role's profile, and which projection a
consumer reads remains the manual check the module doc names.
- **`big-code-analysis-ast`: every language writes the space-tree
predicates, and the byte-less `Checker::is_func` is removed** (#1863).
`Checker::is_func_with_code`, `Checker::is_func_space_with_code` and
`Getter::get_space_kind_with_code` defaulted to their byte-less
spellings, so a language that wrote only the byte-less one handed a
text-gated role row no bytes, silently. The three are now required
methods, as are `Checker::is_call_with_code` and
`is_string_with_code`, whose defaults forwarded the same way. The
byte-less `is_func_space` and `get_space_kind` are required too:
every language's spelling asks the with-code form with no bytes and
a known-empty chain, through a macro that pins at build time that
the rows read neither, or by hand beside the reason.
`Checker::is_func` answered three different questions across the
languages and is gone; its readers ask `is_func_with_code`.
`Checker::holds_doc_comment_in_body` gains a `code` parameter for the
same test. The crate is outside `STABILITY.md`, and no item this
crate re-exports changes. Metric values are unchanged. With it:
- The derived role suite gains a byte-axis backstop,
`unmarked_owners_answer_alike_without_the_bytes`: every owner a row
does not mark `text_gated_by` must answer alike with the source
bytes and without. It found three gates that read bytes under a
plain `gated_by`, now re-declared: the Tcl family's
`is_braced_literal` and Bash's `comparison_operator` and
`short_circuit_operator`. The keyword changes no answer.
- `roles::java::record_header` and `roles::groovy::record_header`
name a record's component list once; the header gate, the space's
name, Java's `nargs` and `npm` read them where each spelled the
field or the kind pair itself.
- The record-header gate reads the header's component types once per
evaluation rather than once per constructor it compares. New
scaling probes `nargs/java-record-alternative-ctors` and
`nargs/groovy-record-alternative-ctors` price the gate's scan of a
record's body.
- **Release packaging tools are upgraded**: cargo-about 0.9.3,
cargo-deb 3.8.0, cargo-generate-rpm 0.21.1 and cargo-cyclonedx
0.5.10. Three outputs change:
Expand Down Expand Up @@ -302,6 +335,20 @@ for historical reference.
`ChildAncestors` and `Ancestors` keep their signatures. New scaling
probes `npa/ruby-nested-classes`, `npm/ruby-nested-classes` and their
`loc` control price it.
- **Python `loc` stays linear over a docstring nested in parentheses
that each open with bare `\` rows** (#1863). A bare `\` row inside a
parenthesised docstring asks whether code precedes its parenthesis on
the logical line, and the answer is read at the nearest enclosing
level that holds a token before its node. Where every level holds
only comments and `\` rows, each of `n` nested parentheses read every
level above it, quadratic in `n` up to the 200 levels Python's
tokenizer allows. Each level's answer is now memoised for the walk
and read once: at 200 levels with 30 such rows each, a 37 KB file,
the `loc` walk took 100 ms and takes 3.5 ms (one run each, on a host
that was not idle). Metric values are unchanged.
New scaling probes `loc/python-deep-paren-extra-prefix` and
`loc/python-block-comments-paren-strings` price it, the second for
the levels above the nearest answer, which are never read.
- **`cognitive` stays linear over functions in nested containers**
(#1864). The walk asks every function definition whether another
function encloses it, to charge a nested function its depth, and
Expand Down
Loading
Loading