Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import 'package:solid_lints/src/lints/number_of_parameters/visitors/number_of_pa
import 'package:solid_lints/src/models/solid_lint_rule.dart';

/// A number of parameters metric which checks whether we didn't exceed
/// the maximum allowed number of parameters for a function, method or
/// constructor.
/// the maximum allowed number of parameters for a function or method.
///
/// ### Example:
///
Expand Down Expand Up @@ -57,7 +56,7 @@ class NumberOfParametersRule
name: lintName,
description:
"Checks whether we didn't exceed the maximum allowed number "
'of parameters for a function, method or constructor.',
'of parameters for a function or method.',
parametersParser: NumberOfParametersParameters.fromJson,
);

Expand All @@ -76,6 +75,5 @@ class NumberOfParametersRule

registry.addFunctionDeclaration(this, visitor);
registry.addMethodDeclaration(this, visitor);
registry.addConstructorDeclaration(this, visitor);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import 'package:solid_lints/src/lints/number_of_parameters/models/number_of_para
import 'package:solid_lints/src/lints/number_of_parameters/number_of_parameters_rule.dart';
import 'package:solid_lints/src/utils/node_utils.dart';

/// A visitor that checks the number of parameters for functions, methods, and
/// constructors.
/// A visitor that checks the number of parameters for functions and methods.
class NumberOfParametersVisitor extends SimpleAstVisitor<void> {
final NumberOfParametersRule _rule;
final NumberOfParametersParameters _parameters;
Expand Down Expand Up @@ -38,9 +37,4 @@ class NumberOfParametersVisitor extends SimpleAstVisitor<void> {
if (isOverride(node.metadata)) return;
_check(node, node.parameters);
}

@override
void visitConstructorDeclaration(ConstructorDeclaration node) {
_check(node, node.parameters);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ class UserDto {
''');
}

Future<void> test_reports_on_constructors_exceeding_max_parameters() async {
await assertAutoDiagnostics('''
Future<void> test_does_not_report_on_constructors() async {
await assertNoDiagnostics(r'''
class Test {
Test${expectLint(r'(int a, int b, int c)')};
Test(int a, int b, int c);
}
''');
}
Expand Down