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 +10
-1
lines changed
lib/src/analyzers/lint_analyzer/rules/rules_list/avoid_redundant_async
test/src/analyzers/lint_analyzer/rules/rules_list/avoid_redundant_async/examples Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 14
14
* feat: ** Breaking change** cleanup public API.
15
15
* chore: restrict ` analyzer ` version to ` >=5.1.0 <5.3.0 ` .
16
16
* feat: add ` print-config ` option to all commands.
17
+ * fix: ignore ` @override ` methods for [ ` avoid-redundant-async ` ] ( https://dartcodemetrics.dev/docs/rules/common/avoid-redundant-async ) .
17
18
18
19
## 4.21.2
19
20
Original file line number Diff line number Diff line change @@ -9,7 +9,12 @@ class _Visitor extends RecursiveAstVisitor<void> {
9
9
void visitMethodDeclaration (MethodDeclaration node) {
10
10
super .visitMethodDeclaration (node);
11
11
12
- if (_hasRedundantAsync (node.body)) {
12
+ final isOverride = node.metadata.any (
13
+ (node) =>
14
+ node.name.name == 'override' && node.atSign.type == TokenType .AT ,
15
+ );
16
+
17
+ if (! isOverride && _hasRedundantAsync (node.body)) {
13
18
_declarations.add (node);
14
19
}
15
20
}
Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ class SomeClass {
21
21
// LINT
22
22
Future <String > anotherAsyncMethod () async => Future .value ('value' );
23
23
24
+ @override
25
+ Future <String > overrideMethod () async => Future .value ('value' );
26
+
24
27
Future <String > someAsyncMethod (Future <String > later) => later;
25
28
26
29
Future <void > report (Iterable <String > records) async {
You can’t perform that action at this time.
0 commit comments