Skip to main content

Analyzers Overview

Omen ships with 19 analyzers that cover structural quality, defect risk, historical patterns, dependency health, and specialized concerns. Each analyzer is available as a top-level subcommand and can be run independently or as part of a full suite via omen all.

All analyzers parse source code through tree-sitter grammars, producing syntax-aware results rather than regex-based approximations. Output is available as formatted tables (default) or JSON (-f json).

Complexity & Quality

Analyzers that measure the structural and cognitive properties of the code itself.

AnalyzerCommandWhat It Measures
Complexityomen complexityCyclomatic and cognitive complexity per function, nesting depth
CK Metrics (Cohesion)omen cohesionChidamber-Kemerer OO metrics: WMC, CBO, RFC, LCOM4, DIT, NOC
Technical Debt Gradientomen tdgComposite file health score (0-100) across 9 weighted dimensions
Architectural Smellsomen smellsGod classes, data clumps, feature envy, cyclic dependencies

Risk & Defects

Analyzers that predict where bugs are likely to appear based on code structure, change patterns, and historical defect signals.

AnalyzerCommandWhat It Measures
Defect Predictionomen defectProbability of defects using complexity, churn, and ownership signals
Change Riskomen changesRisk score for recent modifications based on size, complexity delta, and file history
Diff Analysisomen diffStructural analysis of uncommitted or branch changes
Hotspotsomen hotspotFiles with both high complexity and high change frequency

History & Ownership

Analyzers that use Git history to surface patterns invisible in a single snapshot.

AnalyzerCommandWhat It Measures
Churnomen churnChange frequency and volume per file over time
Temporal Couplingomen temporalFiles that change together, suggesting hidden dependencies
Ownershipomen ownershipContributor distribution per file, bus factor

Structure & Dependencies

Analyzers that examine relationships between code units: imports, call graphs, duplication, and reachability.

AnalyzerCommandWhat It Measures
Dependency Graphomen graphImport/dependency relationships, coupling metrics, cycles
Dead Codeomen deadcodeUnreachable functions, unused exports, orphaned modules
Code Clonesomen clonesDuplicated code blocks (Type 1, 2, and 3 clones)
Repository Mapomen repomapStructural map of modules, symbols, and relationships

Specialized

Analyzers focused on specific concerns that cut across the categories above.

AnalyzerCommandWhat It Measures
SATD Detectionomen satdSelf-Admitted Technical Debt in comments (TODO, FIXME, HACK, etc.)
Feature Flagsomen flagsFeature flag usage, stale flags, flag-related complexity
Mutation Testingomen mutationTest suite effectiveness by injecting controlled code mutations

Running Multiple Analyzers

Run all analyzers at once:

omen all

Run a subset by chaining commands:

omen complexity && omen cohesion && omen smells

All commands accept the same global flags:

FlagDescription
-p <path>Target path (local directory, file, or owner/repo for remote)
-f jsonJSON output
--language <lang>Filter to a specific language
--config <path>Path to omen.toml configuration file