bulk fix for `unnecessary_brace_in_string_interps`
Change-Id: I47e846994d727d84564ba8f7daf7a8e6334417c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158143
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart b/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
index 72328fa..bb4ce51 100644
--- a/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
+++ b/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
@@ -29,6 +29,7 @@
import 'package:analysis_server/src/services/correction/dart/remove_empty_else.dart';
import 'package:analysis_server/src/services/correction/dart/remove_empty_statement.dart';
import 'package:analysis_server/src/services/correction/dart/remove_initializer.dart';
+import 'package:analysis_server/src/services/correction/dart/remove_interpolation_braces.dart';
import 'package:analysis_server/src/services/correction/dart/remove_method_declaration.dart';
import 'package:analysis_server/src/services/correction/dart/remove_operator.dart';
import 'package:analysis_server/src/services/correction/dart/remove_this_expression.dart';
@@ -98,6 +99,8 @@
LintNames.slash_for_doc_comments: ConvertDocumentationIntoLine.newInstance,
LintNames.type_init_formals: RemoveTypeAnnotation.newInstance,
LintNames.unawaited_futures: AddAwait.newInstance,
+ LintNames.unnecessary_brace_in_string_interps:
+ RemoveInterpolationBraces.newInstance,
LintNames.unnecessary_const: RemoveUnnecessaryConst.newInstance,
LintNames.unnecessary_lambdas: ReplaceWithTearOff.newInstance,
LintNames.unnecessary_new: RemoveUnnecessaryNew.newInstance,
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_interpolation_braces_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_interpolation_braces_test.dart
new file mode 100644
index 0000000..5060050
--- /dev/null
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_interpolation_braces_test.dart
@@ -0,0 +1,35 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analysis_server/src/services/linter/lint_names.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'bulk_fix_processor.dart';
+
+void main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(RemoveInterpolationBracesTest);
+ });
+}
+
+@reflectiveTest
+class RemoveInterpolationBracesTest extends BulkFixProcessorTest {
+ @override
+ String get lintCode => LintNames.unnecessary_brace_in_string_interps;
+
+ Future<void> test_singleFile() async {
+ await resolveTestUnit(r'''
+main() {
+ var v = 42;
+ print('v: ${ v}, ${ v}');
+}
+''');
+ await assertHasFix(r'''
+main() {
+ var v = 42;
+ print('v: $v, $v');
+}
+''');
+ }
+}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/test_all.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/test_all.dart
index b7a2148..7f0b31c 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/test_all.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/test_all.dart
@@ -28,6 +28,7 @@
import 'remove_empty_else_test.dart' as remove_empty_else;
import 'remove_empty_statement_test.dart' as remove_empty_statement;
import 'remove_initializer_test.dart' as remove_initializer;
+import 'remove_interpolation_braces_test.dart' as remove_interpolation_braces;
import 'remove_method_declaration_test.dart' as remove_method_declaration;
import 'remove_operator_test.dart' as remove_operator;
import 'remove_this_expression_test.dart' as remove_this_expression;
@@ -67,6 +68,7 @@
remove_empty_constructor_body.main();
remove_empty_else.main();
remove_empty_statement.main();
+ remove_interpolation_braces.main();
remove_method_declaration.main();
remove_operator.main();
remove_this_expression.main();