Skip to content

Commit 0dc73f3

Browse files
committed
Merge branch 'master' into update-dependencies
2 parents 2fa288a + 05be4fa commit 0dc73f3

File tree

6 files changed

+112
-3
lines changed

6 files changed

+112
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
- `number_of_parameters`
99
- BREAKING CHANGE: Renamed `excludeNames` parameter to `exclude` for `function_lines_of_code` lint.
1010
- Fixed an issue with `prefer_early_retrun` for throw expression
11-
- Update `analyzer` dependency to 7.1.0
12-
- Update `custom_lint_builder` dependency to 0.7.1
11+
- `number_of_parameters` lint: added `copyWith` to the default exclude list.
12+
- Update `analyzer` dependency to 7.1.0
13+
- Update `custom_lint_builder` dependency to 0.7.1
1314

1415
## 0.2.3
1516

lib/analysis_options.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ custom_lint:
8585

8686
- number_of_parameters:
8787
max_parameters: 7
88+
exclude:
89+
- method_name: copyWith
8890

8991
- prefer_conditional_expressions:
9092
ignore_nested: true

lint_test/analysis_options.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ custom_lint:
1515
exclude:
1616
- class_name: Exclude
1717
method_name: avoidNumberOfParameters
18-
- method_name: avoidNumberOfParameters
18+
- method_name: avoidNumberOfParameters
1919
- function_lines_of_code:
2020
max_lines: 50
2121
- avoid_non_null_assertion
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include: ../../lib/analysis_options.yaml
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
// ignore_for_file: prefer_match_file_name, public_member_api_docs
2+
// Check number of parameters fail
3+
///
4+
/// `number_of_parameters: max_parameters`
5+
6+
class UserDto {
7+
final String a;
8+
final String b;
9+
final String c;
10+
final String d;
11+
final String e;
12+
final String f;
13+
final String g;
14+
final String h;
15+
16+
const UserDto({
17+
required this.a,
18+
required this.b,
19+
required this.c,
20+
required this.d,
21+
required this.e,
22+
required this.f,
23+
required this.g,
24+
required this.h,
25+
});
26+
27+
/// Excluded by method_name
28+
UserDto copyWith({
29+
String? a,
30+
String? b,
31+
String? c,
32+
String? d,
33+
String? e,
34+
String? f,
35+
String? g,
36+
String? h,
37+
}) {
38+
return UserDto(
39+
a: a ?? this.a,
40+
b: b ?? this.b,
41+
c: c ?? this.c,
42+
d: d ?? this.d,
43+
e: e ?? this.e,
44+
f: f ?? this.f,
45+
g: g ?? this.g,
46+
h: h ?? this.h,
47+
);
48+
}
49+
50+
/// expect_lint: number_of_parameters
51+
UserDto noCopyWith({
52+
String? a,
53+
String? b,
54+
String? c,
55+
String? d,
56+
String? e,
57+
String? f,
58+
String? g,
59+
String? h,
60+
}) {
61+
return UserDto(
62+
a: a ?? this.a,
63+
b: b ?? this.b,
64+
c: c ?? this.c,
65+
d: d ?? this.d,
66+
e: e ?? this.e,
67+
f: f ?? this.f,
68+
g: g ?? this.g,
69+
h: h ?? this.h,
70+
);
71+
}
72+
73+
/// Allow
74+
UserDto noLongCopyWith({
75+
String? a,
76+
String? b,
77+
String? c,
78+
}) {
79+
return UserDto(
80+
a: a ?? this.a,
81+
b: b ?? this.b,
82+
c: c ?? this.c,
83+
d: '',
84+
e: '',
85+
f: '',
86+
g: '',
87+
h: '',
88+
);
89+
}
90+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: solid_lints_number_of_parameters_copy_with_test
2+
description: A starting point for Dart libraries or applications.
3+
publish_to: none
4+
5+
environment:
6+
sdk: '>=3.0.0 <4.0.0'
7+
8+
dependencies:
9+
flutter:
10+
sdk: flutter
11+
12+
dev_dependencies:
13+
solid_lints:
14+
path: ../../
15+
test: ^1.20.1

0 commit comments

Comments
 (0)