Subject: Re: [PATCH 5/5] doc lint: lint and fix missing "GIT" end sections

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Fri, 26 Mar 2021 16:32:58 +0100

On Fri, Mar 26 2021, Jeff King wrote:

> On Fri, Mar 26, 2021 at 11:36:50AM +0100, Ævar Arnfjörð Bjarmason wrote:
>
>> Lint for and fix the three manual pages that were missing the standard
>> "Part of the linkgit:git[1] suite" end section.
>
> This is a definite improvement. Two thoughts come to mind, though:
>
>   1. Do we need a separate script for this? Couldn't the existing linter
>      script check this while it is reading all of the files (it knows
>      which ones are supposed to be manpages because they are annotated
>      with the --section option).

It's not needed, but I think it's better, one is iterating a
line-at-time, one slurps all lines, they have different sorts of error
reporting (one quotes the whole line).

So I thought about joining them into one, and also make them and
check-non-portable-shell.pl some general lint-line-ish checker.

Obviously all of that fits in one script, but I think for something like
this that's a one-off script with global variables it's much harder to
follow when a large part of your script is some if/else or
keeping/resetting of state simply to work around the script doing two
things instead of one.

I mean, the whole scaffolding is basically:

    use strict;
    use warnings;
    sub report { ... }
    my $code = 0;
    while (<>) {
        ...
    }
    exit $code;

We'd spend more lines effort trying to consolidate them than just
copying that around.

> That would be more efficient, and probably a little less code.

This thing takes ~5ms to run on my (and most) boxes, by comparison the
whole asciidoc dance takes some eons...

>   2. Instead of linting, could we just be automatically sticking this
>      boilerplate in as part of the build (either through some asciidoc
>      magic, or even just a plain old "cat")? Even better than being
>      reminded that you forgot something is making it impossible to
>      forget it in the first place.

Whenever I take an aborted effort at the docs I end up with some aborted
effort to migrte them to texinfo, so I'm sympathetic to the automatic
generation part of this.

But for something trivial like this I think there's more value in having
a 1=1 match between WYS and WYG, not adding magic blurbs by the build
system for something so trivial.

That being said I wouldn't mind it much, just seemed like an obvious
thing to add a lint for as it stands now...