Bug#895570: devscripts: wrap-and-sort should default to -ast (--wrap-always, --short-indent, --trailing-comma)

Paride Legovini <[email protected]>
Newsgroups gmane.linux.debian.devel.bugs.general,gmane.linux.debian.devel.perl
Message-ID <[email protected]>
On 2024-03-12 00:33, Johannes Schauer Marin Rodrigues wrote:
> Hi,
> 
> On Wed, 6 Mar 2024 11:04:01 +0100 Paride Legovini <[email protected]> wrote:
>> On Sun, 03 Mar 2024 16:26:41 +0100 Benjamin Drung <[email protected]> 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/[email protected]
> 
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.