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';
88import 'package:analysis_server/plugin/edit/fix/fix_dart.dart' ;
99import 'package:analysis_server/src/services/correction/change_workspace.dart' ;
1010import 'package:analysis_server/src/services/correction/dart/abstract_producer.dart' ;
11+ import 'package:analysis_server/src/services/correction/dart/add_override.dart' ;
1112import 'package:analysis_server/src/services/correction/dart/convert_documentation_into_line.dart' ;
1213import 'package:analysis_server/src/services/correction/dart/remove_const.dart' ;
1314import 'package:analysis_server/src/services/correction/dart/remove_unnecessary_new.dart' ;
@@ -27,6 +28,7 @@ class BulkFixProcessor {
2728 /// correction producer used to build a fix for that diagnostic. The
2829 /// generators used for non-lint diagnostics are in the [nonLintProducerMap] .
2930 static const Map <String , ProducerGenerator > lintProducerMap = {
31+ LintNames .annotate_overrides: AddOverride .newInstance,
3032 LintNames .avoid_single_cascade_in_expression_statements:
3133 ReplaceCascadeWithDot .newInstance,
3234 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 44
55import 'package:test_reflective_loader/test_reflective_loader.dart' ;
66
7+ import 'add_override_test.dart' as add_override;
78import 'convert_documentation_into_line_test.dart'
89 as convert_documentation_into_line;
910import '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;
1213
1314void main () {
1415 defineReflectiveSuite (() {
16+ add_override.main ();
1517 convert_documentation_into_line.main ();
1618 remove_unnecessary_const.main ();
1719 remove_unnecessary_new.main ();
You can’t perform that action at this time.
0 commit comments