This repository was archived by the owner on Jul 16, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +9
-2
lines changed
lib/src/analyzers/unused_l10n_analyzer
test/resources/unused_l10n_analyzer Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 5
5
* fix: ignore private variables in ` avoid-global-state ` rule.
6
6
* feat: support excludes for a separate anti-pattern.
7
7
* chore: restrict ` analyzer ` version to ` >=2.4.0 <3.2.0 ` .
8
+ * feat: ignore private members for ` check-unused-l10n ` command.
8
9
9
10
## 4.9.1
10
11
Original file line number Diff line number Diff line change @@ -168,7 +168,7 @@ class UnusedL10nAnalyzer {
168
168
CompilationUnitElement unit,
169
169
) {
170
170
final unusedAccessors = classElement.accessors
171
- .where ((field) => ! usages.contains (field.name))
171
+ .where ((field) => ! field.isPrivate && ! usages.contains (field.name))
172
172
.map ((field) => field.isSynthetic ? field.nonSynthetic : field);
173
173
174
174
return unusedAccessors
@@ -182,7 +182,7 @@ class UnusedL10nAnalyzer {
182
182
CompilationUnitElement unit,
183
183
) {
184
184
final unusedMethods = classElement.methods
185
- .where ((method) => ! usages.contains (method.name))
185
+ .where ((method) => ! method.isPrivate && ! usages.contains (method.name))
186
186
.map ((method) => method.isSynthetic ? method.nonSynthetic : method);
187
187
188
188
return unusedMethods
Original file line number Diff line number Diff line change @@ -50,6 +50,12 @@ class S {
50
50
51
51
// ignore: prefer_constructors_over_static_methods
52
52
static S get current => S ();
53
+
54
+ static const _privateField = 'hello' ;
55
+
56
+ String get _privateGetter => 'regular getter' ;
57
+
58
+ String _privateMethod () => 'hi' ;
53
59
}
54
60
55
61
class L10nClass {
You can’t perform that action at this time.
0 commit comments