@@ -534,6 +534,14 @@ Future<void> verifyDeprecations(String workingDirectory, { int minimumMatches =
|
||||
String possibleReason = '';
|
||||
if (lines[lineNumber].trimLeft().startsWith('"')) {
|
||||
possibleReason = ' You might have used double quotes (") for the string instead of single quotes (\').';
|
||||
} else if (!lines[lineNumber].contains("'")) {
|
||||
possibleReason = ' It might be missing the line saying "This feature was deprecated after...".';
|
||||
} else if (!lines[lineNumber].trimRight().endsWith(" '")) {
|
||||
if (lines[lineNumber].contains('This feature was deprecated')) {
|
||||
possibleReason = ' There might not be an explanatory message.';
|
||||
} else {
|
||||
possibleReason = ' There might be a missing space character at the end of the line.';
|
||||
}
|
||||
}
|
||||
throw 'Deprecation notice does not match required pattern.$possibleReason';
|
||||
}
|
||||
@@ -546,6 +554,8 @@ Future<void> verifyDeprecations(String workingDirectory, { int minimumMatches =
|
||||
if (firstChar.toUpperCase() != firstChar) {
|
||||
throw 'Deprecation notice should be a grammatically correct sentence and start with a capital letter; see style guide: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo';
|
||||
}
|
||||
} else {
|
||||
message += messageMatch.namedGroup('message')!;
|
||||
}
|
||||
lineNumber += 1;
|
||||
if (lineNumber >= lines.length) {
|
||||
@@ -565,7 +575,7 @@ Future<void> verifyDeprecations(String workingDirectory, { int minimumMatches =
|
||||
}
|
||||
}
|
||||
if (!message.endsWith('.') && !message.endsWith('!') && !message.endsWith('?')) {
|
||||
throw 'Deprecation notice should be a grammatically correct sentence and end with a period.';
|
||||
throw 'Deprecation notice should be a grammatically correct sentence and end with a period; notice appears to be "$message".';
|
||||
}
|
||||
if (!lines[lineNumber].startsWith("$indent '")) {
|
||||
throw 'Unexpected deprecation notice indent.';
|
||||
|
||||
@@ -94,13 +94,18 @@ Future<void> runProcessWithValidations(
|
||||
List<String> command,
|
||||
String workingDirectory, {
|
||||
@visibleForTesting ProcessManager processManager = const LocalProcessManager(),
|
||||
bool verbose = true,
|
||||
}) async {
|
||||
final ProcessResult result =
|
||||
processManager.runSync(command, stdoutEncoding: utf8, workingDirectory: workingDirectory);
|
||||
if (result.exitCode == 0) {
|
||||
print('Stdout: ${result.stdout}');
|
||||
if (verbose) {
|
||||
print('stdout: ${result.stdout}');
|
||||
}
|
||||
} else {
|
||||
print('StdErr: ${result.stderr}');
|
||||
if (verbose) {
|
||||
print('stderr: ${result.stderr}');
|
||||
}
|
||||
throw CommandException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,3 +100,8 @@ void test17() { }
|
||||
'This feature was deprecated after v2.1.0-11.0.pre.'
|
||||
)
|
||||
void test18() { }
|
||||
|
||||
@Deprecated( // flutter_ignore: deprecation_syntax, https://github.com/flutter/flutter/issues/000000
|
||||
'Missing the version line. '
|
||||
)
|
||||
void test19() { }
|
||||
|
||||
@@ -45,13 +45,13 @@ void main() {
|
||||
test('analyze.dart - verifyDeprecations', () async {
|
||||
final String result = await capture(() => verifyDeprecations(testRootPath, minimumMatches: 2), shouldHaveErrors: true);
|
||||
final String lines = <String>[
|
||||
'║ test/analyze-test-input/root/packages/foo/deprecation.dart:12: Deprecation notice does not match required pattern.',
|
||||
'║ test/analyze-test-input/root/packages/foo/deprecation.dart:12: Deprecation notice does not match required pattern. There might be a missing space character at the end of the line.',
|
||||
'║ test/analyze-test-input/root/packages/foo/deprecation.dart:18: Deprecation notice should be a grammatically correct sentence and start with a capital letter; see style guide: STYLE_GUIDE_URL',
|
||||
'║ test/analyze-test-input/root/packages/foo/deprecation.dart:25: Deprecation notice should be a grammatically correct sentence and end with a period.',
|
||||
'║ test/analyze-test-input/root/packages/foo/deprecation.dart:25: Deprecation notice should be a grammatically correct sentence and end with a period; notice appears to be "Also bad grammar".',
|
||||
'║ test/analyze-test-input/root/packages/foo/deprecation.dart:29: Deprecation notice does not match required pattern.',
|
||||
'║ test/analyze-test-input/root/packages/foo/deprecation.dart:32: Deprecation notice does not match required pattern.',
|
||||
'║ test/analyze-test-input/root/packages/foo/deprecation.dart:37: Deprecation notice does not match required pattern.',
|
||||
'║ test/analyze-test-input/root/packages/foo/deprecation.dart:41: Deprecation notice does not match required pattern.',
|
||||
'║ test/analyze-test-input/root/packages/foo/deprecation.dart:37: Deprecation notice does not match required pattern. It might be missing the line saying "This feature was deprecated after...".',
|
||||
'║ test/analyze-test-input/root/packages/foo/deprecation.dart:41: Deprecation notice does not match required pattern. There might not be an explanatory message.',
|
||||
'║ test/analyze-test-input/root/packages/foo/deprecation.dart:48: End of deprecation notice does not match required pattern.',
|
||||
'║ test/analyze-test-input/root/packages/foo/deprecation.dart:51: Unexpected deprecation notice indent.',
|
||||
'║ test/analyze-test-input/root/packages/foo/deprecation.dart:70: Deprecation notice does not accurately indicate a beta branch version number; please see RELEASES_URL to find the latest beta build version number.',
|
||||
|
||||
@@ -118,7 +118,7 @@ void main() async {
|
||||
),
|
||||
],
|
||||
);
|
||||
await runProcessWithValidations(command, '', processManager: processManager);
|
||||
await runProcessWithValidations(command, '', processManager: processManager, verbose: false);
|
||||
expect(processManager, hasNoRemainingExpectations);
|
||||
});
|
||||
|
||||
@@ -133,7 +133,7 @@ void main() async {
|
||||
],
|
||||
);
|
||||
try {
|
||||
await runProcessWithValidations(command, '', processManager: processManager);
|
||||
await runProcessWithValidations(command, '', processManager: processManager, verbose: false);
|
||||
throw Exception('Exception was not thrown');
|
||||
} on CommandException catch (e) {
|
||||
expect(e, isA<Exception>());
|
||||
|
||||
@@ -21,7 +21,7 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// TODO(nurhan): https://github.com/flutter/flutter/issues/51885
|
||||
SystemChannels.textInput.setMockMethodCallHandler(null);
|
||||
tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(SystemChannels.textInput, null);
|
||||
// Focus on a TextFormField.
|
||||
final Finder finder = find.byKey(const Key('input'));
|
||||
expect(finder, findsOneWidget);
|
||||
@@ -39,7 +39,7 @@ void main() {
|
||||
platformViewsRegistry.getNextPlatformViewId();
|
||||
// ignore: undefined_prefixed_name, avoid_dynamic_calls
|
||||
ui.platformViewRegistry.registerViewFactory('MyView', (int viewId) {
|
||||
++viewInstanceCount;
|
||||
viewInstanceCount += 1;
|
||||
return html.DivElement();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user