Re: Add trim_trailing_whitespace to editorconfig file

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Melanie Plageman <melanieplageman(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
Subject: Re: Add trim_trailing_whitespace to editorconfig file
Date: 2024-08-08 11:27:51
Message-ID: cf2ef117-a284-4a77-989a-f82e9abf0482@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2024-08-07 We 4:42 PM, Jelte Fennema-Nio wrote:
> On Wed, 7 Aug 2024 at 21:09, Andrew Dunstan<andrew(at)dunslane(dot)net> wrote:
>> You're not meant to use our pg_bsd_indent on its own without the
>> appropriate flags, namely (from src/tools/pgindent/pgindent):
> Ah sorry, I wasn't clear in what I meant then. I meant that if you
> look at the sources of pg_bsd_indent (such as
> src/tools/pg_bsd_indent/io.c) then you'll realize that comments are
> alligned using tabs of width 8, not tabs of width 4. And right now
> .editorconfig configures editors to show all .c files with a tab_width
> of 4, because we use that for Postgres source files. The bottom
> .gitattributes line now results in an editorconfig rule that sets a
> tab_width of 8 for just the c and h files in src/tools/pg_bsd_indent
> directory.

Ah, OK. Yeah, that makes sense.

>
>> Also, why are you proposing to undet indent-style for .pl and .pm files?
>> That's not in accordance with our perltidy settings
>> (src/tools/pgindent/perltidyrc), unless I'm misunderstanding.
> All the way at the bottom of the .editorconfig file those "ident_style
> = unset" lines are overridden to be "tab" for .pl and .pm files.
> There's a comment there explaining why it's done that way.
>
> # We want editors to use tabs for indenting Perl files, but we cannot add it
> # such a rule to .gitattributes, because certain lines are still indented with
> # spaces (e.g. SYNOPSIS blocks).
> [*.{pl,pm}]
> indent_style = tab
>
> But now thinking about this again after your comment, I realize it's
> just as easy and effective to change the script slightly to hardcode
> the indent_style for "*.pl" and "*.pm" so that the resulting
> .editorconfig looks less confusing. Attached is a patch that does
> that.

OK, good, thanks.

>
> I also added a .gitattributes rule for .py files, and changed the
> default tab_width to unset. Because I realized the resulting
> .editorconfig was using tab_width 8 for python files when editing
> src/tools/generate_editorconfig.py

sounds good.

cheers

andrew

--
Andrew Dunstan
EDB:https://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2024-08-08 11:39:37 Re: Windows default locale vs initdb
Previous Message Shlok Kyal 2024-08-08 10:54:22 Re: long-standing data loss bug in initial sync of logical replication