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 55* fix: ignore private variables in ` avoid-global-state ` rule.
66* feat: support excludes for a separate anti-pattern.
77* chore: restrict ` analyzer ` version to ` >=2.4.0 <3.2.0 ` .
8+ * feat: ignore private members for ` check-unused-l10n ` command.
89
910## 4.9.1
1011
Original file line number Diff line number Diff line change @@ -168,7 +168,7 @@ class UnusedL10nAnalyzer {
168168 CompilationUnitElement unit,
169169 ) {
170170 final unusedAccessors = classElement.accessors
171- .where ((field) => ! usages.contains (field.name))
171+ .where ((field) => ! field.isPrivate && ! usages.contains (field.name))
172172 .map ((field) => field.isSynthetic ? field.nonSynthetic : field);
173173
174174 return unusedAccessors
@@ -182,7 +182,7 @@ class UnusedL10nAnalyzer {
182182 CompilationUnitElement unit,
183183 ) {
184184 final unusedMethods = classElement.methods
185- .where ((method) => ! usages.contains (method.name))
185+ .where ((method) => ! method.isPrivate && ! usages.contains (method.name))
186186 .map ((method) => method.isSynthetic ? method.nonSynthetic : method);
187187
188188 return unusedMethods
Original file line number Diff line number Diff line change @@ -50,6 +50,12 @@ class S {
5050
5151 // ignore: prefer_constructors_over_static_methods
5252 static S get current => S ();
53+
54+ static const _privateField = 'hello' ;
55+
56+ String get _privateGetter => 'regular getter' ;
57+
58+ String _privateMethod () => 'hi' ;
5359}
5460
5561class L10nClass {
You can’t perform that action at this time.
0 commit comments