Unverified Commit 9e11d4a1 authored by Parker Lougheed's avatar Parker Lougheed Committed by GitHub

Use correct API docs link in create --sample help message (#118371)

* Use correct API doc link in create --sample help message

* Verify Flutter and Dart website links in tool help messages use https

* Adjust test failure reasoning message
parent 4e85235f
...@@ -61,7 +61,7 @@ class CreateCommand extends CreateBase { ...@@ -61,7 +61,7 @@ class CreateCommand extends CreateBase {
abbr: 's', abbr: 's',
help: 'Specifies the Flutter code sample to use as the "main.dart" for an application. Implies ' help: 'Specifies the Flutter code sample to use as the "main.dart" for an application. Implies '
'"--template=app". The value should be the sample ID of the desired sample from the API ' '"--template=app". The value should be the sample ID of the desired sample from the API '
'documentation website (http://docs.flutter.dev/). An example can be found at: ' 'documentation website (https://api.flutter.dev/). An example can be found at: '
'https://api.flutter.dev/flutter/widgets/SingleChildScrollView-class.html', 'https://api.flutter.dev/flutter/widgets/SingleChildScrollView-class.html',
valueHelp: 'id', valueHelp: 'id',
); );
......
...@@ -151,6 +151,7 @@ final RegExp _bannedQuotePatterns = RegExp(r" '|' |'\.|\('|'\)|`"); ...@@ -151,6 +151,7 @@ final RegExp _bannedQuotePatterns = RegExp(r" '|' |'\.|\('|'\)|`");
final RegExp _bannedArgumentReferencePatterns = RegExp(r'[^"=]--[^ ]'); final RegExp _bannedArgumentReferencePatterns = RegExp(r'[^"=]--[^ ]');
final RegExp _questionablePatterns = RegExp(r'[a-z]\.[A-Z]'); final RegExp _questionablePatterns = RegExp(r'[a-z]\.[A-Z]');
final RegExp _bannedUri = RegExp(r'\b[Uu][Rr][Ii]\b'); final RegExp _bannedUri = RegExp(r'\b[Uu][Rr][Ii]\b');
final RegExp _nonSecureFlutterDartUrl = RegExp(r'http://([a-z0-9-]+\.)*(flutter|dart)\.dev', caseSensitive: false);
const String _needHelp = "Every option must have help explaining what it does, even if it's " const String _needHelp = "Every option must have help explaining what it does, even if it's "
'for testing purposes, because this is the bare minimum of ' 'for testing purposes, because this is the bare minimum of '
'documentation we can add just for ourselves. If it is not intended ' 'documentation we can add just for ourselves. If it is not intended '
...@@ -209,6 +210,7 @@ void verifyOptions(String? command, Iterable<Option> options) { ...@@ -209,6 +210,7 @@ void verifyOptions(String? command, Iterable<Option> options) {
} }
expect(option.help, isNot(endsWith(':')), reason: '${_header}Help for $target--${option.name}" ends with a colon, which seems unlikely to be correct.'); expect(option.help, isNot(endsWith(':')), reason: '${_header}Help for $target--${option.name}" ends with a colon, which seems unlikely to be correct.');
expect(option.help, isNot(contains(_bannedUri)), reason: '${_header}Help for $target--${option.name}" uses the term "URI" rather than "URL".'); expect(option.help, isNot(contains(_bannedUri)), reason: '${_header}Help for $target--${option.name}" uses the term "URI" rather than "URL".');
expect(option.help, isNot(contains(_nonSecureFlutterDartUrl)), reason: '${_header}Help for $target--${option.name}" links to a non-secure ("http") version of a Flutter or Dart site.');
// TODO(ianh): add some checking for embedded URLs to make sure we're consistent on how we format those. // TODO(ianh): add some checking for embedded URLs to make sure we're consistent on how we format those.
// TODO(ianh): arguably we should ban help text that starts with "Whether to..." since by definition a flag is to enable a feature, so the "whether to" is redundant. // TODO(ianh): arguably we should ban help text that starts with "Whether to..." since by definition a flag is to enable a feature, so the "whether to" is redundant.
} }
......
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