Skip to main content

Weighted Methods Per Class

The sum of the complexity of all class methods.

Keep WMC down. A high WMC has been found to lead to more faults. WMC is a predictor of how much time and effort is required to develop and maintain the class. Complex methods also mean a greater potential impact on derived classes, since the derived classes inherit (some of) the methods of the base class.

A recommended WMC is 35 or less.

info

This metric uses McCabe Cyclomatic Complexity metric results for calculating the weight for each method.

Additional resources:

Config example​

dart_code_metrics:
...
metrics:
...
weighted-methods-per-class: 35
...