Module groups
Expand description
Architectural grouping for --group-file.
Reads a text file where each non-blank line maps a path-prefix or regex to a logical group name:
src/auth => Auth
^src\/.*Tests\.cs$ => CS Tests
^src\/((?!.*Test.*).).*$ => Production- Plain text on the LHS (no leading
^): rewritten internally to^<escape(path)>/so it matches everything under that prefix without accidentally matchingsrc/foobarwhen the user wrotesrc/foo. - Regex on the LHS (starts with
^): used as-is. Lookaround supported via fancy-regex (code-maat’s own fixtures rely on it). - First-match-wins: rules are checked in file order; the first match is the entity’s group. Order in the file matters.
§Strict vs non-strict
- Strict (
--strict-grouping, code-maat default): unmatched entities are dropped from analysis output silently. - Non-strict (
CodeLoredefault): unmatched entities keep their raw path. Less surprise; users opt into silent drop explicitly.
Code-maat’s behavior is always-strict; we deliberately diverge to the
safer default. Under --code-maat-compat the strict default is flipped
back on.
Structs§
- Group
Map - Compiled set of grouping rules. Built once per run from
Options.group_file. - Group
Rule - One mapping rule from the group file.
Enums§
- Group
Parse Error - Group
Pattern - Compiled grouping pattern. Code-maat allows full regex with lookaround
in
^...$form, but the typical user-typed group file is hundreds of plain-text path prefixes —src/foo => engine. The fast variant uses the standardregexcrate (linear time, no backtracking); the fancy variant is only paid when the LHS actually starts with^(advanced users opting into regex semantics).