docs: fix linting issues due to incorrect relative section order

Re-order the sections of a few manual pages to be consistent with the
entirety of the rest of our documentation. This allows us to remove
the just-added whitelist of "bad" order from
lint-man-section-order.perl.

I'm doing that this way around so that code will be easy to dig up if
we'll need it in the future. I've intentionally not added some other
sections such as EXAMPLES to the list of known sections.

If we were to add that we'd find some out of order. Perhaps we'll want
to order those consistently as well in the future, at which point
whitelisting some of them might become handy again.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ævar Arnfjörð Bjarmason
2021-04-09 17:02:50 +02:00
committed by Junio C Hamano
parent ea8b9271b1
commit 414abf159f
6 changed files with 78 additions and 98 deletions

View File

@ -18,24 +18,13 @@ my %SECTIONS;
'DESCRIPTION' => {
required => 1,
order => $order++,
bad => {
'git-mktag.txt' => 'OPTIONS',
'git-cvsserver.txt' => 'OPTIONS',
},
},
'OPTIONS' => {
order => $order++,
required => 0,
bad => {
'git-grep.txt' => 'CONFIGURATION',
'git-rebase.txt' => 'CONFIGURATION',
},
},
'CONFIGURATION' => {
order => $order++,
bad => {
'git-svn.txt' => 'BUGS',
},
},
'BUGS' => {
order => $order++,
@ -77,16 +66,7 @@ while (my $line = <>) {
my $expected_last = $expected_order[-2];
my $actual_last = $actual_order[-2];
my $except_last = $SECTIONS{$line}->{bad}->{$ARGV} || '';
if (($SECTIONS{$line}->{bad}->{$ARGV} || '') eq $actual_last) {
# Either we're whitelisted, or ...
next
} elsif (exists $SECTIONS{$actual_last}->{bad}->{$ARGV}) {
# ... we're complaing about the next section
# which is out of order because this one is,
# don't complain about that one.
next;
} elsif ($actual_last ne $expected_last) {
if ($actual_last ne $expected_last) {
report("section '$line' incorrectly ordered, comes after '$actual_last'");
}
next;