Re: [PATCH] Add an EditorConfig file
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Sep 20, 2018, 00:00 UTC
- Message-ID
- <20180920000013.GZ432229@genre.crustytoothpaste.net>
- In-Reply-To
- <xmqqtvmm42es.fsf@gitster-ct.c.googlers.com>
On Tue, Sep 18, 2018 at 08:00:27PM -0700, Junio C Hamano wrote:
Show 12 quoted lines
> "brian m. carlson" <sandals@crustytoothpaste.net> writes: > > > To make automatically configuring one's editor easier, provide an > > EditorConfig file. This is an INI-style configuration file that can be > > used to specify editor settings and can be understood by a wide variety > > of editors. Some editors include this support natively; others require > > a plugin. > > Good intentions. One thing that makes me wonder is how well this > plays with "make style" and how easy will it be to keep their > recommendations in sync. Ideally, if we can generate one from the > other, or both from a unified source, that would be great.
I think "make style" and the EditorConfig file are complementary. "make style" autoformats code into a diff. I agree that if we always used clang-format to format code, then this would be a non-issue in the EditorConfig file, since we'd just tell people to format their code and be done with it. However, we don't automatically do that, so I think this still has value.
(I am having trouble getting make style to work, though, because it seems to invoke clang-format as a git subcommand, and I don't think that works. I may send a patch.)
Even if we did that, we couldn't do it for Perl, because the tidy tool for Perl, perltidy, produces different output depending on version. I expect we'll have little success in trying to standardize on a given version.
The EditorConfig file applies to a variety of formats and is designed to set default editor settings (which users *can* override if they choose). It applies to any file pattern; for example, as Taylor pointed out, we could use it to recommend 72-character lines in commit messages.
I agree that maintaining more files is a hassle, but personally, I think it quite unlikely that we're going to change the Git style, so I feel the maintenance is fairly low.
-- brian m. carlson: Houston, Texas, US OpenPGP: https://keybase.io/bk2204