public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Jan Polensky <japo@linux.ibm.com>
Cc: Linux Test Project <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v1 3/3] editorconfig: add consistent formatting rules for LTP
Date: Tue, 10 Mar 2026 14:22:27 +0100	[thread overview]
Message-ID: <20260310132227.GC39882@pevik> (raw)
In-Reply-To: <20260309172057.272946-4-japo@linux.ibm.com>

Hi Jan,

> Introduce .editorconfig to keep indentation and whitespace consistent across
> editors, preventing accidental reformatting and noisy diffs.

+1, I was thinking about adding it looking on kernel [1] and Buildroot [2]
config some time ago.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/.editorconfig
[2] https://github.com/buildroot/buildroot/blob/master/.editorconfig

Generally LGTM.

BTW I would separate this from the actual code change (not relevant).

> Signed-off-by: Jan Polensky <japo@linux.ibm.com>
> ---
>  .editorconfig | 36 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 36 insertions(+)
>  create mode 100644 .editorconfig

> diff --git a/.editorconfig b/.editorconfig
> new file mode 100644
> index 000000000000..ee9f49516e53
> --- /dev/null
> +++ b/.editorconfig
> @@ -0,0 +1,36 @@
> +# SPDX-License-Identifier: GPL-2.0-only

Any particular reason for GPL v2 only? The default LTP license is
GPL-2.0-or-later.

> +
> +# EditorConfig configuration for LTP
> +# https://editorconfig.org/
> +
> +root = true
> +
> +[*]
> +charset = utf-8
> +end_of_line = lf
> +insert_final_newline = true
> +trim_trailing_whitespace = true
> +
> +# C/Assembly source files, headers, and Makefiles use tabs
> +[*.{c,h,mk,S,sh,awk}]
FYI we have only single awk file which IMHO nobody uses (it may be deleted):
testcases/open_posix_testsuite/scripts/print-pass-fail-summary.awk
> +indent_style = tab
> +indent_size = 8
When we use tab anyway (i.e. it's about how is the tab displayed), could it be
indent_size = 4 ?
> +
> +[{Makefile,Makefile.*}]
nit: we should probably add here *.mk.in

> +indent_style = tab
> +indent_size = 8
> +
> +# Python and Perl scripts use spaces
> +[*.{py,pl}]
> +indent_style = space
> +indent_size = 4
Most of our python based tests contain tabs, see testcases/network/nfsv4/acl/
and testcases/realtime/func/pi-tests/.
OTOH doc/conf.py would have to be converted to tabs.

Also on perl it's hard to even decide, because vendored scripts/checkpatch.pl
uses tabs (and we modify it), but vendored scripts/checkbashisms.pl uses spaces.

> +
> +# Documentation files
> +[*.{rst,md}]
> +indent_style = space
> +indent_size = 3
If this setup is used for e.g. code block, than I would say we should have
indent_size = 4 to match the actual doc (doc/developers/test_case_tutorial.rst).

> +
> +# JSON files
> +[*.json]
> +indent_style = space
> +indent_size = 4
I'm ok with it, but our JSON files (tests added by Cyril) might be reformatted.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      reply	other threads:[~2026-03-10 13:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-09 17:20 [LTP] [PATCH v1 0/3] LTP: adjust socket xattr tests for kernel 7.0+; add .editorconfig Jan Polensky
2026-03-09 17:20 ` [LTP] [PATCH v1 1/3] fsetxattr02: Adapt test for kernel 7.0+ socket xattr support Jan Polensky
2026-03-10 13:25   ` Petr Vorel
2026-03-10 13:36     ` Petr Vorel
2026-03-11 14:54       ` Jan Polensky
2026-03-09 17:20 ` [LTP] [PATCH v1 2/3] setxattr02: " Jan Polensky
2026-03-09 17:20 ` [LTP] [PATCH v1 3/3] editorconfig: add consistent formatting rules for LTP Jan Polensky
2026-03-10 13:22   ` Petr Vorel [this message]

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=20260310132227.GC39882@pevik \
    --to=pvorel@suse.cz \
    --cc=japo@linux.ibm.com \
    --cc=ltp@lists.linux.it \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox