All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Cc: netdev@vger.kernel.org, David Ahern <dsahern@gmail.com>
Subject: Re: [PATCH iproute2-next] add .editorconfig file for basic formatting
Date: Fri, 15 Nov 2024 08:51:50 -0800	[thread overview]
Message-ID: <20241115085150.62d239ae@hermes.local> (raw)
In-Reply-To: <20241115151030.1198371-2-mailhol.vincent@wanadoo.fr>

On Sat, 16 Nov 2024 00:08:27 +0900
Vincent Mailhol <mailhol.vincent@wanadoo.fr> wrote:

> EditorConfig is a specification to define the most basic code formatting
> stuff, and it is supported by many editors and IDEs, either directly or
> via plugins, including VSCode/VSCodium, Vim, emacs and more.
> 
> It allows to define formatting style related to indentation, charset,
> end of lines and trailing whitespaces. It also allows to apply different
> formats for different files based on wildcards, so for example it is
> possible to apply different configurations to *.{c,h}, *.json or *.yaml.
> 
> In linux related projects, defining a .editorconfig might help people
> that work on different projects with different indentation styles, so
> they cannot define a global style. Now they will directly see the
> correct indentation on every fresh clone of the project.
> 
> Add the .editorconfig file at the root of the iproute2 project. Only
> configuration for the file types currently present are specified. The
> automatic whitespace trimming option caused some issues in the Linux
> kernel [1] and is thus not activated.
> 
> See https://editorconfig.org
> 
> [1] .editorconfig: remove trim_trailing_whitespace option
> Link: https://git.kernel.org/torvalds/c/7da9dfdd5a3d
> 
> Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
> ---
> For reference, here is the .editorconfig of the kernel:
> 
>   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/.editorconfig
> ---
>  .editorconfig | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
>  create mode 100644 .editorconfig
> 
> diff --git a/.editorconfig b/.editorconfig
> new file mode 100644
> index 00000000..4cff39f1
> --- /dev/null
> +++ b/.editorconfig
> @@ -0,0 +1,24 @@
> +# SPDX-License-Identifier: GPL-2.0
> +
> +root = true

Maybe add something generic across all files. Then you only need to specify overrides

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = tab
tab_width = 8
max_line_length = 100

> +
> +[{*.{c,h,sh},Makefile}]
> +charset = utf-8
> +end_of_line = lf
> +insert_final_newline = true
> +indent_style = tab
> +indent_size = 8
> +
> +[*.json]
> +charset = utf-8
> +end_of_line = lf
> +insert_final_newline = true
> +indent_style = space
> +indent_size = 4
> +
> +[*.yaml]
> +charset = utf-8
> +end_of_line = lf
> +insert_final_newline = true
> +indent_style = space
> +indent_size = 2


  parent reply	other threads:[~2024-11-15 16:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-15 15:08 [PATCH iproute2-next] add .editorconfig file for basic formatting Vincent Mailhol
2024-11-15 16:49 ` Stephen Hemminger
2024-11-15 17:34   ` Vincent Mailhol
2024-11-15 16:51 ` Stephen Hemminger [this message]
2024-11-15 17:59   ` Vincent Mailhol
2024-11-15 20:32     ` Stephen Hemminger
2024-11-16  2:59       ` Vincent Mailhol

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241115085150.62d239ae@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=dsahern@gmail.com \
    --cc=mailhol.vincent@wanadoo.fr \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.