From: sashiko-bot@kernel.org
To: "Krzysztof Kozlowski" <krzysztof.kozlowski@oss.qualcomm.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 2/2] dtc: dt-check-style: Allow space-aligning indentation in DTS
Date: Mon, 06 Jul 2026 10:31:09 +0000 [thread overview]
Message-ID: <20260706103110.31D891F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260706102421.343639-4-krzysztof.kozlowski@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The use of `re.match()` instead of `re.search()` or the `in` operator causes the script to only detect a space followed by a tab if it occurs at the very beginning of the indentation string.
--
commit b4c995f24f81e6a677f411361809325fa7fa3599
Author: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
dtc: dt-check-style: Allow space-aligning indentation in DTS
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. What we can easily detect is a space followed by
tab or too many spaces (more than alignment).
> diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
> index 34e0f7e2a57a4..e49b7446a2f72 100755
> --- a/scripts/dtc/dt-check-style
> +++ b/scripts/dtc/dt-check-style
> @@ -359,14 +359,17 @@ def check_tab_in_yaml_example(ctx):
>
>
> def check_mixed_indent_chars(ctx):
> - """Indent must be all-spaces or all-tabs, never mixed on one line."""
> + """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 ' ' in dl.indent_str and '\t' in dl.indent_str:
> + if re.match(r' \t', dl.indent_str):
[Severity: Low]
Because Python's re.match() enforces an implicit string-start anchor, does
this condition in check_mixed_indent_chars() fail to detect mixed
indentation if a space precedes a tab but doesn't occur at the very
beginning of the line?
For example, an indentation sequence like tab-space-tab would be ignored.
Would re.search() or checking ' \t' in dl.indent_str be more effective here?
> 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)')
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260706102421.343639-3-krzysztof.kozlowski@oss.qualcomm.com?part=2
next prev parent reply other threads:[~2026-07-06 10:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 10:24 [PATCH v2 1/2] dtc: dt-check-style: Narrow disallowing of tab in DTS only to YAML Krzysztof Kozlowski
2026-07-06 10:24 ` [PATCH v2 2/2] dtc: dt-check-style: Allow space-aligning indentation in DTS Krzysztof Kozlowski
2026-07-06 10:31 ` sashiko-bot [this message]
2026-07-06 15:32 ` Krzysztof Kozlowski
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=20260706103110.31D891F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski@oss.qualcomm.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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