Unverified Commit 197b440e authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Migrate out custom ignore syntax to flutter_ignore (#78497)

parent a7e3b1a3
...@@ -126,7 +126,7 @@ Future<void> run(List<String> arguments) async { ...@@ -126,7 +126,7 @@ Future<void> run(List<String> arguments) async {
// TESTS // TESTS
final RegExp _findDeprecationPattern = RegExp(r'@[Dd]eprecated'); final RegExp _findDeprecationPattern = RegExp(r'@[Dd]eprecated');
final RegExp _deprecationPattern1 = RegExp(r'^( *)@Deprecated\($'); // ignore: flutter_deprecation_syntax (see analyze.dart) final RegExp _deprecationPattern1 = RegExp(r'^( *)@Deprecated\($'); // flutter_ignore: deprecation_syntax (see analyze.dart)
final RegExp _deprecationPattern2 = RegExp(r"^ *'(.+) '$"); final RegExp _deprecationPattern2 = RegExp(r"^ *'(.+) '$");
final RegExp _deprecationPattern3 = RegExp(r"^ *'This feature was deprecated after v([0-9]+)\.([0-9]+)\.([0-9]+)(\-[0-9]+\.[0-9]+\.pre)?\.'$"); final RegExp _deprecationPattern3 = RegExp(r"^ *'This feature was deprecated after v([0-9]+)\.([0-9]+)\.([0-9]+)(\-[0-9]+\.[0-9]+\.pre)?\.'$");
final RegExp _deprecationPattern4 = RegExp(r'^ *\)$'); final RegExp _deprecationPattern4 = RegExp(r'^ *\)$');
...@@ -136,10 +136,10 @@ final RegExp _deprecationPattern4 = RegExp(r'^ *\)$'); ...@@ -136,10 +136,10 @@ final RegExp _deprecationPattern4 = RegExp(r'^ *\)$');
/// (One example would be a library that intentionally conflicts with a member in another /// (One example would be a library that intentionally conflicts with a member in another
/// library to indicate that it is incompatible with that other library. Another would be /// library to indicate that it is incompatible with that other library. Another would be
/// the regexp just above...) /// the regexp just above...)
const String _ignoreDeprecation = ' // ignore: flutter_deprecation_syntax (see analyze.dart)'; const String _ignoreDeprecation = ' // flutter_ignore: deprecation_syntax (see analyze.dart)';
/// Some deprecation notices are exempt for historical reasons. They must have an issue listed. /// Some deprecation notices are exempt for historical reasons. They must have an issue listed.
final RegExp _legacyDeprecation = RegExp(r' // ignore: flutter_deprecation_syntax, https://github.com/flutter/flutter/issues/[0-9]+$'); final RegExp _legacyDeprecation = RegExp(r' // flutter_ignore: deprecation_syntax, https://github.com/flutter/flutter/issues/[0-9]+$');
Future<void> verifyDeprecations(String workingDirectory, { int minimumMatches = 2000 }) async { Future<void> verifyDeprecations(String workingDirectory, { int minimumMatches = 2000 }) async {
final List<String> errors = <String>[]; final List<String> errors = <String>[];
......
...@@ -26,7 +26,7 @@ final RegExp ignoreForFilePattern = RegExp(r'// *ignore_for_file:'); ...@@ -26,7 +26,7 @@ final RegExp ignoreForFilePattern = RegExp(r'// *ignore_for_file:');
final RegExp asDynamicPattern = RegExp(r'\bas dynamic\b'); final RegExp asDynamicPattern = RegExp(r'\bas dynamic\b');
final RegExp deprecationPattern = RegExp(r'^ *@[dD]eprecated'); final RegExp deprecationPattern = RegExp(r'^ *@[dD]eprecated');
const Pattern globalsPattern = 'globals.'; const Pattern globalsPattern = 'globals.';
const String legacyDeprecationPattern = '// ignore: flutter_deprecation_syntax, https'; const String legacyDeprecationPattern = '// flutter_ignore: deprecation_syntax, https';
Future<double> findCostsForFile(File file) async { Future<double> findCostsForFile(File file) async {
if (path.extension(file.path) == '.py') if (path.extension(file.path) == '.py')
......
...@@ -803,7 +803,7 @@ abstract class ScrollPosition extends ViewportOffset with ScrollMetrics { ...@@ -803,7 +803,7 @@ abstract class ScrollPosition extends ViewportOffset with ScrollMetrics {
bool get allowImplicitScrolling => physics.allowImplicitScrolling; bool get allowImplicitScrolling => physics.allowImplicitScrolling;
/// Deprecated. Use [jumpTo] or a custom [ScrollPosition] instead. /// Deprecated. Use [jumpTo] or a custom [ScrollPosition] instead.
@Deprecated('This will lead to bugs.') // ignore: flutter_deprecation_syntax, https://github.com/flutter/flutter/issues/44609 @Deprecated('This will lead to bugs.') // flutter_ignore: deprecation_syntax, https://github.com/flutter/flutter/issues/44609
void jumpToWithoutSettling(double value); void jumpToWithoutSettling(double value);
/// Stop the current activity and start a [HoldScrollActivity]. /// Stop the current activity and start a [HoldScrollActivity].
......
...@@ -224,7 +224,7 @@ class ScrollPositionWithSingleContext extends ScrollPosition implements ScrollAc ...@@ -224,7 +224,7 @@ class ScrollPositionWithSingleContext extends ScrollPosition implements ScrollAc
} }
@Deprecated('This will lead to bugs.') // ignore: flutter_deprecation_syntax, https://github.com/flutter/flutter/issues/44609 @Deprecated('This will lead to bugs.') // flutter_ignore: deprecation_syntax, https://github.com/flutter/flutter/issues/44609
@override @override
void jumpToWithoutSettling(double value) { void jumpToWithoutSettling(double value) {
goIdle(); goIdle();
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import 'package:flutter/scheduler.dart'; import 'package:flutter/scheduler.dart';
@Deprecated('scheduler_tester is not compatible with dart:async') // ignore: flutter_deprecation_syntax (see analyze.dart) @Deprecated('scheduler_tester is not compatible with dart:async') // flutter_ignore: deprecation_syntax (see analyze.dart)
class Future { } // so that people can't import us and dart:async class Future { } // so that people can't import us and dart:async
void tick(Duration duration) { void tick(Duration duration) {
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
// @dart = 2.8 // @dart = 2.8
// Do not add package imports to this file. // Do not add package imports to this file.
import 'dart:convert'; // ignore: dart_convert_import. import 'dart:convert'; // flutter_ignore: dart_convert_import.
import 'dart:io'; // ignore: dart_io_import. import 'dart:io'; // flutter_ignore: dart_io_import.
/// Executes the required flutter tasks for a desktop build. /// Executes the required flutter tasks for a desktop build.
Future<void> main(List<String> arguments) async { Future<void> main(List<String> arguments) async {
......
...@@ -10,7 +10,7 @@ import 'dart:typed_data'; ...@@ -10,7 +10,7 @@ import 'dart:typed_data';
import 'package:file/file.dart'; import 'package:file/file.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
import 'package:path/path.dart' as p; // ignore: package_path_import import 'package:path/path.dart' as p; // flutter_ignore: package_path_import
import 'package:process/process.dart'; import 'package:process/process.dart';
import '../reporting/reporting.dart'; import '../reporting/reporting.dart';
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
import 'package:package_config/package_config.dart'; import 'package:package_config/package_config.dart';
import 'package:path/path.dart' as path; // ignore: package_path_import import 'package:path/path.dart' as path; // flutter_ignore: package_path_import
import 'package:yaml/yaml.dart'; import 'package:yaml/yaml.dart';
import 'android/gradle.dart'; import 'android/gradle.dart';
...@@ -1115,7 +1115,7 @@ const String _dartPluginRegistryForDesktopTemplate = ''' ...@@ -1115,7 +1115,7 @@ const String _dartPluginRegistryForDesktopTemplate = '''
// @dart = {{dartLanguageVersion}} // @dart = {{dartLanguageVersion}}
import '{{mainEntrypoint}}' as entrypoint; import '{{mainEntrypoint}}' as entrypoint;
import 'dart:io'; // ignore: dart_io_import. import 'dart:io'; // flutter_ignore: dart_io_import.
{{#linux}} {{#linux}}
import 'package:{{pluginName}}/{{pluginName}}.dart'; import 'package:{{pluginName}}/{{pluginName}}.dart';
{{/linux}} {{/linux}}
......
...@@ -130,8 +130,8 @@ String generateTestBootstrap({ ...@@ -130,8 +130,8 @@ String generateTestBootstrap({
buffer.write(''' buffer.write('''
$languageVersionHeader $languageVersionHeader
import 'dart:async'; import 'dart:async';
import 'dart:convert'; // ignore: dart_convert_import import 'dart:convert'; // flutter_ignore: dart_convert_import
import 'dart:io'; // ignore: dart_io_import import 'dart:io'; // flutter_ignore: dart_io_import
import 'dart:isolate'; import 'dart:isolate';
'''); ''');
if (flutterTestDep) { if (flutterTestDep) {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
// @dart = 2.8 // @dart = 2.8
import 'dart:async'; import 'dart:async';
import 'dart:io' as io; // ignore: dart_io_import; import 'dart:io' as io; // flutter_ignore: dart_io_import;
import 'package:dds/dds.dart'; import 'package:dds/dds.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
......
...@@ -150,8 +150,8 @@ class TestGoldenComparatorProcess { ...@@ -150,8 +150,8 @@ class TestGoldenComparatorProcess {
final File testConfigFile = findTestConfigFile(globals.fs.file(testUri)); final File testConfigFile = findTestConfigFile(globals.fs.file(testUri));
// Generate comparator process for the file. // Generate comparator process for the file.
return ''' return '''
import 'dart:convert'; // ignore: dart_convert_import import 'dart:convert'; // flutter_ignore: dart_convert_import
import 'dart:io'; // ignore: dart_io_import import 'dart:io'; // flutter_ignore: dart_io_import
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// @dart = 2.8 // @dart = 2.8
import 'dart:io' as io; // ignore: dart_io_import; import 'dart:io' as io; // flutter_ignore: dart_io_import;
import 'package:file/file.dart'; import 'package:file/file.dart';
import 'package:file/memory.dart'; import 'package:file/memory.dart';
...@@ -17,7 +17,7 @@ import 'package:flutter_tools/src/base/platform.dart'; ...@@ -17,7 +17,7 @@ import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/globals.dart' as globals show flutterUsage; import 'package:flutter_tools/src/globals.dart' as globals show flutterUsage;
import 'package:flutter_tools/src/reporting/reporting.dart'; import 'package:flutter_tools/src/reporting/reporting.dart';
import 'package:mockito/mockito.dart'; import 'package:mockito/mockito.dart';
import 'package:path/path.dart' as path; // ignore: package_path_import import 'package:path/path.dart' as path; // flutter_ignore: package_path_import
import 'package:process/process.dart'; import 'package:process/process.dart';
import '../../src/common.dart'; import '../../src/common.dart';
......
...@@ -1919,7 +1919,7 @@ void main() { ...@@ -1919,7 +1919,7 @@ void main() {
'// @dart = 2.8\n' '// @dart = 2.8\n'
'\n' '\n'
'import \'package:app/main.dart\' as entrypoint;\n' 'import \'package:app/main.dart\' as entrypoint;\n'
'import \'dart:io\'; // ignore: dart_io_import.\n' 'import \'dart:io\'; // flutter_ignore: dart_io_import.\n'
'import \'package:url_launcher_linux${fs.path.separator}url_launcher_linux.dart\';\n' 'import \'package:url_launcher_linux${fs.path.separator}url_launcher_linux.dart\';\n'
'import \'package:awesome_macos/awesome_macos.dart\';\n' 'import \'package:awesome_macos/awesome_macos.dart\';\n'
'import \'package:url_launcher_macos${fs.path.separator}url_launcher_macos.dart\';\n' 'import \'package:url_launcher_macos${fs.path.separator}url_launcher_macos.dart\';\n'
......
...@@ -77,7 +77,7 @@ void main() { ...@@ -77,7 +77,7 @@ void main() {
for (final File file in files) { for (final File file in files) {
for (final String line in file.readAsLinesSync()) { for (final String line in file.readAsLinesSync()) {
if (line.startsWith(RegExp(r'import.*dart:io')) && if (line.startsWith(RegExp(r'import.*dart:io')) &&
!line.contains('ignore: dart_io_import')) { !line.contains('flutter_ignore: dart_io_import')) {
final String relativePath = fileSystem.path.relative(file.path, from:flutterTools); final String relativePath = fileSystem.path.relative(file.path, from:flutterTools);
fail("$relativePath imports 'dart:io'; import 'lib/src/base/io.dart' instead"); fail("$relativePath imports 'dart:io'; import 'lib/src/base/io.dart' instead");
} }
...@@ -102,7 +102,7 @@ void main() { ...@@ -102,7 +102,7 @@ void main() {
for (final File file in files) { for (final File file in files) {
for (final String line in file.readAsLinesSync()) { for (final String line in file.readAsLinesSync()) {
if (line.startsWith(RegExp(r'import.*package:http/')) && if (line.startsWith(RegExp(r'import.*package:http/')) &&
!line.contains('ignore: package_http_import')) { !line.contains('flutter_ignore: package_http_import')) {
final String relativePath = fileSystem.path.relative(file.path, from:flutterTools); final String relativePath = fileSystem.path.relative(file.path, from:flutterTools);
fail("$relativePath imports 'package:http'; import 'lib/src/base/io.dart' instead"); fail("$relativePath imports 'package:http'; import 'lib/src/base/io.dart' instead");
} }
...@@ -128,7 +128,7 @@ void main() { ...@@ -128,7 +128,7 @@ void main() {
for (final File file in files) { for (final File file in files) {
for (final String line in file.readAsLinesSync()) { for (final String line in file.readAsLinesSync()) {
if (line.startsWith(RegExp(r'import.*package:test_api')) && if (line.startsWith(RegExp(r'import.*package:test_api')) &&
!line.contains('ignore: test_api_import')) { !line.contains('flutter_ignore: test_api_import')) {
final String relativePath = fileSystem.path.relative(file.path, from:flutterTools); final String relativePath = fileSystem.path.relative(file.path, from:flutterTools);
fail("$relativePath imports 'package:test_api/test_api.dart';"); fail("$relativePath imports 'package:test_api/test_api.dart';");
} }
...@@ -151,7 +151,7 @@ void main() { ...@@ -151,7 +151,7 @@ void main() {
for (final File file in files) { for (final File file in files) {
for (final String line in file.readAsLinesSync()) { for (final String line in file.readAsLinesSync()) {
if (line.startsWith(RegExp(r'import.*package:path/path.dart')) && if (line.startsWith(RegExp(r'import.*package:path/path.dart')) &&
!line.contains('ignore: package_path_import')) { !line.contains('flutter_ignore: package_path_import')) {
final String relativePath = fileSystem.path.relative(file.path, from:flutterTools); final String relativePath = fileSystem.path.relative(file.path, from:flutterTools);
fail("$relativePath imports 'package:path/path.dart'; use 'fileSystem.path' instead"); fail("$relativePath imports 'package:path/path.dart'; use 'fileSystem.path' instead");
} }
...@@ -198,7 +198,7 @@ void main() { ...@@ -198,7 +198,7 @@ void main() {
for (final File file in files) { for (final File file in files) {
for (final String line in file.readAsLinesSync()) { for (final String line in file.readAsLinesSync()) {
if (line.startsWith(RegExp(r'import.*dart:convert')) && if (line.startsWith(RegExp(r'import.*dart:convert')) &&
!line.contains('ignore: dart_convert_import')) { !line.contains('flutter_ignore: dart_convert_import')) {
final String relativePath = fileSystem.path.relative(file.path, from:flutterTools); final String relativePath = fileSystem.path.relative(file.path, from:flutterTools);
fail("$relativePath imports 'dart:convert'; import 'lib/src/convert.dart' instead"); fail("$relativePath imports 'dart:convert'; import 'lib/src/convert.dart' instead");
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io' as io; // ignore: dart_io_import import 'dart:io' as io; // flutter_ignore: dart_io_import
import 'package:file/file.dart'; import 'package:file/file.dart';
import 'package:flutter_tools/src/base/common.dart'; import 'package:flutter_tools/src/base/common.dart';
......
...@@ -26,7 +26,7 @@ import 'package:flutter_tools/src/runner/flutter_command.dart'; ...@@ -26,7 +26,7 @@ import 'package:flutter_tools/src/runner/flutter_command.dart';
import 'package:flutter_tools/src/runner/flutter_command_runner.dart'; import 'package:flutter_tools/src/runner/flutter_command_runner.dart';
import 'package:flutter_tools/src/vmservice.dart'; import 'package:flutter_tools/src/vmservice.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
import 'package:path/path.dart' as path; // ignore: package_path_import import 'package:path/path.dart' as path; // flutter_ignore: package_path_import
import 'package:test_api/test_api.dart' as test_package show test; // ignore: deprecated_member_use import 'package:test_api/test_api.dart' as test_package show test; // ignore: deprecated_member_use
import 'package:test_api/test_api.dart' hide test; // ignore: deprecated_member_use import 'package:test_api/test_api.dart' hide test; // ignore: deprecated_member_use
import 'package:vm_service/vm_service.dart' as vm_service; import 'package:vm_service/vm_service.dart' as vm_service;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment