Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.

Commit

Permalink
fix: dart-code-metrics crash saying Bad state: No element when runn…
Browse files Browse the repository at this point in the history
…ing command (#805)

* Fix dart-code-metrics crash saying Bad state: No element when running command

* Update CHANGELOG.md

* fix formatting
  • Loading branch information
fzyzcjy committed Apr 19, 2022
1 parent e8894d5 commit dab7f56
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog

## Unreleased

* fix: dart-code-metrics crash saying `Bad state: No element` when running command.

## 4.14.0

* feat: add static code diagnostic [`prefer-commenting-analyzer-ignores`](https://dartcodemetrics.dev/docs/rules/common/prefer-commenting-analyzer-ignores).
Expand Down
3 changes: 2 additions & 1 deletion lib/src/analyzers/lint_analyzer/utils/report_utils.dart
Expand Up @@ -15,7 +15,8 @@ MetricValueLevel maxMetricViolationLevel(Iterable<LintFileReport> records) =>
(record) => [...record.classes.values, ...record.functions.values]
.map((report) => report.metricsLevel),
)
.max;
.maxOrNull ??
MetricValueLevel.none;

bool hasIssueWithSeverity(
Iterable<LintFileReport> records,
Expand Down

0 comments on commit dab7f56

Please sign in to comment.