Re: Bug#895570: devscripts: wrap-and-sort should default to -ast (--wrap-always, --short-indent, --trailing-comma)
- To: Johannes Schauer Marin Rodrigues <josch@debian.org>, 895570@bugs.debian.org, Daniel Kahn Gillmor <dkg@fifthhorseman.net>, Mattia Rizzolo <mattia@debian.org>, Dominique Dumont <domi.dumont@free.fr>, Phil Morrell <debian@emorrp1.name>, Guillem Jover <guillem@debian.org>, bdrung@debian.org
- Cc: debian-perl@lists.debian.org
- Subject: Re: Bug#895570: devscripts: wrap-and-sort should default to -ast (--wrap-always, --short-indent, --trailing-comma)
- From: Paride Legovini <paride@debian.org>
- Date: Tue, 12 Mar 2024 17:51:26 +0100
- Message-id: <[🔎] bb7426b5-fa81-4ab2-b88a-c728e05624c8@debian.org>
- In-reply-to: <[🔎] 171019998786.543666.8444872987514586357@localhost>
- References: <152356102749.25521.13131571762761129801.reportbug@alice.fifthhorseman.net> <[🔎] 171019998786.543666.8444872987514586357@localhost>
On 2024-03-12 00:33, Johannes Schauer Marin Rodrigues wrote:
> Hi,
>
> On Wed, 6 Mar 2024 11:04:01 +0100 Paride Legovini <paride@debian.org> wrote:
>> On Sun, 03 Mar 2024 16:26:41 +0100 Benjamin Drung <bdrung@debian.org> wrote:
>>> Time to join this discussion. The current default was the preference of
>>> the author 14 years ago. My taste has change a bit since then. I am open
>>> to change the default. --trailing-comma for wrapped lines is a good
>>> idea, --short-indent is okay. I don't like --wrap-always in case there
>>> are only two or three entries.
>>>
>>> The new default should not only based on the preference, but also on
>>> what is used the most. Can someone collect the information: which teams
>>> use which options, how many packages use what?
>>
>> I did some unscientific research on codesearch looking for d/changelog entries
>> mentioning `wrap-and-sort -` (i.e. wrap-and-sort with some options). This is
>> the query:
>>
>> https://codesearch.debian.net/search?q=path%3Adebian%2Fchangelog+wrap-and-sort+-&literal=1
>>
>> Apparently -a is the single most used option, very often used together with
>> -s and -t. I found similar results by searching GitHub:
>>
>> https://github.com/search?q=path%3Adebian%2Fchangelog+%22wrap-and-sort+-%22&type=code
>>
>> Looks like salsa (GitLab Free) doesn't allow to do instance-wide code searches.
>
> I disagree that the new default should be what is used the most. For example
> debhelper versions do not become the default only after they are used the most.
> The thing that makes switching defaults easier for debhelper is the explicit
> opt-in for a new debhelper compat version which we don't have for wrap-and-sort
> and I think it would very much be over-engineering to add such a feature for
> something that is, in my opinion, of very little consequence. Furthermore, I
> would not be surprised if many people using wrap-and-sort use the default
> expecting that this is what is most well-liked by the project (because why else
> would it be the default?). The question was asked in this email sub-thread:
>
> https://lists.debian.org/161289428547.4135738.4002254931040787156@auryn.jones.dk
>
> In that thread, same as in this bug, -ast was proposed as the default and
> unless I missed something, there were no objections on debian-devel. Some even
> argued, to make -b the default as well. So instead of asking "what is used
> most" I'd like to ask, are there users of wrap-and-sort without -ast who would
> be strongly against having to pass -AST to overwrite a potential new default?
>
> That being said, I downloaded all debian/control files for all 36832 source
> packages in Debian and ran the following shell script on them to figure out how
> many source packages comply with which wrap-and-sort set of options:
>
> for p in control/*; do
> rm -f debian/control;
> ln -s "../$p" debian/control;
> for opt in "" -a -as -ast -astb -at -atb -ab -s -st -stb -sb -t -tb -b; do
> wrap-and-sort --dry-run --file=debian/control $opt \
> | grep --quiet debian/control \
> || echo $p >> w-a-s$opt;
> done
> done
>
> It's of course still not possible to say whether a control file adheres to a
> certain wrap-and-sort formatting style by accident or intentionally. Also,
> packages can easily fall in multiple categories at the same time, for example
> packages with only a single binary package which comply with -ast will
> automatically also comply with -astb. There are also packages which comply with
> -ast as well as with no options at all simply because they have no
> Build-Depends nor Depends fields in debian/control. Here is the result sorted
> by popularity in ascending order:
>
> 96 wrap-and-sort -st
> 96 wrap-and-sort -stb
> 434 wrap-and-sort -as
> 465 wrap-and-sort -tb
> 489 wrap-and-sort -t
> 579 wrap-and-sort -atb
> 641 wrap-and-sort -at
> 1341 wrap-and-sort -sb
> 1405 wrap-and-sort -s
> 2381 wrap-and-sort -astb
> 2705 wrap-and-sort -ast
> 2732 wrap-and-sort -b
> 3020 wrap-and-sort
> 3950 wrap-and-sort -ab
> 4089 wrap-and-sort -a
>
> So, wrap-and-sort -ast is very popular but it is not as popular as the current
> default.
Hi josch and thanks for this analysis. I'll try to recap where we are at this
point, focusing only on -ast (I'll ignore -bk here).
1. This bug (#895570) requests -ast to be the default. The proposal received
mostly positive feedback, however bdrung doesn't like -a in case there are
only two or three entries. He also thinks we should consider what is already
popular.
--> Looks like everybody likes (or is ok with) having -st by default.
2. Using codesearch I looked for what options are the most popular when
w-a-s is mentioned with options in d/changelog. Looks like the most
popular option is -a (often together with others).
3. josch checked how many src packages in the archive are already compliant
with a w-a-s option set, and found results which agree with the above.
The ball goes back to bdrung I'd say. @bdrung: where does your preference
fall given that you don't like "always -a", but that also appears to be
quite popular, which is something you like?
Speaking for myself, my preference goes to -ast by default, but if we can
only reach consensus of -st I'll be happy with that.
Cheers,
Paride
Reply to: