Skip to main content

Module list_override

Module list_override 

Source
Expand description

The report list-override DSL: parse a [report] section into a ReportOverride of per-list ListPatches, plus the generic op-table primitives is_list_op_table / patch_value_list reused by the TOML inheritance merge (crate::toml_merge::deep_merge).

The report’s table columns, card-featured metrics, and JSON stats keys are inherited from the global metric catalog. A config patches an inherited list rather than restating it: a plain array replaces it wholesale, while an op-table mutates it in place —

[report]
columns = { remove = ["volume", "effort"], add = ["unsafe"] }
stats   = { add = ["unsafe"] }
card    = { replace = { "sloc" = "unsafe" } }

The op semantics (clearremovereplaceafter/beforeprependadd, then dedup) live in ListPatch::apply. The orchestrator applies the patch over the catalog list, then prunes to keys present.

Lives in code-ranker-plugin-api (next to ReportOverride) so both the language plugins (<lang>.toml [report]) and the CLI (a project code-ranker.toml [report], and its config inheritance merge) use it without reaching into a sibling crate.

Functions§

is_list_op_table
True when t is a list-op table (carries at least one op key) — i.e. it patches an inherited list rather than replacing it with a value.
patch_value_list
Apply an op-table ov to a string-list base (used by deep_merge). A non-string base can’t be patched by value, so it is kept unchanged.
report_override
Read the [report] section of a merged config table as a ReportOverride (used for a language’s <lang>.toml, which nests it under report).
report_override_section
Read a bare [report] section table (its columns / card / stats keys) as a ReportOverride. Used for the project code-ranker.toml, where the section is parsed into a table directly.