Re: [PATCH] editorconfig: Add automatic editor configuration file

From: Danny Lin
Date: Fri Jul 03 2020 - 03:31:06 EST


On Thursday, July 2, 2020 at 10:38 PM, Miguel Ojeda wrote:
> Hi Danny,
>
> On Fri, Jul 3, 2020 at 2:16 AM Danny Lin <danny@xxxxxxxxxxx> wrote:
> > +[*]
> > +charset = utf-8
> > +end_of_line = lf
>
> While UTF-8 and LF are probably OK for all files, I am not 100% sure
about:
> > +insert_final_newline = true
> > +indent_style = tab
> > +indent_size = 8
>
> for other languages and non-code files we may have around. Perhaps it
> is best to avoid `[*]` unless we are sure?

Most of the other exceptions can be accomodated for with more specific
rules below the base [*] section. I just went through most of the
kernel's files and added rules for the vast majority of the exceptinos
to the 8-column tab indent style, though there are still some that
haven't been covered.

It looks like some types of files lack consistent indentation, e.g.
arch/mips/*/Platform and some shell scripts in scripts/ tools/testing/
selftests/ftrace/test.d/kprobe/*.tc. There are also some files that were
highly inconsistent even within themselves (e.g. drivers/gpu/drm/amd/
amdkfd/cwsr_trap_handler_gfx*.asm), so setting indentation settings to
something sane by default doesn't make them any worse. After all, no
automated code style tooling is perfect and there will be edge cases
where it breaks down.

That being said, I think most of the exceptions should be taken care of
now; please feel free to suggest a better way to deal with these.

>
> Cheers,
> Miguel