Re: [PATCH v3] Add .editorconfig file for basic formatting

From: Miguel Ojeda
Date: Fri Apr 14 2023 - 09:36:39 EST


On Fri, Apr 14, 2023 at 12:11 PM Íñigo Huguet <ihuguet@xxxxxxxxxx> wrote:
>
> EditorConfig is a specification to define the most basic code formatting
> stuff, and it's supported by many editors and IDEs, either directly or
> via plugins, including VSCode/VSCodium, Vim, emacs and more.

Thanks -- v3 looks much safer!

To clarify the risks (it would be nice to detail these in the commit message):

- Did you sample files manually or did you automate the search (e.g.
grepping for spaces/tabs, for LF, etc.) to verify the current rules
match the files in the kernel tree?

- Would it be possible to go further than grepping and apply the
rules (e.g. trigger a "save") through the entire tree to see whether
there would be spurious changes?

If that comes out clean (or mostly clean), then we would be fairly
confident this will not surprise developers (and it would be nice to
have the script around for future updates of the `.editorconfig`).

Perhaps EditorConfig provides a script to check this already?
Otherwise perhaps it can be done with editorconfig-core-c or
editorconfig-vim or directly scripting on a couple editors?

- Are we sure the rules match the output of automated formatters we
are using? (e.g. for Rust we enforce `rustfmt`, and thus we need to
ensure the editor does not "fight" the formatter; otherwise developers
may need to run the formatter more).

Cc'ing Andrew since he applied originally the `.clang-format`.

Cheers,
Miguel