Files
git/Documentation/lint-documentation-style.perl
Jean-Noël Avila 03a353bb97 doc: check for absence of the form --[no-]parameter
For better searchability, this commit adds a check to ensure that parameters
expressed in the form of `--[no-]parameter` are not used in the
documentation.  In the place of such parameters, the documentation should
list two separate parameters: `--parameter` and `--no-parameter`.

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-11 14:16:04 -07:00

28 lines
509 B
Perl
Executable File

#!/usr/bin/perl
use strict;
use warnings;
my $exit_code = 0;
sub report {
my ($line, $msg) = @_;
chomp $line;
print STDERR "$ARGV:$.: '$line' $msg\n";
$exit_code = 1;
}
my $synopsis_style = 0;
while (my $line = <>) {
if ($line =~ /^[ \t]*`?[-a-z0-9.]+`?(, `?[-a-z0-9.]+`?)+(::|;;)$/) {
report($line, "multiple parameters in a definition list item");
}
if ($line =~ /^`?--\[no-\][a-z0-9-]+.*(::|;;)$/) {
report($line, "definition list item with a `--[no-]` parameter");
}
}
exit $exit_code;