Re: Add trim_trailing_whitespace to editorconfig file

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, Melanie Plageman <melanieplageman(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add trim_trailing_whitespace to editorconfig file
Date: 2024-04-04 13:25:21
Message-ID: b7f5c6cf-fe6b-4c4c-8c26-9ee22f911665@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 19.02.24 16:21, Jelte Fennema-Nio wrote:
>> v3-0003-Bring-editorconfig-in-line-with-gitattributes.patch
>>
>> I question whether we need to add rules to .editorconfig about files
>> that are generated or imported from elsewhere, since those are not meant
>> to be edited.
> I agree that it's not strictly necessary to have .editorconfig match
> .gitattributes for files that are not meant to be edited by hand. But
> I don't really see a huge downside either, apart from having a few
> extra lines it .editorconfig. And adding these lines does have a few
> benefits:
> 1. It makes it easy to ensure that .editorconfig and .gitattributes stay in sync
> 2. If someone opens a file that they are not supposed to edit by hand,
> and then saves it. Then no changes are made. As opposed to suddenly
> making some whitespace changes
>
> Attached is a new patchset with the first commit split in three
> separate commits, which configure:
> 1. Files meant to be edited by hand)
> 2. Output test files (maybe edited by hand)
> 3. Imported/autogenerated files

> diff --git a/.gitattributes b/.gitattributes
> index e9ff4a56bd..7923fc3387 100644
> --- a/.gitattributes
> +++ b/.gitattributes
> @@ -1,3 +1,4 @@
> +# IMPORTANT: When updating this file, also update .editorconfig to
match.

Everybody has git. Everybody who edits .gitattributes can use git to
check what they did. Not everybody has editorconfig-related tools. I
tried the editorconfig-checker that you had mentioned (I tried the Go
version, not the JavaScript one, because the former is packaged for
Homebrew and Debian), but it was terrible and unusable. Maybe I'm
holding it wrong. But I don't want users of a common tool to bear the
burden of blindly updating files for a much-less-common tool. This is
how we got years of blindly updating Windows build files. The result
will be to that people will instead avoid updating .gitattributes.

ISTM that with a small shell script, .editorconfig could be generated
from .gitattributes?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jelte Fennema-Nio 2024-04-04 13:34:24 Re: Flushing large data immediately in pqcomm
Previous Message Ants Aasma 2024-04-04 13:02:53 Re: Popcount optimization using AVX512