* [LTP] [PATCH v2 1/1] editorconfig: add consistent formatting rules for LTP
@ 2026-03-16 13:03 Jan Polensky
2026-03-27 10:53 ` Andrea Cervesato via ltp
0 siblings, 1 reply; 12+ messages in thread
From: Jan Polensky @ 2026-03-16 13:03 UTC (permalink / raw)
To: chrubis, pvorel; +Cc: Linux Test Project
Introduce .editorconfig to keep indentation and whitespace consistent across
editors, preventing accidental reformatting and noisy diffs.
Signed-off-by: Jan Polensky <japo@linux.ibm.com>
---
Changes since v1 (thanks Petr):
- License identifier: GPL-2.0 -> GPL-2.0-or-later
- Drop awk
- Treat Python/Perl special files
- indent_size=4 for *.{c,h,S,sh} and ver_linux
- Fix indent_size for .rst/.md to 4
.editorconfig | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
create mode 100644 .editorconfig
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 000000000000..ee67666d49c4
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,39 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+root = true
+
+# Default for all files
+[*]
+charset = utf-8
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+# C/Assembly source files, headers, and shell files use tabs
+[{*.{c,h,S,sh},ver_linux}]
+indent_style = tab
+indent_size = 4
+
+[{Makefile,Makefile.*,*.{mk.in,mk}}]
+indent_style = tab
+indent_size = 8
+
+# Python and Perl: default to tabs (most test files use tabs, checkpatch.pl which we modify)
+[*.{py,pl}]
+indent_style = tab
+indent_size = 8
+
+# Exceptions use spaces: Python (Sphinx, scripts), Perl (checkbashisms.pl vendored)
+[{doc/conf.py,scripts/*.py,scripts/checkbashisms.pl}]
+indent_style = space
+indent_size = 4
+
+# Documentation files
+[*.{rst,md}]
+indent_style = space
+indent_size = 4
+
+# JSON files
+[*.json]
+indent_style = space
+indent_size = 4
--
2.53.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [LTP] [PATCH v2 1/1] editorconfig: add consistent formatting rules for LTP
2026-03-16 13:03 [LTP] [PATCH v2 1/1] editorconfig: add consistent formatting rules for LTP Jan Polensky
@ 2026-03-27 10:53 ` Andrea Cervesato via ltp
2026-03-27 12:33 ` Petr Vorel
2026-03-27 15:29 ` Petr Vorel
0 siblings, 2 replies; 12+ messages in thread
From: Andrea Cervesato via ltp @ 2026-03-27 10:53 UTC (permalink / raw)
To: Jan Polensky; +Cc: Linux Test Project
Hi Jan,
> # C/Assembly source files, headers, and shell files use tabs
> [{*.{c,h,S,sh},ver_linux}]
> indent_style = tab
> indent_size = 4
LTP follows Linux kernel coding style, which uses 8-character-wide tabs.
This should be indent_size = 8.
> # Python and Perl: default to tabs (most test files use tabs, checkpatch.pl which we modify)
> [*.{py,pl}]
> indent_style = tab
> indent_size = 8
Not 100% sure about this.
The Python test files in the tree (e.g. pm_sched_domain.py, pm_ilb_test.py)
all use 4-space indentation, not tabs. The default for *.py should be
indent_style = space / indent_size = 4. Perl (checkpatch.pl) does use tabs,
so it should get its own section.
Also kirk uses 4 tabs indentation. So I guess we need to invert the two rules
at this point.
Regards,
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [LTP] [PATCH v2 1/1] editorconfig: add consistent formatting rules for LTP
2026-03-27 10:53 ` Andrea Cervesato via ltp
@ 2026-03-27 12:33 ` Petr Vorel
2026-03-27 13:39 ` Andrea Cervesato via ltp
2026-03-27 15:29 ` Petr Vorel
1 sibling, 1 reply; 12+ messages in thread
From: Petr Vorel @ 2026-03-27 12:33 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: Linux Test Project
> Hi Jan,
> > # C/Assembly source files, headers, and shell files use tabs
> > [{*.{c,h,S,sh},ver_linux}]
> > indent_style = tab
> > indent_size = 4
> LTP follows Linux kernel coding style, which uses 8-character-wide tabs.
> This should be indent_size = 8.
FYI I asked for 4 in v1 [1], Jan had originally 8 and I'm ok with following
kernel. It's just my personal preference to display tab as 4 spaces and not 8
(IMHO editorconfig plugins don't allow certain setup to be overwritten).
Kind regards,
Petr
[1] https://lore.kernel.org/ltp/20260310132227.GC39882@pevik/
> > # Python and Perl: default to tabs (most test files use tabs, checkpatch.pl which we modify)
> > [*.{py,pl}]
> > indent_style = tab
> > indent_size = 8
> Not 100% sure about this.
> The Python test files in the tree (e.g. pm_sched_domain.py, pm_ilb_test.py)
> all use 4-space indentation, not tabs. The default for *.py should be
> indent_style = space / indent_size = 4. Perl (checkpatch.pl) does use tabs,
> so it should get its own section.
> Also kirk uses 4 tabs indentation. So I guess we need to invert the two rules
> at this point.
> Regards,
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [LTP] [PATCH v2 1/1] editorconfig: add consistent formatting rules for LTP
2026-03-27 12:33 ` Petr Vorel
@ 2026-03-27 13:39 ` Andrea Cervesato via ltp
2026-03-27 17:43 ` Petr Vorel
0 siblings, 1 reply; 12+ messages in thread
From: Andrea Cervesato via ltp @ 2026-03-27 13:39 UTC (permalink / raw)
To: Petr Vorel; +Cc: Linux Test Project
Hi Petr,
> FYI I asked for 4 in v1 [1], Jan had originally 8 and I'm ok with following
> kernel. It's just my personal preference to display tab as 4 spaces and not 8
> (IMHO editorconfig plugins don't allow certain setup to be overwritten).
Sorry I missed that. I'm just wondering if editor configuration is applied
only for visualization or also for typing. If it's applied for typing then we
can't use 4 chars, otherwise we will have many issues with checkpatch.pl when
verifying the source code.
Regards,
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v2 1/1] editorconfig: add consistent formatting rules for LTP
2026-03-27 13:39 ` Andrea Cervesato via ltp
@ 2026-03-27 17:43 ` Petr Vorel
2026-03-27 18:25 ` Jan Polensky
0 siblings, 1 reply; 12+ messages in thread
From: Petr Vorel @ 2026-03-27 17:43 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: Linux Test Project
> Hi Petr,
> > FYI I asked for 4 in v1 [1], Jan had originally 8 and I'm ok with following
> > kernel. It's just my personal preference to display tab as 4 spaces and not 8
> > (IMHO editorconfig plugins don't allow certain setup to be overwritten).
> Sorry I missed that. I'm just wondering if editor configuration is applied
> only for visualization or also for typing. If it's applied for typing then we
> can't use 4 chars, otherwise we will have many issues with checkpatch.pl when
> verifying the source code.
To be honest I don't know (I haven't installed the plugin for my editor yet).
But I'd suspect that on indent_style = tab it just adds a tab and indent_size = 8
is only the representation.
https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#indent_size
Indentation Size (in single-spaced characters)
Possible Values
an integer
tab
If indent_size equals to tab, the indent_size will be set to the tab size,
which should be tab_width if tab_width is specified, or the tab size set by
editor if tab_width is not specified.
I wonder if it worked for us to set indent_size = unset for all indent_style = tab
(of course not for indent_style = space).
https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#current-universal-properties
For any property, a value of unset is to remove the effect of that property,
even if it has been set before. For example, add indent_size = unset to undefine
indent_size property (and use editor default).
@Jan?
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v2 1/1] editorconfig: add consistent formatting rules for LTP
2026-03-27 17:43 ` Petr Vorel
@ 2026-03-27 18:25 ` Jan Polensky
2026-03-27 18:59 ` Petr Vorel
0 siblings, 1 reply; 12+ messages in thread
From: Jan Polensky @ 2026-03-27 18:25 UTC (permalink / raw)
To: Petr Vorel, Andrea Cervesato; +Cc: Linux Test Project
On Fri, Mar 27, 2026 at 06:43:38PM +0100, Petr Vorel wrote:
> > Hi Petr,
>
> > > FYI I asked for 4 in v1 [1], Jan had originally 8 and I'm ok with following
> > > kernel. It's just my personal preference to display tab as 4 spaces and not 8
> > > (IMHO editorconfig plugins don't allow certain setup to be overwritten).
>
> > Sorry I missed that. I'm just wondering if editor configuration is applied
> > only for visualization or also for typing. If it's applied for typing then we
> > can't use 4 chars, otherwise we will have many issues with checkpatch.pl when
> > verifying the source code.
>
> To be honest I don't know (I haven't installed the plugin for my editor yet).
> But I'd suspect that on indent_style = tab it just adds a tab and indent_size = 8
> is only the representation.
>
> https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#indent_size
>
> Indentation Size (in single-spaced characters)
>
> Possible Values
>
> an integer
> tab
>
> If indent_size equals to tab, the indent_size will be set to the tab size,
> which should be tab_width if tab_width is specified, or the tab size set by
> editor if tab_width is not specified.
>
> I wonder if it worked for us to set indent_size = unset for all indent_style = tab
> (of course not for indent_style = space).
>
> https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#current-universal-properties
>
> For any property, a value of unset is to remove the effect of that property,
> even if it has been set before. For example, add indent_size = unset to undefine
> indent_size property (and use editor default).
>
> @Jan?
>
> Kind regards,
> Petr
Hi Petr,
Good catch, the EditorConfig wiki is explicit here:
- indent_size can be an integer or tab.
- If indent_size = tab, then indent_size becomes the tab size:
tab_width if set, otherwise the editor’s default tab size.
- Any property can be set to unset to remove its effect (so the editor
default is used).
So yes: we could do indent_style = tab together with
indent_size = unset if the goal is “tabs, but don’t prescribe a
width”.
If we want consistent visual width/alignment across editors, a more
explicit setup would be indent_size = tab plus tab_width = 8.
Kind regards,
Jan
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v2 1/1] editorconfig: add consistent formatting rules for LTP
2026-03-27 18:25 ` Jan Polensky
@ 2026-03-27 18:59 ` Petr Vorel
0 siblings, 0 replies; 12+ messages in thread
From: Petr Vorel @ 2026-03-27 18:59 UTC (permalink / raw)
To: Jan Polensky; +Cc: Linux Test Project
> On Fri, Mar 27, 2026 at 06:43:38PM +0100, Petr Vorel wrote:
> > > Hi Petr,
> > > > FYI I asked for 4 in v1 [1], Jan had originally 8 and I'm ok with following
> > > > kernel. It's just my personal preference to display tab as 4 spaces and not 8
> > > > (IMHO editorconfig plugins don't allow certain setup to be overwritten).
> > > Sorry I missed that. I'm just wondering if editor configuration is applied
> > > only for visualization or also for typing. If it's applied for typing then we
> > > can't use 4 chars, otherwise we will have many issues with checkpatch.pl when
> > > verifying the source code.
> > To be honest I don't know (I haven't installed the plugin for my editor yet).
> > But I'd suspect that on indent_style = tab it just adds a tab and indent_size = 8
> > is only the representation.
> > https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#indent_size
> > Indentation Size (in single-spaced characters)
> > Possible Values
> > an integer
> > tab
> > If indent_size equals to tab, the indent_size will be set to the tab size,
> > which should be tab_width if tab_width is specified, or the tab size set by
> > editor if tab_width is not specified.
> > I wonder if it worked for us to set indent_size = unset for all indent_style = tab
> > (of course not for indent_style = space).
> > https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#current-universal-properties
> > For any property, a value of unset is to remove the effect of that property,
> > even if it has been set before. For example, add indent_size = unset to undefine
> > indent_size property (and use editor default).
> > @Jan?
> > Kind regards,
> > Petr
> Hi Petr,
> Good catch, the EditorConfig wiki is explicit here:
> - indent_size can be an integer or tab.
> - If indent_size = tab, then indent_size becomes the tab size:
> tab_width if set, otherwise the editor’s default tab size.
> - Any property can be set to unset to remove its effect (so the editor
> default is used).
> So yes: we could do indent_style = tab together with
> indent_size = unset if the goal is “tabs, but don’t prescribe a
> width”.
> If we want consistent visual width/alignment across editors, a more
> explicit setup would be indent_size = tab plus tab_width = 8.
Hopefully all editors have meaningful default therefore I'd be for not setting
it. But not a strong requirement if others want to have it specified.
Kind regards,
Petr
> Kind regards,
> Jan
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v2 1/1] editorconfig: add consistent formatting rules for LTP
2026-03-27 10:53 ` Andrea Cervesato via ltp
2026-03-27 12:33 ` Petr Vorel
@ 2026-03-27 15:29 ` Petr Vorel
2026-03-27 17:55 ` Jan Polensky
2026-03-30 7:23 ` Andrea Cervesato via ltp
1 sibling, 2 replies; 12+ messages in thread
From: Petr Vorel @ 2026-03-27 15:29 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: Linux Test Project
...
> > # Python and Perl: default to tabs (most test files use tabs, checkpatch.pl which we modify)
> > [*.{py,pl}]
> > indent_style = tab
> > indent_size = 8
> Not 100% sure about this.
> The Python test files in the tree (e.g. pm_sched_domain.py, pm_ilb_test.py)
> all use 4-space indentation, not tabs. The default for *.py should be
> indent_style = space / indent_size = 4. Perl (checkpatch.pl) does use tabs,
> so it should get its own section.
> Also kirk uses 4 tabs indentation. So I guess we need to invert the two rules
> at this point.
Would it work if kirk has it's own .editorconfig? I mean, it should have anyway,
but if it will be applied on it as a submodule.
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [LTP] [PATCH v2 1/1] editorconfig: add consistent formatting rules for LTP
2026-03-27 15:29 ` Petr Vorel
@ 2026-03-27 17:55 ` Jan Polensky
2026-03-27 18:25 ` Petr Vorel
2026-03-30 7:23 ` Andrea Cervesato via ltp
1 sibling, 1 reply; 12+ messages in thread
From: Jan Polensky @ 2026-03-27 17:55 UTC (permalink / raw)
To: Petr Vorel, Andrea Cervesato; +Cc: Linux Test Project
On Fri, Mar 27, 2026 at 04:29:52PM +0100, Petr Vorel wrote:
> ...
> > > # Python and Perl: default to tabs (most test files use tabs, checkpatch.pl which we modify)
> > > [*.{py,pl}]
> > > indent_style = tab
> > > indent_size = 8
>
> > Not 100% sure about this.
>
> > The Python test files in the tree (e.g. pm_sched_domain.py, pm_ilb_test.py)
> > all use 4-space indentation, not tabs. The default for *.py should be
> > indent_style = space / indent_size = 4. Perl (checkpatch.pl) does use tabs,
> > so it should get its own section.
>
> > Also kirk uses 4 tabs indentation. So I guess we need to invert the two rules
> > at this point.
>
> Would it work if kirk has it's own .editorconfig? I mean, it should have anyway,
> but if it will be applied on it as a submodule.
>
> Kind regards,
> Petr
Hi Petr,
In upstream LTP, kirk is actually included as a git submodule at
`tools/kirk` (see `.gitmodules`), so having kirk carry its own
`.editorconfig` is a natural fit.
EditorConfig is directory-hierarchical: editors look for `.editorconfig`
files from the file’s directory upwards, and the closest matching
settings override parent ones. If kirk’s `.editorconfig` sets `root =
true`, the lookup stops at the submodule root, so LTP’s top-level rules
won’t affect files inside `tools/kirk`.
Alternatively, if one prefer a single policy file, one could keep
everything in LTP’s top-level `.editorconfig` and add a dedicated
override section like `[tools/kirk/**]`.
Kind regards,
Jan
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [LTP] [PATCH v2 1/1] editorconfig: add consistent formatting rules for LTP
2026-03-27 17:55 ` Jan Polensky
@ 2026-03-27 18:25 ` Petr Vorel
0 siblings, 0 replies; 12+ messages in thread
From: Petr Vorel @ 2026-03-27 18:25 UTC (permalink / raw)
To: Jan Polensky; +Cc: Linux Test Project
...
> > Would it work if kirk has it's own .editorconfig? I mean, it should have anyway,
> > but if it will be applied on it as a submodule.
> > Kind regards,
> > Petr
> Hi Petr,
> In upstream LTP, kirk is actually included as a git submodule at
> `tools/kirk` (see `.gitmodules`), so having kirk carry its own
> `.editorconfig` is a natural fit.
> EditorConfig is directory-hierarchical: editors look for `.editorconfig`
> files from the file’s directory upwards, and the closest matching
> settings override parent ones. If kirk’s `.editorconfig` sets `root =
> true`, the lookup stops at the submodule root, so LTP’s top-level rules
> won’t affect files inside `tools/kirk`.
+1 (this was my question), thanks for info. Hopefully this is widely supported
feature (I haven't found it on the wiki).
> Alternatively, if one prefer a single policy file, one could keep
> everything in LTP’s top-level `.editorconfig` and add a dedicated
> override section like `[tools/kirk/**]`.
Thanks for info. That would not work because the primary development is in kirk
repo, let's have the config there.
Kind regards,
Petr
> Kind regards,
> Jan
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v2 1/1] editorconfig: add consistent formatting rules for LTP
2026-03-27 15:29 ` Petr Vorel
2026-03-27 17:55 ` Jan Polensky
@ 2026-03-30 7:23 ` Andrea Cervesato via ltp
2026-03-31 19:59 ` Jan Polensky
1 sibling, 1 reply; 12+ messages in thread
From: Andrea Cervesato via ltp @ 2026-03-30 7:23 UTC (permalink / raw)
To: Petr Vorel; +Cc: Linux Test Project
> Would it work if kirk has it's own .editorconfig? I mean, it should have anyway,
> but if it will be applied on it as a submodule.
There's no need, everything is handled by `ruff` that is auto-formatting
and cleaning up python code. Its configuration is in `pyproject.toml` and
it's de-facto standard for python development nowadays.
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v2 1/1] editorconfig: add consistent formatting rules for LTP
2026-03-30 7:23 ` Andrea Cervesato via ltp
@ 2026-03-31 19:59 ` Jan Polensky
0 siblings, 0 replies; 12+ messages in thread
From: Jan Polensky @ 2026-03-31 19:59 UTC (permalink / raw)
To: Andrea Cervesato, Petr Vorel; +Cc: Linux Test Project
On Mon, Mar 30, 2026 at 07:23:23AM +0000, Andrea Cervesato wrote:
> > Would it work if kirk has it's own .editorconfig? I mean, it should have anyway,
> > but if it will be applied on it as a submodule.
>
> There's no need, everything is handled by `ruff` that is auto-formatting
> and cleaning up python code. Its configuration is in `pyproject.toml` and
> it's de-facto standard for python development nowadays.
>
> --
> Andrea Cervesato
> SUSE QE Automation Engineer Linux
> andrea.cervesato@suse.com
Hi Andrea, hi Petr,
thanks for the review!
I’m sending v3 addressing the comments:
Changes since v2:
- Use kernel-style tabs for C/ASM/shell (tab stop 8 via tab_width=8, indent_size=tab). (thx Andrea Cervesato, Petr Vorel)
- Split Python/Perl indentation: *.py uses 4 spaces; *.pl keeps tabs. (thx Andrea Cervesato)
Best regards,
Jan
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2026-03-31 20:00 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-16 13:03 [LTP] [PATCH v2 1/1] editorconfig: add consistent formatting rules for LTP Jan Polensky
2026-03-27 10:53 ` Andrea Cervesato via ltp
2026-03-27 12:33 ` Petr Vorel
2026-03-27 13:39 ` Andrea Cervesato via ltp
2026-03-27 17:43 ` Petr Vorel
2026-03-27 18:25 ` Jan Polensky
2026-03-27 18:59 ` Petr Vorel
2026-03-27 15:29 ` Petr Vorel
2026-03-27 17:55 ` Jan Polensky
2026-03-27 18:25 ` Petr Vorel
2026-03-30 7:23 ` Andrea Cervesato via ltp
2026-03-31 19:59 ` Jan Polensky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox