File tree Expand file tree Collapse file tree 3 files changed +51
-0
lines changed
lib/src/services/correction
test/src/services/correction/fix/bulk Expand file tree Collapse file tree 3 files changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import 'dart:core';
8
8
import 'package:analysis_server/plugin/edit/fix/fix_dart.dart' ;
9
9
import 'package:analysis_server/src/services/correction/change_workspace.dart' ;
10
10
import 'package:analysis_server/src/services/correction/dart/abstract_producer.dart' ;
11
+ import 'package:analysis_server/src/services/correction/dart/add_override.dart' ;
11
12
import 'package:analysis_server/src/services/correction/dart/convert_documentation_into_line.dart' ;
12
13
import 'package:analysis_server/src/services/correction/dart/remove_const.dart' ;
13
14
import 'package:analysis_server/src/services/correction/dart/remove_unnecessary_new.dart' ;
@@ -27,6 +28,7 @@ class BulkFixProcessor {
27
28
/// correction producer used to build a fix for that diagnostic. The
28
29
/// generators used for non-lint diagnostics are in the [nonLintProducerMap] .
29
30
static const Map <String , ProducerGenerator > lintProducerMap = {
31
+ LintNames .annotate_overrides: AddOverride .newInstance,
30
32
LintNames .avoid_single_cascade_in_expression_statements:
31
33
ReplaceCascadeWithDot .newInstance,
32
34
LintNames .prefer_equal_for_default_values:
Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
2
+ // for details. All rights reserved. Use of this source code is governed by a
3
+ // BSD-style license that can be found in the LICENSE file.
4
+
5
+ import 'package:analysis_server/src/services/linter/lint_names.dart' ;
6
+ import 'package:test_reflective_loader/test_reflective_loader.dart' ;
7
+
8
+ import 'bulk_fix_processor.dart' ;
9
+
10
+ void main () {
11
+ defineReflectiveSuite (() {
12
+ defineReflectiveTests (AddOverrideTest );
13
+ });
14
+ }
15
+
16
+ @reflectiveTest
17
+ class AddOverrideTest extends BulkFixProcessorTest {
18
+ @override
19
+ String get lintCode => LintNames .annotate_overrides;
20
+
21
+ Future <void > test_singleFile () async {
22
+ await resolveTestUnit ('''
23
+ class A {
24
+ void a() {}
25
+ void aa() {}
26
+ }
27
+
28
+ class B extends A {
29
+ void a() {}
30
+ void aa() {}
31
+ }
32
+ ''' );
33
+ await assertHasFix ('''
34
+ class A {
35
+ void a() {}
36
+ void aa() {}
37
+ }
38
+
39
+ class B extends A {
40
+ @override
41
+ void a() {}
42
+ @override
43
+ void aa() {}
44
+ }
45
+ ''' );
46
+ }
47
+ }
Original file line number Diff line number Diff line change 4
4
5
5
import 'package:test_reflective_loader/test_reflective_loader.dart' ;
6
6
7
+ import 'add_override_test.dart' as add_override;
7
8
import 'convert_documentation_into_line_test.dart'
8
9
as convert_documentation_into_line;
9
10
import 'remove_unnecessary_const_test.dart' as remove_unnecessary_const;
@@ -12,6 +13,7 @@ import 'replace_colon_with_equals_test.dart' as replace_colon_with_equals;
12
13
13
14
void main () {
14
15
defineReflectiveSuite (() {
16
+ add_override.main ();
15
17
convert_documentation_into_line.main ();
16
18
remove_unnecessary_const.main ();
17
19
remove_unnecessary_new.main ();
You can’t perform that action at this time.
0 commit comments