Skip to main content

Find class quality metrics

io.moderne.prethink.quality.FindClassMetrics

Compute per-class code quality metrics including WMC, LCOM4, TCC, CBO, and maintainability index.

Recipe source

This recipe is only available to users of Moderne.

This recipe is available under the Moderne Proprietary License.

Used by

This recipe is used as part of the following composite recipes:

Usage

This recipe has no required configuration options. Users of Moderne can run it via the Moderne CLI.

You will need to have configured the Moderne CLI on your machine before you can run the following command.

shell
mod run . --recipe FindClassMetrics

If the recipe is not available locally, then you can install it using:

mod config recipes jar install io.moderne.recipe:rewrite-prethink:0.4.1

See how this recipe works across multiple open-source repositories

Run this recipe on OSS repos at scale with the Moderne SaaS.

The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories.

Please contact Moderne for more information about safely running the recipes on your own codebase in a private SaaS.

Data Tables

Class quality metrics

io.moderne.prethink.table.ClassQualityMetrics

Per-class code quality metrics including WMC, LCOM4, TCC, CBO, and maintainability index.

Column NameDescription
Source pathThe path to the source file containing the class.
Class nameThe fully qualified name of the class.
Line countNumber of lines in the class.
Method countNumber of methods defined in the class.
Field countNumber of fields defined in the class.
WMCWeighted Methods per Class: sum of cyclomatic complexities of all methods.
LCOM4Lack of Cohesion of Methods (Hitz-Montazeri): number of connected components in the method-field access graph. 1 = cohesive, >1 = should be split.
TCCTight Class Cohesion: proportion of directly connected method pairs (sharing field access). 0.0-1.0, higher is more cohesive.
CBOCoupling Between Objects: number of distinct classes this class is coupled to.
Maintainability indexComposite score (0-100) combining Halstead Volume, cyclomatic complexity, and LOC. Higher is more maintainable.