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 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
# Author: Simon Glass <sjg@chromium.org>
|
# Author: Simon Glass <sjg@chromium.org>
|
||||||
# Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
|
# Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
|
||||||
|
|
||||||
|
# pylint: disable=too-many-lines
|
||||||
|
|
||||||
"""Maintains a list of boards and allows them to be selected"""
|
"""Maintains a list of boards and allows them to be selected"""
|
||||||
|
|
||||||
from collections import OrderedDict, namedtuple
|
from collections import OrderedDict, namedtuple
|
||||||
@@ -268,6 +270,7 @@ class KconfigScanner:
|
|||||||
'-x', 'assembler-with-cpp',
|
'-x', 'assembler-with-cpp',
|
||||||
defconfig]
|
defconfig]
|
||||||
stdout = command.output(*cmd, capture_stderr=True)
|
stdout = command.output(*cmd, capture_stderr=True)
|
||||||
|
# pylint: disable=consider-using-with
|
||||||
temp = tempfile.NamedTemporaryFile(prefix='buildman-')
|
temp = tempfile.NamedTemporaryFile(prefix='buildman-')
|
||||||
tools.write_file(temp.name, stdout, False)
|
tools.write_file(temp.name, stdout, False)
|
||||||
fname = temp.name
|
fname = temp.name
|
||||||
@@ -523,7 +526,7 @@ class MaintainersDatabase:
|
|||||||
maintainers = []
|
maintainers = []
|
||||||
status = '-'
|
status = '-'
|
||||||
with open(fname, encoding="utf-8") as inf:
|
with open(fname, encoding="utf-8") as inf:
|
||||||
for linenum, line in enumerate(inf):
|
for _, line in enumerate(inf):
|
||||||
# Check also commented maintainers
|
# Check also commented maintainers
|
||||||
if line[:3] == '#M:':
|
if line[:3] == '#M:':
|
||||||
line = line[1:]
|
line = line[1:]
|
||||||
@@ -688,6 +691,7 @@ class Boards:
|
|||||||
return terms
|
return terms
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
# pylint: disable=too-many-arguments
|
||||||
def _check_board(brd, terms, brds, found, exclude_list, result):
|
def _check_board(brd, terms, brds, found, exclude_list, result):
|
||||||
"""Check whether to include or exclude a board
|
"""Check whether to include or exclude a board
|
||||||
|
|
||||||
@@ -1076,7 +1080,12 @@ class Boards:
|
|||||||
raise ValueError(f"Board '{target}' not found")
|
raise ValueError(f"Board '{target}' not found")
|
||||||
|
|
||||||
def parse_extended(self, dbase, fname):
|
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)
|
result = ExtendedParser.parse_file(fname)
|
||||||
for ext in result:
|
for ext in result:
|
||||||
ext_boards = self.scan_extended(dbase, ext)
|
ext_boards = self.scan_extended(dbase, ext)
|
||||||
|
|||||||
Reference in New Issue
Block a user