Devicetree
 help / color / mirror / Atom feed
* [PATCH] dtc: dt-check-style: Allow space-aligning indentation in DTS
@ 2026-07-06  7:14 Krzysztof Kozlowski
  2026-07-06  7:21 ` sashiko-bot
  0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-06  7:14 UTC (permalink / raw)
  To: Rob Herring, Saravana Kannan, devicetree, linux-kernel
  Cc: Krzysztof Kozlowski

DTS often have spaces after tabs in indentation for aligning continued
lines of comments or list properties, thus allow such cases to avoid
many false positives.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
 scripts/dtc/dt-check-style | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
index 2d5723d41ea3..6d02d045f92d 100755
--- a/scripts/dtc/dt-check-style
+++ b/scripts/dtc/dt-check-style
@@ -365,8 +365,13 @@ def check_mixed_indent_chars(ctx):
             continue
         if dl.linetype == LineType.PREPROCESSOR:
             continue
-        if ' ' in dl.indent_str and '\t' in dl.indent_str:
-            yield (dl.lineno, 'mixed tabs and spaces in indent')
+        if ctx.indent_kind == 'spaces':
+            if ' ' in dl.indent_str and '\t' in dl.indent_str:
+                yield (dl.lineno, 'mixed tabs and spaces in indent')
+        else:
+            # Spaces are used to align indentation in comments or continued lines
+            if dl.indent_str.count(' ') > 7:
+                yield (dl.lineno, 'too many space characters in indent (more than 7)')
 
 
 def detect_indent_unit(ctx):
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] dtc: dt-check-style: Allow space-aligning indentation in DTS
  2026-07-06  7:14 [PATCH] dtc: dt-check-style: Allow space-aligning indentation in DTS Krzysztof Kozlowski
@ 2026-07-06  7:21 ` sashiko-bot
  2026-07-06  7:26   ` Krzysztof Kozlowski
  0 siblings, 1 reply; 3+ messages in thread
From: sashiko-bot @ 2026-07-06  7:21 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: robh, devicetree, conor+dt

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] The relaxed indentation check in `check_mixed_indent_chars` permits the 'space before tab' anti-pattern.
- [Low] Docstring and rule registry description contradict the new code behavior.
--

commit 097e3ef5e7d164bd1c9be0d6781e53f6f27aaa64
Author: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Subject: dtc: dt-check-style: Allow space-aligning indentation in DTS

This commit relaxes the DTS style checking to allow spaces after tabs in
indentation. This is intended to permit space-aligning for continued lines
of comments or list properties.

> diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
> index 2d5723d41ea39..6d02d045f92d1 100755
> --- a/scripts/dtc/dt-check-style
> +++ b/scripts/dtc/dt-check-style
> @@ -365,8 +365,13 @@ def check_mixed_indent_chars(ctx):

[Severity: Low]
Does the docstring for check_mixed_indent_chars() need to be updated?

The new implementation explicitly allows mixing spaces and tabs in DTS files up
to 7 spaces, which contradicts the assertion in the docstring that they can
never be mixed on one line. This contradiction also applies to the rule
registry description further down in the file.

>              continue
>          if dl.linetype == LineType.PREPROCESSOR:
>              continue
> -        if ' ' in dl.indent_str and '\t' in dl.indent_str:
> -            yield (dl.lineno, 'mixed tabs and spaces in indent')
> +        if ctx.indent_kind == 'spaces':
> +            if ' ' in dl.indent_str and '\t' in dl.indent_str:
> +                yield (dl.lineno, 'mixed tabs and spaces in indent')
> +        else:
> +            # Spaces are used to align indentation in comments or continued lines
> +            if dl.indent_str.count(' ') > 7:

[Severity: Low]
Does this condition properly enforce the "spaces after tabs" intent mentioned
in the commit message?

By only checking if the total space count exceeds 7, the code appears to still
allow "space before tab" combinations, provided the total number of spaces is 7
or fewer. Could this lead to invalid indentation slipping through the style
checker?

> +                yield (dl.lineno, 'too many space characters in indent (more than 7)')
>  
>  
>  def detect_indent_unit(ctx):

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260706071446.87669-2-krzysztof.kozlowski@oss.qualcomm.com?part=1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dtc: dt-check-style: Allow space-aligning indentation in DTS
  2026-07-06  7:21 ` sashiko-bot
@ 2026-07-06  7:26   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-06  7:26 UTC (permalink / raw)
  To: sashiko-reviews; +Cc: robh, devicetree, conor+dt

On 06/07/2026 09:21, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> - [Low] The relaxed indentation check in `check_mixed_indent_chars` permits the 'space before tab' anti-pattern.

Not relevant.

> - [Low] Docstring and rule registry description contradict the new code behavior.

I'll update.



Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-06  7:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-06  7:14 [PATCH] dtc: dt-check-style: Allow space-aligning indentation in DTS Krzysztof Kozlowski
2026-07-06  7:21 ` sashiko-bot
2026-07-06  7:26   ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox