Skip to content

Commit 9a7bd7c

Browse files
Yurii PrykhodkoYurii Prykhodko
authored andcommitted
Merge branch 'master' into Issue-190-implement-use_nearest_context-rule
2 parents c6a5969 + 52d0875 commit 9a7bd7c

File tree

9 files changed

+127
-13
lines changed

9 files changed

+127
-13
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
## 0.3.0
2+
23
- Added `exclude` parameter for the following lints:
34
- `avoid_returning_widgets`
45
- `avoid_unused_parameters`
@@ -8,6 +9,11 @@
89
- `number_of_parameters`
910
- BREAKING CHANGE: Renamed `excludeNames` parameter to `exclude` for `function_lines_of_code` lint.
1011
- Fixed an issue with `prefer_early_retrun` for throw expression
12+
- `number_of_parameters` lint: added `copyWith` to the default exclude list.
13+
- Update dependencies:
14+
- Update min Dart SDK constraint to 3.5.0
15+
- Update `analyzer` dependency to 7.1.0
16+
- Update `custom_lint_builder` dependency to 0.7.1
1117
- Added `use_nearest_context` rule
1218

1319
## 0.2.3

example/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dependencies:
1010
sdk: flutter
1111

1212
dev_dependencies:
13-
custom_lint: ^0.6.7
13+
custom_lint: ^0.7.1
1414
solid_lints:
1515
path: ../
16-
test: ^1.20.1
16+
test: ^1.25.14

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

lib/src/utils/types_utils.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ bool _isSubclassOfWidget(DartType? type) =>
147147
type is InterfaceType && type.allSupertypes.any(_isWidget);
148148

149149
// ignore: deprecated_member_use
150-
bool _isWidgetState(DartType? type) => type?.element2?.displayName == 'State';
150+
bool _isWidgetState(DartType? type) => type?.element?.displayName == 'State';
151151

152152
bool _isSubclassOfWidgetState(DartType? type) =>
153153
type is InterfaceType && type.allSupertypes.any(_isWidgetState);

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

pubspec.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ documentation: https://solid-software.github.io/solid_lints/docs/intro
88
topics: [lints, linter, lint, analysis, analyzer]
99

1010
environment:
11-
sdk: ">=3.0.0 <4.0.0"
11+
sdk: ">=3.5.0 <4.0.0"
1212

1313
dependencies:
14-
analyzer: ^6.7.0
15-
collection: ^1.17.2
16-
custom_lint_builder: ^0.6.7
17-
glob: ^2.1.2
18-
path: ^1.8.3
19-
yaml: ^3.1.2
14+
analyzer: ^7.1.0
15+
collection: ^1.19.0
16+
custom_lint_builder: ^0.7.1
17+
glob: ^2.1.3
18+
path: ^1.9.1
19+
yaml: ^3.1.3
2020

2121
dev_dependencies:
22-
args: ^2.4.2
22+
args: ^2.6.0
2323
# These packages are mandatory for some of tests
2424
flutter:
2525
sdk: flutter
26-
test: ^1.24.6
26+
test: ^1.25.14

0 commit comments

Comments
 (0)