Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Krzysztof Kozlowski" <krzysztof.kozlowski@oss.qualcomm.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v2 07/11] dtc: dt-check-style: Consistently call 'kind' as 'file_type'
Date: Sun, 02 Aug 2026 08:54:05 +0000	[thread overview]
Message-ID: <20260802085405.8FEF81F00AC4@smtp.kernel.org> (raw)
In-Reply-To: <20260802-n-dts-style-checker-continued-v2-7-6c5dbd1ccfe4@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] Incomplete naming refactoring: the parameter `input_type` in `check_block()` was missed during unification to `file_type`.
- [Low] Semantic conflation: the commit overloads the name `file_type` to represent both the exact file extension and the normalized syntax family.
--

--- Patch [7]: [PATCH v2 07/11] dtc: dt-check-style: Consistently call 'kind' as 'file_type' ---
commit c5a18038cd79e5838980fe5df33adfcd99b7d319
Author: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

dtc: dt-check-style: Consistently call 'kind' as 'file_type'
    
Script was using different names for variables or attributes with the
same meaning: the type of file (YAML, DTS, DTSI, DTSO).  Unify 'kind',
'input_kind' and function input_kind() to consistent 'file_type'.

> diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
> index cb3cdfda5e739..54e96ce04b209 100755
> --- a/scripts/dtc/dt-check-style
> +++ b/scripts/dtc/dt-check-style
> @@ -314,13 +314,13 @@ def collect_labels_and_refs(text):
>  
>  class Ctx:
>      """Context passed to each rule check. Carries the parsed lines,
> -    raw text, mode and kind."""
> +    raw text, mode and file_type."""
>  
> -    def __init__(self, lines, text, mode, kind):
> +    def __init__(self, lines, text, mode, file_type):
>          self.lines = lines
>          self.text = text
>          self.mode = mode               # 'relaxed' or 'strict'
> -        if kind in DTS_FAMILY:
> +        if file_type in DTS_FAMILY:
>              self.file_type = 'dts'

[Severity: Low]
This isn't a bug, but does this create some semantic confusion by overloading
the file_type parameter? The parameter receives the exact extension (e.g.,
'dtsi') but is then normalized into an instance attribute of the same name
self.file_type (e.g., 'dts'), which might mislead future maintainers.

>          else:
>              self.file_type = 'yaml'

[ ... ]

> @@ -1168,17 +1168,17 @@ DTS_FAMILY = ('dts', 'dtsi', 'dtso')
>  def collect_findings(filepath, mode):
>      """Return a (lines, count) pair for filepath. lines is a list of
>      formatted output strings; count is the number of findings."""
> -    kind = input_kind(filepath)
> -    if kind == 'yaml':
> +    file_type = get_file_type(filepath)
> +    if file_type == 'yaml':
>          iterator = iter_yaml_examples(filepath)
> -    elif kind in DTS_FAMILY:
> +    elif file_type in DTS_FAMILY:
>          iterator = iter_dts_file(filepath)
>      else:
>          return (['%s: unknown file type, skipping' % filepath], 0)
>  
>      out = []
>      for text, base, idx in iterator:
> -        for lineno, rule, msg in check_block(text, mode, kind):
> +        for lineno, rule, msg in check_block(text, mode, file_type):

[Severity: Low]
This isn't a bug, but was the parameter name in check_block() missed during
the unification? 

The commit mentions unifying the naming scheme, but the definition of
check_block() still uses input_type:

def check_block(text, mode, input_type):
    """Run all selected rules on a single block of DTS text. Returns a
    list of (lineno, rule_name, message) tuples."""
    lines = classify_lines(text)
    ctx = Ctx(lines, text, mode, input_type)

Could this also be updated to file_type for consistency?

>              abs_line = base + lineno - 1
>              ex_tag = '' if idx is None else ' example %d' % idx
>              out.append('%s:%d:%s [%s] %s' %

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260802-n-dts-style-checker-continued-v2-0-6c5dbd1ccfe4@oss.qualcomm.com?part=7

  reply	other threads:[~2026-08-02  8:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-02  8:45 [PATCH v2 00/11] dtc: dt-check-style: Improvements for false positives Krzysztof Kozlowski
2026-08-02  8:45 ` [PATCH v2 01/11] dtc: dt-check-style: Add missing /dts-v1/ to few test cases Krzysztof Kozlowski
2026-08-02  8:45 ` [PATCH v2 02/11] dtc: dt-check-style: Simplify setting depth of DtsLine Krzysztof Kozlowski
2026-08-02  8:45 ` [PATCH v2 03/11] dtc: dt-check-style: Handle root node in overlays Krzysztof Kozlowski
2026-08-02  9:01   ` sashiko-bot
2026-08-02  8:45 ` [PATCH v2 04/11] dtc: dt-check-style: Handle sorting of top-level nodes and properties Krzysztof Kozlowski
2026-08-02  8:45 ` [PATCH v2 05/11] dtc: dt-check-style: Drop stray backslash before quote for continuation-alignment Krzysztof Kozlowski
2026-08-02  8:45 ` [PATCH v2 06/11] dtc: dt-check-style: Fix alignment of values in continued property lines Krzysztof Kozlowski
2026-08-02  8:56   ` sashiko-bot
2026-08-02  8:45 ` [PATCH v2 07/11] dtc: dt-check-style: Consistently call 'kind' as 'file_type' Krzysztof Kozlowski
2026-08-02  8:54   ` sashiko-bot [this message]
2026-08-02  8:45 ` [PATCH v2 08/11] dtc: dt-check-style: Introduce 'stricter' mode Krzysztof Kozlowski
2026-08-02  9:06   ` sashiko-bot
2026-08-02 10:50     ` Krzysztof Kozlowski
2026-08-02  8:45 ` [PATCH v2 09/11] dtc: dt-check-style: Add test for trailing white-space in DTS Krzysztof Kozlowski
2026-08-02  8:51   ` sashiko-bot
2026-08-02  8:45 ` [PATCH v2 10/11] dtc: dt-check-style: Add warning for redundant white-spaces Krzysztof Kozlowski
2026-08-02  8:54   ` sashiko-bot
2026-08-02  8:45 ` [PATCH v2 11/11] MAINTAINERS: dt-bindings: Include dt-check-style in DT binding entry 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=20260802085405.8FEF81F00AC4@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