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

Commit

Permalink
Use correct API docs link in create --sample help message (#118371)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
parlough authored Jan 12, 2023
1 parent 4e85235 commit 9e11d4a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/flutter_tools/lib/src/commands/create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class CreateCommand extends CreateBase {
abbr: 's',
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 '
'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',
valueHelp: 'id',
);
Expand Down
2 changes: 2 additions & 0 deletions packages/flutter_tools/test/general.shard/args_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ final RegExp _bannedQuotePatterns = RegExp(r" '|' |'\.|\('|'\)|`");
final RegExp _bannedArgumentReferencePatterns = RegExp(r'[^"=]--[^ ]');
final RegExp _questionablePatterns = RegExp(r'[a-z]\.[A-Z]');
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 "
'for testing purposes, because this is the bare minimum of '
'documentation we can add just for ourselves. If it is not intended '
Expand Down Expand Up @@ -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(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): 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.
}
Expand Down

0 comments on commit 9e11d4a

Please sign in to comment.