MetricsAggregator class
Aggregates metrics across multiple files for project-level analysis.
Provides:
- Project-wide statistics (averages, distributions)
- Hotspot identification (functions with poor metrics)
- Threshold-based violation detection
- Summary reports
Constructors
- MetricsAggregator({MaintainabilityIndexCalculator? calculator, MetricsThresholds? thresholds})
Properties
- fileCount → int
-
Returns the number of analyzed files.
no setter
- functionCount → int
-
Returns the number of analyzed functions.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- thresholds → MetricsThresholds
-
Metrics thresholds for violation detection.
final
Methods
-
addFile(
String path, CompilationUnit unit) → void - Adds a file to the aggregation.
-
addPrecomputedResult(
String path, FileMaintainabilityResult result, List< FunctionMetrics> functions) → void - Adds pre-computed metrics without requiring AST.
-
clear(
) → void - Clears all aggregated data.
-
generateReport(
) → AggregatedReport - Generates a comprehensive report.
-
getFilesSortedByMaintainability(
) → List< FileMetricsSummary> - Returns files sorted by average maintainability (worst first).
-
getMostComplexFunctions(
int n) → List< FunctionMetrics> - Returns the top N functions with highest cyclomatic complexity.
-
getProjectMetrics(
) → ProjectMetrics - Calculates project-wide statistics.
-
getRatingDistribution(
) → RatingDistribution - Returns distribution of maintainability ratings.
-
getViolations(
) → List< FunctionMetrics> - Returns functions that violate thresholds (hotspots).
-
getWorstFunctions(
int n) → List< FunctionMetrics> - Returns the top N functions with worst maintainability.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeFile(
String path) → void - Removes a file from the aggregation.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited