Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 9e11d4a

Browse files
authored
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
1 parent 4e85235 commit 9e11d4a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

packages/flutter_tools/lib/src/commands/create.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class CreateCommand extends CreateBase {
6161
abbr: 's',
6262
help: 'Specifies the Flutter code sample to use as the "main.dart" for an application. Implies '
6363
'"--template=app". The value should be the sample ID of the desired sample from the API '
64-
'documentation website (http://docs.flutter.dev/). An example can be found at: '
64+
'documentation website (https://api.flutter.dev/). An example can be found at: '
6565
'https://api.flutter.dev/flutter/widgets/SingleChildScrollView-class.html',
6666
valueHelp: 'id',
6767
);

packages/flutter_tools/test/general.shard/args_test.dart

+2
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ final RegExp _bannedQuotePatterns = RegExp(r" '|' |'\.|\('|'\)|`");
151151
final RegExp _bannedArgumentReferencePatterns = RegExp(r'[^"=]--[^ ]');
152152
final RegExp _questionablePatterns = RegExp(r'[a-z]\.[A-Z]');
153153
final RegExp _bannedUri = RegExp(r'\b[Uu][Rr][Ii]\b');
154+
final RegExp _nonSecureFlutterDartUrl = RegExp(r'http://([a-z0-9-]+\.)*(flutter|dart)\.dev', caseSensitive: false);
154155
const String _needHelp = "Every option must have help explaining what it does, even if it's "
155156
'for testing purposes, because this is the bare minimum of '
156157
'documentation we can add just for ourselves. If it is not intended '
@@ -209,6 +210,7 @@ void verifyOptions(String? command, Iterable<Option> options) {
209210
}
210211
expect(option.help, isNot(endsWith(':')), reason: '${_header}Help for $target--${option.name}" ends with a colon, which seems unlikely to be correct.');
211212
expect(option.help, isNot(contains(_bannedUri)), reason: '${_header}Help for $target--${option.name}" uses the term "URI" rather than "URL".');
213+
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.');
212214
// TODO(ianh): add some checking for embedded URLs to make sure we're consistent on how we format those.
213215
// 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.
214216
}

0 commit comments

Comments
 (0)