Skip to content
This repository was archived by the owner on Jul 16, 2023. It is now read-only.

Commit 0fdc6f9

Browse files
authored
fix: check-unused-files now ignored some system files (#671)
* fix: `check-unused-files` now ignored some system files * chore: code review fixes * chore: revert
1 parent 69a62c9 commit 0fdc6f9

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
* feat: add new command flag `--no-congratulate`.
66
* feat: add `--version` flag to print current version of the package.
7+
* feat: improve `check-unused-files` and `check-unused-code` commands, add support for flutter internal entry functions.
78
* fix: make `check-unused-l10n` also cover supertype member calls.
89
* fix: cyclomatic complexity calculation for functions with internal lambdas.
910
* chore: restrict `analyzer` version to `>=2.4.0 <3.3.0`.

lib/src/utils/node_utils.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ SourceSpan nodeLocation({
3737
}
3838

3939
bool isEntrypoint(String name, NodeList<Annotation> metadata) =>
40-
name == 'main' || _hasPragmaAnnotation(metadata);
40+
name == 'main' ||
41+
_hasPragmaAnnotation(metadata) ||
42+
_flutterInternalEntryFunctions.contains(name);
43+
44+
const _flutterInternalEntryFunctions = {'registerPlugins', 'testExecutable'};
4145

4246
/// See https://github.com/dart-lang/sdk/blob/master/runtime/docs/compiler/aot/entry_point_pragma.md
4347
bool _hasPragmaAnnotation(Iterable<Annotation> metadata) =>

0 commit comments

Comments
 (0)