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
This commit is contained in:
Bryan Oltman
2022-07-11 13:06:31 -04:00
committed by GitHub
parent 2a58bb7580
commit bf7df23350
2 changed files with 16 additions and 12 deletions

View File

@@ -85,6 +85,10 @@ void verifyCommandRunner(CommandRunner<Object> runner) {
void verifyCommand(Command<Object> runner) {
expect(runner.argParser, isNotNull, reason: 'command ${runner.name} has no argParser');
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) {
expect(
runner.category,
@@ -107,7 +111,7 @@ final RegExp _bannedArgumentNamePattern = RegExp(r'-uri$');
// Patterns for help messages.
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 _bannedArgumentReferencePatterns = RegExp(r'[^"=]--[^ ]');
final RegExp _questionablePatterns = RegExp(r'[a-z]\.[A-Z]');