Skip to main content

tally_scope_usage

Function tally_scope_usage 

Source
pub fn tally_scope_usage(
    subjects: &[&str],
    known_scopes: &[ScopeDefinition],
    unused_candidates: &[ScopeDefinition],
) -> ScopeUsageReport
Expand description

Tallies declared conventional-commit scopes across subjects (each the commit’s first message line) against a project’s scope taxonomy.

Pure and git-free: subjects is already-extracted text, so this is safe to unit test with string literals. Multi-scope subjects like feat(cli,claude): … count once for each of cli and claude, matching CommitInfoForAI::run_pre_validation_checks’s own comma-splitting.

known_scopes decides unknown — normally scopes.yaml plus ecosystem defaults, or just scopes.yaml under --project-only. unused_candidates is always scopes.yaml’s own entries: ecosystem defaults are synthesized by omni-dev rather than written by the project, so they must never be reported as “defined but unused.”