Skip to main content

Module groups

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 matching src/foobar when the user wrote src/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 (CodeLore default): 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§

GroupMap
Compiled set of grouping rules. Built once per run from Options.group_file.
GroupRule
One mapping rule from the group file.

Enums§

GroupParseError
GroupPattern
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 standard regex crate (linear time, no backtracking); the fancy variant is only paid when the LHS actually starts with ^ (advanced users opting into regex semantics).