All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Krzysztof Kozlowski" <krzysztof.kozlowski@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 4/6] dtc: dt-check-style: Unduplicate checks in check_mixed_indent_chars()
Date: Wed, 09 Sep 2026 08:46:53 +0000	[thread overview]
Message-ID: <20260909084654.B69C81F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260909-b4-dts-style-checker-continued-lines-v2-4-c5cb4c9d9b66@oss.qualcomm.com>

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 <krzysztof.kozlowski@oss.qualcomm.com>

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.

> 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

  reply	other threads:[~2026-09-09  8:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-09  8:35 [PATCH v2 0/6] dtc: dt-check-style: Improvements for handling continued lines Krzysztof Kozlowski
2026-09-09  8:35 ` [PATCH v2 1/6] dtc: dt-check-style: Handle continued lines in check_hex_case() Krzysztof Kozlowski
2026-09-09  8:35 ` [PATCH v2 2/6] dtc: dt-check-style: Handle continued lines in check_line_length() Krzysztof Kozlowski
2026-09-09  8:35 ` [PATCH v2 3/6] dtc: dt-check-style: Handle continued lines in check_trailing_whitespace() Krzysztof Kozlowski
2026-09-09  8:35 ` [PATCH v2 4/6] dtc: dt-check-style: Unduplicate checks in check_mixed_indent_chars() Krzysztof Kozlowski
2026-09-09  8:46   ` sashiko-bot [this message]
2026-09-09  9:57     ` Krzysztof Kozlowski
2026-09-09  8:35 ` [PATCH v2 5/6] dtc: dt-check-style: Right strip whitespaces, leftovers before comments Krzysztof Kozlowski
2026-09-09  8:35 ` [PATCH v2 6/6] dtc: dt-check-style: Properly detect comments in multi-line properties 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=20260909084654.B69C81F00A3A@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.