Re: [PATCH v3 10/11] dtc: dt-check-style: Add warning for redundant white-spaces

Krzysztof Kozlowski <[email protected]>
Newsgroups org.kernel.vger.linux-devicetree,dev.linux.lists.sashiko-reviews
Message-ID <20260805-durable-swinging-skylark-f687f3@quoll>
On Mon, Aug 03, 2026 at 09:13:31AM +0000, [email protected] wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] False positives in dt-check-style whitespace checks due to unstripped strings and inline comments.
> --
> 
> --- Patch [10]: [PATCH v3 10/11] dtc: dt-check-style: Add warning for redundant white-spaces ---
> commit f5a3cbd31bda433ce990bca1b2244f3a3da27d87
> Author: Krzysztof Kozlowski <[email protected]>
> 
> dtc: dt-check-style: Add warning for redundant white-spaces
> 
> This commit adds a warning in dt-check-style to catch excessive spaces or
> tabs around '=', before '{', and before ';'. The checking is split between
> relaxed and strict modes to accommodate existing in-tree usage.
> 
> > diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
> > index 1430c675bd951..aa2072957a1a0 100755
> > --- a/scripts/dtc/dt-check-style
> > +++ b/scripts/dtc/dt-check-style
> > @@ -348,6 +348,36 @@ def check_trailing_whitespace(ctx):
> >              yield (dl.lineno, 'trailing whitespace')
> >  
> >  
> > +def check_redundant_whitespace(ctx):
> > +    """No whitespace between brackets or other code elements.
> > +    See also check_value_whitespace() for more checks."""
> > +    for dl in ctx.lines:
> > +        if dl.linetype in (LineType.COMMENT, LineType.COMMENT_BODY,
> > +                           LineType.COMMENT_END, LineType.COMMENT_START,
> > +                           LineType.PREPROCESSOR):
> > +            continue
> > +        if re.search(r'(\s\s+|\t){', dl.raw):
> > +            yield (dl.lineno, 'extra whitespace before {')
> > +        if re.search(r':(\s\s+|\t)', dl.raw):
> > +            yield (dl.lineno, 'extra whitespace after :')
> > +        if re.search(r'\s+;', dl.raw):
> 
> [Severity: Medium]
> Does using dl.raw directly here cause false positives for inline comments or
> string literals?

Ack

Best regards,
Krzysztof
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.