Skip to content
This repository was archived by the owner on Jul 16, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@

## Unreleased

* Don't trigger prefer-extracting-callbacks on empty function blocks.
* Improve static code diagnostic `prefer-extracting-callbacks`, don't trigger on empty function blocks.
* Improve unused files check, add support for `vm:entry-point` annotation.

## 4.3.3

* Fix unhandled exception while parsing `analysis_options.yaml`

## 4.3.2

* Restrict analyzer version to '>=2.1.0 <2.4.0'

## 4.3.1

* Update .pubignore
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ To set this up:
```yaml
name: dart_code_metrics_plugin_loader
description: This pubspec determines the version of the analyzer plugin to load.
version: 4.3.1
version: 4.3.3

environment:
sdk: '>=2.12.0 <3.0.0'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ A plugin for the Dart `analyzer` [package](https://pub.dev/packages/analyzer) pr

```yaml
dev_dependencies:
dart_code_metrics: ^4.3.1
dart_code_metrics: ^4.3.3
```

and then run
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,29 @@ class LongMethod extends Pattern {
functionMetrics.entries
.where((entry) => !_isExcluded(entry.key))
.expand((entry) => [
...entry.value.metrics
.where((metricValue) =>
metricValue.metricsId ==
SourceLinesOfCodeMetric.metricId &&
metricValue.level >= MetricValueLevel.warning)
.map(
(metricValue) => createIssue(
pattern: this,
location: nodeLocation(
node: entry.key.declaration,
source: source,
),
message: _compileMessage(
lines: metricValue.value,
functionType: entry.key.type,
),
verboseMessage: _compileRecommendationMessage(
maximumLines: _sourceLinesOfCodeMetricTreshold,
functionType: entry.key.type,
if (_sourceLinesOfCodeMetricTreshold != null)
...entry.value.metrics
.where((metricValue) =>
metricValue.metricsId ==
SourceLinesOfCodeMetric.metricId &&
metricValue.value > _sourceLinesOfCodeMetricTreshold!)
.map(
(metricValue) => createIssue(
pattern: this,
location: nodeLocation(
node: entry.key.declaration,
source: source,
),
message: _compileMessage(
lines: metricValue.value,
functionType: entry.key.type,
),
verboseMessage: _compileRecommendationMessage(
maximumLines: _sourceLinesOfCodeMetricTreshold,
functionType: entry.key.type,
),
),
),
),
if (_sourceLinesOfCodeMetricTreshold == null)
// ignore: deprecated_member_use_from_same_package
..._legacyBehaviour(source, entry),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,28 +50,30 @@ class LongParameterList extends Pattern {
) =>
functionMetrics.entries
.expand((entry) => [
...entry.value.metrics
.where((metricValue) =>
metricValue.metricsId ==
NumberOfParametersMetric.metricId &&
metricValue.level >= MetricValueLevel.warning)
.map(
(metricValue) => createIssue(
pattern: this,
location: nodeLocation(
node: entry.key.declaration,
source: source,
),
message: _compileMessage(
args: metricValue.value,
functionType: entry.key.type,
),
verboseMessage: _compileRecommendationMessage(
maximumArguments: _numberOfParametersMetricTreshold,
functionType: entry.key.type,
if (_numberOfParametersMetricTreshold != null)
...entry.value.metrics
.where((metricValue) =>
metricValue.metricsId ==
NumberOfParametersMetric.metricId &&
metricValue.value >
_numberOfParametersMetricTreshold!)
.map(
(metricValue) => createIssue(
pattern: this,
location: nodeLocation(
node: entry.key.declaration,
source: source,
),
message: _compileMessage(
args: metricValue.value,
functionType: entry.key.type,
),
verboseMessage: _compileRecommendationMessage(
maximumArguments: _numberOfParametersMetricTreshold,
functionType: entry.key.type,
),
),
),
),
if (_numberOfParametersMetricTreshold == null)
// ignore: deprecated_member_use_from_same_package
..._legacyBehaviour(source, entry),
Expand Down
2 changes: 1 addition & 1 deletion lib/src/utils/yaml_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ List<Object> yamlListToDartList(YamlList list) =>
Map<String, Object> yamlMapToDartMap(YamlMap map) =>
Map.unmodifiable(Map<String, Object>.fromEntries(map.nodes.keys
.whereType<YamlScalar>()
.where((key) => key.value is String)
.where((key) => key.value is String && map.nodes[key]?.value != null)
.map((key) => MapEntry(
key.value as String,
yamlNodeToDartObject(map.nodes[key]),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: dart_code_metrics
version: 4.3.1
version: 4.3.3
description: Software analytics tool that helps developers analyse and improve software quality.
homepage: https://dartcodemetrics.dev
repository: https://github.com/dart-code-checker/dart-code-metrics
Expand Down
4 changes: 4 additions & 0 deletions test/resources/analysis_options_repo.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
include: ./analysis_options_common.yaml

linter:
# rules:
# avoid_print: true

analyzer:
plugins:
- code_checker
Expand Down
4 changes: 2 additions & 2 deletions tools/analyzer_plugin/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: dart_code_metrics_plugin_loader
description: This pubspec determines the version of the analyzer plugin to load.
version: 4.3.1
version: 4.3.3

environment:
sdk: ">=2.12.0 <3.0.0"

dependencies:
dart_code_metrics: ^4.3.1
dart_code_metrics: ^4.3.3