Skip to content

Commit 79dfb5b

Browse files
committed
Added number_of_parameters rule copyWith test
1 parent d3c0396 commit 79dfb5b

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

lint_test/analysis_options.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ custom_lint:
1515
exclude:
1616
- class_name: Exclude
1717
method_name: avoidNumberOfParameters
18-
- method_name: avoidNumberOfParameters
18+
- method_name: avoidNumberOfParameters
19+
- method_name: copyWith
1920
- function_lines_of_code:
2021
max_lines: 50
2122
- avoid_non_null_assertion

lint_test/number_of_parameters_test.dart

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,28 @@ class Exclude {
1818
return a + b + c;
1919
}
2020
}
21+
22+
class UserDto {
23+
final String email;
24+
final String firstName;
25+
final String id;
26+
27+
const UserDto({
28+
required this.email,
29+
required this.firstName,
30+
required this.id,
31+
});
32+
33+
/// Excluded by method_name
34+
UserDto copyWith({
35+
String? email,
36+
String? firstName,
37+
String? id,
38+
}) {
39+
return UserDto(
40+
email: email ?? this.email,
41+
firstName: firstName ?? this.firstName,
42+
id: id ?? this.id,
43+
);
44+
}
45+
}

0 commit comments

Comments
 (0)