Hi,

On Wed, 6 Mar 2024 11:04:01 +0100 Paride Legovini <par...@debian.org> wrote:
> On Sun, 03 Mar 2024 16:26:41 +0100 Benjamin Drung <bdr...@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.4002254931040787...@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.

Do with that data what you wish. :)

Thanks!

cheers, josch

Attachment: signature.asc
Description: signature

Reply via email to