From 8543f02fd2d1a7d23b591fa4656429e71c37ee6d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 3 Jan 2026 12:26:36 -0700 Subject: [PATCH] buildman: Fix remaining pylint warnings in boards.py - Add module-level disable for too-many-lines - Suppress consider-using-with for NamedTemporaryFile (intentional) - Change unused linenum to _ in parse_file() - Suppress too-many-arguments for _check_board() - Add missing param documentation for parse_extended() Cover-letter: buildman: Fix pylint warnings in board.py and boards.py This series addresses pylint warnings in the buildman board modules, achieving a 10/10 pylint score. For board.py, unavoidable warnings (too-many-instance-attributes, too-few-public-methods, too-many-arguments) are suppressed since the Board class is a legitimate data container. For boards.py, the series: - Fixes line-too-long and missing return documentation warnings - Refactors complex functions by extracting helper methods to reduce too-many-branches and too-many-locals warnings - Adds missing parameter documentation - Suppresses remaining unavoidable warnings END Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- tools/buildman/boards.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/buildman/boards.py b/tools/buildman/boards.py index 550c0feffa1..7992aae0914 100644 --- a/tools/buildman/boards.py +++ b/tools/buildman/boards.py @@ -3,6 +3,8 @@ # Author: Simon Glass # Author: Masahiro Yamada +# pylint: disable=too-many-lines + """Maintains a list of boards and allows them to be selected""" from collections import OrderedDict, namedtuple @@ -268,6 +270,7 @@ class KconfigScanner: '-x', 'assembler-with-cpp', defconfig] stdout = command.output(*cmd, capture_stderr=True) + # pylint: disable=consider-using-with temp = tempfile.NamedTemporaryFile(prefix='buildman-') tools.write_file(temp.name, stdout, False) fname = temp.name @@ -523,7 +526,7 @@ class MaintainersDatabase: maintainers = [] status = '-' with open(fname, encoding="utf-8") as inf: - for linenum, line in enumerate(inf): + for _, line in enumerate(inf): # Check also commented maintainers if line[:3] == '#M:': line = line[1:] @@ -688,6 +691,7 @@ class Boards: return terms @staticmethod + # pylint: disable=too-many-arguments def _check_board(brd, terms, brds, found, exclude_list, result): """Check whether to include or exclude a board @@ -1076,7 +1080,12 @@ class Boards: raise ValueError(f"Board '{target}' not found") def parse_extended(self, dbase, fname): - """Parse a single 'extended' file""" + """Parse a single 'extended' file + + Args: + dbase (tuple): Database of defconfigs from qconfig + fname (str): Path to the extended-board file to parse + """ result = ExtendedParser.parse_file(fname) for ext in result: ext_boards = self.scan_extended(dbase, ext)