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
2 changes: 1 addition & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ linter:
rules:
- always_declare_return_types
- always_put_control_body_on_new_line
- always_put_required_named_parameters_first
# - always_put_required_named_parameters_first
# - always_specify_types
# - always_use_package_imports
- avoid_annotating_with_dynamic
Expand Down
14 changes: 4 additions & 10 deletions lib/src/analyzers/lint_analyzer/lint_analyzer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,11 @@ class LintAnalyzer {
final visitor = ScopeVisitor();
internalResult.unit.visitChildren(visitor);

final classMetrics = _checkClassMetrics(
visitor,
internalResult,
config,
);
final classMetrics =
_checkClassMetrics(visitor, internalResult, config);

final functionMetrics = _checkFunctionMetrics(
visitor,
internalResult,
config,
);
final functionMetrics =
_checkFunctionMetrics(visitor, internalResult, config);

final antiPatterns = _checkOnAntiPatterns(
ignores,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class CyclomaticComplexityMetric extends FunctionMetric<int> {

@override
MetricComputationResult<int> computeImplementation(
Declaration node,
AstNode node,
Iterable<ScopedClassDeclaration> classDeclarations,
Iterable<ScopedFunctionDeclaration> functionDeclarations,
InternalResolvedUnitResult source,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class HalsteadVolumeMetric extends FunctionMetric<double> {

@override
MetricComputationResult<double> computeImplementation(
Declaration node,
AstNode node,
Iterable<ScopedClassDeclaration> classDeclarations,
Iterable<ScopedFunctionDeclaration> functionDeclarations,
InternalResolvedUnitResult source,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class LinesOfCodeMetric extends FunctionMetric<int> {

@override
MetricComputationResult<int> computeImplementation(
Declaration node,
AstNode node,
Iterable<ScopedClassDeclaration> classDeclarations,
Iterable<ScopedFunctionDeclaration> functionDeclarations,
InternalResolvedUnitResult source,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class MaintainabilityIndexMetric extends FunctionMetric<int> {

@override
bool supports(
Declaration node,
AstNode node,
Iterable<ScopedClassDeclaration> classDeclarations,
Iterable<ScopedFunctionDeclaration> functionDeclarations,
InternalResolvedUnitResult source,
Expand All @@ -63,7 +63,7 @@ class MaintainabilityIndexMetric extends FunctionMetric<int> {

@override
MetricComputationResult<int> computeImplementation(
Declaration node,
AstNode node,
Iterable<ScopedClassDeclaration> classDeclarations,
Iterable<ScopedFunctionDeclaration> functionDeclarations,
InternalResolvedUnitResult source,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class MaximumNestingLevelMetric extends FunctionMetric<int> {

@override
MetricComputationResult<int> computeImplementation(
Declaration node,
AstNode node,
Iterable<ScopedClassDeclaration> classDeclarations,
Iterable<ScopedFunctionDeclaration> functionDeclarations,
InternalResolvedUnitResult source,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class NumberOfMethodsMetric extends ClassMetric<int> {

@override
MetricComputationResult<int> computeImplementation(
Declaration node,
AstNode node,
Iterable<ScopedClassDeclaration> classDeclarations,
Iterable<ScopedFunctionDeclaration> functionDeclarations,
InternalResolvedUnitResult source,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class NumberOfParametersMetric extends FunctionMetric<int> {

@override
bool supports(
Declaration node,
AstNode node,
Iterable<ScopedClassDeclaration> classDeclarations,
Iterable<ScopedFunctionDeclaration> functionDeclarations,
InternalResolvedUnitResult source,
Expand All @@ -61,7 +61,7 @@ class NumberOfParametersMetric extends FunctionMetric<int> {

@override
MetricComputationResult<int> computeImplementation(
Declaration node,
AstNode node,
Iterable<ScopedClassDeclaration> classDeclarations,
Iterable<ScopedFunctionDeclaration> functionDeclarations,
InternalResolvedUnitResult source,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class SourceLinesOfCodeMetric extends FunctionMetric<int> {

@override
MetricComputationResult<int> computeImplementation(
Declaration node,
AstNode node,
Iterable<ScopedClassDeclaration> classDeclarations,
Iterable<ScopedFunctionDeclaration> functionDeclarations,
InternalResolvedUnitResult source,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class WeightOfClassMetric extends ClassMetric<double> {

@override
bool supports(
Declaration node,
AstNode node,
Iterable<ScopedClassDeclaration> classDeclarations,
Iterable<ScopedFunctionDeclaration> functionDeclarations,
InternalResolvedUnitResult source,
Expand All @@ -59,7 +59,7 @@ class WeightOfClassMetric extends ClassMetric<double> {

@override
MetricComputationResult<double> computeImplementation(
Declaration node,
AstNode node,
Iterable<ScopedClassDeclaration> classDeclarations,
Iterable<ScopedFunctionDeclaration> functionDeclarations,
InternalResolvedUnitResult source,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ abstract class ClassMetric<T extends num> extends Metric<T> {

@override
String? nodeType(
Declaration node,
AstNode node,
Iterable<ScopedClassDeclaration> classDeclarations,
Iterable<ScopedFunctionDeclaration> functionDeclarations,
) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ abstract class FunctionMetric<T extends num> extends Metric<T> {

@override
String? nodeType(
Declaration node,
AstNode node,
Iterable<ScopedClassDeclaration> classDeclarations,
Iterable<ScopedFunctionDeclaration> functionDeclarations,
) =>
Expand Down
8 changes: 4 additions & 4 deletions lib/src/analyzers/lint_analyzer/metrics/models/metric.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ abstract class Metric<T extends num> {

/// Returns true if the metric can be computed on this [node].
bool supports(
Declaration node,
AstNode node,
Iterable<ScopedClassDeclaration> classDeclarations,
Iterable<ScopedFunctionDeclaration> functionDeclarations,
InternalResolvedUnitResult source,
Expand All @@ -45,7 +45,7 @@ abstract class Metric<T extends num> {

/// Returns the computed [MetricValue] for the given [node].
MetricValue<T> compute(
Declaration node,
AstNode node,
Iterable<ScopedClassDeclaration> classDeclarations,
Iterable<ScopedFunctionDeclaration> functionDeclarations,
InternalResolvedUnitResult source,
Expand Down Expand Up @@ -75,7 +75,7 @@ abstract class Metric<T extends num> {
/// Returns the internal metric model [MetricComputationResult] for the given [node].
@protected
MetricComputationResult<T> computeImplementation(
Declaration node,
AstNode node,
Iterable<ScopedClassDeclaration> classDeclarations,
Iterable<ScopedFunctionDeclaration> functionDeclarations,
InternalResolvedUnitResult source,
Expand All @@ -94,7 +94,7 @@ abstract class Metric<T extends num> {
/// Returns human readable type of [node]
@protected
String? nodeType(
Declaration node,
AstNode node,
Iterable<ScopedClassDeclaration> classDeclarations,
Iterable<ScopedFunctionDeclaration> functionDeclarations,
);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/analyzers/lint_analyzer/metrics/scope_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import '../models/scoped_function_declaration.dart';

/// Returns functions belonging to the passed [classNode]
Iterable<ScopedFunctionDeclaration> classMethods(
Declaration? classNode,
AstNode? classNode,
Iterable<ScopedFunctionDeclaration> functionDeclarations,
) =>
functionDeclarations
Expand Down
2 changes: 1 addition & 1 deletion lib/src/analyzers/lint_analyzer/models/report.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Report {
final SourceSpan location;

/// The node that represents a dart code snippet in the AST structure.
final Declaration declaration;
final AstNode declaration;

/// Target entity metrics.
final Iterable<MetricValue<num>> metrics;
Expand Down