Unverified Commit bf7df233 authored by Bryan Oltman's avatar Bryan Oltman Committed by GitHub

Remove superfluous periods from `pub --help` subcommand descriptions. (#106925)

* Remove periods from pub --help command descriptions

* Add trailing period consistently

* Remove added period from PackagesInteractiveGetCommand description

* Verify line ending for first line of command description

* Update _allowedTrailingPatterns to validate that lines end with only one period, bang, or colon
parent 2a58bb75
...@@ -25,17 +25,17 @@ class PackagesCommand extends FlutterCommand { ...@@ -25,17 +25,17 @@ class PackagesCommand extends FlutterCommand {
addSubcommand(PackagesInteractiveGetCommand('add', 'Add a dependency to pubspec.yaml.')); addSubcommand(PackagesInteractiveGetCommand('add', 'Add a dependency to pubspec.yaml.'));
addSubcommand(PackagesInteractiveGetCommand('remove', 'Removes a dependency from the current package.')); addSubcommand(PackagesInteractiveGetCommand('remove', 'Removes a dependency from the current package.'));
addSubcommand(PackagesTestCommand()); addSubcommand(PackagesTestCommand());
addSubcommand(PackagesForwardCommand('publish', 'Publish the current package to pub.dartlang.org', requiresPubspec: true)); addSubcommand(PackagesForwardCommand('publish', 'Publish the current package to pub.dartlang.org.', requiresPubspec: true));
addSubcommand(PackagesForwardCommand('downgrade', 'Downgrade packages in a Flutter project', requiresPubspec: true)); addSubcommand(PackagesForwardCommand('downgrade', 'Downgrade packages in a Flutter project.', requiresPubspec: true));
addSubcommand(PackagesForwardCommand('deps', 'Print package dependencies')); // path to package can be specified with --directory argument addSubcommand(PackagesForwardCommand('deps', 'Print package dependencies.')); // path to package can be specified with --directory argument
addSubcommand(PackagesForwardCommand('run', 'Run an executable from a package', requiresPubspec: true)); addSubcommand(PackagesForwardCommand('run', 'Run an executable from a package.', requiresPubspec: true));
addSubcommand(PackagesForwardCommand('cache', 'Work with the Pub system cache')); addSubcommand(PackagesForwardCommand('cache', 'Work with the Pub system cache.'));
addSubcommand(PackagesForwardCommand('version', 'Print Pub version')); addSubcommand(PackagesForwardCommand('version', 'Print Pub version.'));
addSubcommand(PackagesForwardCommand('uploader', 'Manage uploaders for a package on pub.dev')); addSubcommand(PackagesForwardCommand('uploader', 'Manage uploaders for a package on pub.dev.'));
addSubcommand(PackagesForwardCommand('login', 'Log into pub.dev.')); addSubcommand(PackagesForwardCommand('login', 'Log into pub.dev.'));
addSubcommand(PackagesForwardCommand('logout', 'Log out of pub.dev.')); addSubcommand(PackagesForwardCommand('logout', 'Log out of pub.dev.'));
addSubcommand(PackagesForwardCommand('global', 'Work with Pub global packages')); addSubcommand(PackagesForwardCommand('global', 'Work with Pub global packages.'));
addSubcommand(PackagesForwardCommand('outdated', 'Analyze dependencies to find which ones can be upgraded', requiresPubspec: true)); addSubcommand(PackagesForwardCommand('outdated', 'Analyze dependencies to find which ones can be upgraded.', requiresPubspec: true));
addSubcommand(PackagesForwardCommand('token', 'Manage authentication tokens for hosted pub repositories.')); addSubcommand(PackagesForwardCommand('token', 'Manage authentication tokens for hosted pub repositories.'));
addSubcommand(PackagesPassthroughCommand()); addSubcommand(PackagesPassthroughCommand());
} }
...@@ -233,7 +233,7 @@ class PackagesForwardCommand extends FlutterCommand { ...@@ -233,7 +233,7 @@ class PackagesForwardCommand extends FlutterCommand {
@override @override
String get description { String get description {
return '$_description.\n' return '$_description\n'
'This runs the "pub" tool in a Flutter context.'; 'This runs the "pub" tool in a Flutter context.';
} }
...@@ -290,7 +290,7 @@ class PackagesInteractiveGetCommand extends FlutterCommand { ...@@ -290,7 +290,7 @@ class PackagesInteractiveGetCommand extends FlutterCommand {
@override @override
String get description { String get description {
return '$_description.\n' return '$_description\n'
'This runs the "pub" tool in a Flutter context.'; 'This runs the "pub" tool in a Flutter context.';
} }
......
...@@ -85,6 +85,10 @@ void verifyCommandRunner(CommandRunner<Object> runner) { ...@@ -85,6 +85,10 @@ void verifyCommandRunner(CommandRunner<Object> runner) {
void verifyCommand(Command<Object> runner) { void verifyCommand(Command<Object> runner) {
expect(runner.argParser, isNotNull, reason: 'command ${runner.name} has no argParser'); expect(runner.argParser, isNotNull, reason: 'command ${runner.name} has no argParser');
verifyOptions(runner.name, runner.argParser.options.values); verifyOptions(runner.name, runner.argParser.options.values);
final String firstDescriptionLine = runner.description.split('\n').first;
expect(firstDescriptionLine, matches(_allowedTrailingPatterns), reason: "command ${runner.name}'s description does not end with the expected single period that a full sentence should end with");
if (runner.hidden == false && runner.parent == null) { if (runner.hidden == false && runner.parent == null) {
expect( expect(
runner.category, runner.category,
...@@ -107,7 +111,7 @@ final RegExp _bannedArgumentNamePattern = RegExp(r'-uri$'); ...@@ -107,7 +111,7 @@ final RegExp _bannedArgumentNamePattern = RegExp(r'-uri$');
// Patterns for help messages. // Patterns for help messages.
final RegExp _bannedLeadingPatterns = RegExp(r'^[-a-z]', multiLine: true); final RegExp _bannedLeadingPatterns = RegExp(r'^[-a-z]', multiLine: true);
final RegExp _allowedTrailingPatterns = RegExp(r'([^ ][.!:]\)?|: https?://[^ ]+[^.]|^)$'); final RegExp _allowedTrailingPatterns = RegExp(r'([^ ]([^.^!^:][.!:])\)?|: https?://[^ ]+[^.]|^)$');
final RegExp _bannedQuotePatterns = RegExp(r" '|' |'\.|\('|'\)|`"); 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]');
......
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