Thread (9 messages) flat view 9 messages, 2 authors, 15d ago

Re: [PATCH v2 4/6] dtc: dt-check-style: Unduplicate checks in check_mixed_indent_chars()

From: sashiko-bot@kernel.org
Date: 2026-09-09 08:46:55

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Undocumented behavioral change in loop refactoring expands indentation checks to continuation lines of unindented properties.
--

commit 89ba14f0783d8be45f1d6722eb8a627b6c4b34e4
Author: Krzysztof Kozlowski [off-list ref]

dtc: dt-check-style: Unduplicate checks in check_mixed_indent_chars()

This commit splits the indentation checking logic into a separate
_check_mixed_indent_chars() helper function. The goal is to avoid
duplicating code when checking both primary lines and continuation lines.
quoted hunk ↗ jump to hunk
diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
index 4ac10cb450684..41c97d996882f 100755
--- a/scripts/dtc/dt-check-style
+++ b/scripts/dtc/dt-check-style
[ ... ]
 def check_mixed_indent_chars(ctx):
     """Indent must be all-tabs, except for aligning indentation (comments
     or continued lines)."""
     for dl in ctx.lines:
-        if not dl.indent_str:
-            continue
-        if dl.linetype == LineType.PREPROCESSOR:
-            continue
-        if re.search(r' \t', dl.indent_str):
-            yield (dl.lineno, 'mixed tabs and spaces in indent')
-        if dl.indent_str.count(' ') > 7:
-            yield (dl.lineno, 'too many space characters in indent (more than 7)')
+        yield from _check_mixed_indent_chars(dl)
         for cont in dl.continuations:
[Severity: Medium]
Does this unintentionally alter the script's behavior for unindented
properties with multi-line continuations?

Previously, if a line lacked indentation, the outer loop would hit a continue
statement, entirely skipping the evaluation of dl.continuations for that line.

With the new _check_mixed_indent_chars() helper, an early return inside the
helper simply finishes checking the primary line, but execution then proceeds
to evaluate dl.continuations in the outer loop anyway. While scanning these
continuation lines might be desirable, it silently expands the style checker's
scope in a commit presented as a pure functional no-op.
-            if not cont.indent_str:
-                continue
-            if cont.linetype == LineType.PREPROCESSOR:
-                continue
-            if re.search(r' \t', cont.indent_str):
-                yield (cont.lineno, 'mixed tabs and spaces in indent')
-            if cont.indent_str.count(' ') > 7:
-                yield (cont.lineno, 'too many space characters in indent (more than 7)')
+            yield from _check_mixed_indent_chars(cont)
-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260909-b4-dts-style-checker-continued-lines-v2-0-c5cb4c9d9b66@oss.qualcomm.com?part=4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help