scripts: west_commands: zspdx: scanner: Fix linter issues
Fix issues reported by ruff. Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
This commit is contained in:
parent
10bd714110
commit
e365746fd9
2 changed files with 3 additions and 10 deletions
|
@ -1190,11 +1190,6 @@
|
||||||
"UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes
|
"UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes
|
||||||
"UP032", # https://docs.astral.sh/ruff/rules/f-string
|
"UP032", # https://docs.astral.sh/ruff/rules/f-string
|
||||||
]
|
]
|
||||||
"./scripts/west_commands/zspdx/scanner.py" = [
|
|
||||||
"SIM113", # https://docs.astral.sh/ruff/rules/enumerate-for-loop
|
|
||||||
"UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters
|
|
||||||
"UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes
|
|
||||||
]
|
|
||||||
"./scripts/west_commands/zspdx/walker.py" = [
|
"./scripts/west_commands/zspdx/walker.py" = [
|
||||||
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
|
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
|
||||||
"F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders
|
"F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders
|
||||||
|
|
|
@ -16,7 +16,7 @@ from zspdx.util import getHashes
|
||||||
# Document scanning should occur.
|
# Document scanning should occur.
|
||||||
class ScannerConfig:
|
class ScannerConfig:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(ScannerConfig, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
# when assembling a Package's data, should we auto-conclude the
|
# when assembling a Package's data, should we auto-conclude the
|
||||||
# Package's license, based on the licenses of its Files?
|
# Package's license, based on the licenses of its Files?
|
||||||
|
@ -63,11 +63,9 @@ def getExpressionData(filePath, numLines):
|
||||||
"""
|
"""
|
||||||
log.dbg(f" - getting licenses for {filePath}")
|
log.dbg(f" - getting licenses for {filePath}")
|
||||||
|
|
||||||
with open(filePath, "r") as f:
|
with open(filePath) as f:
|
||||||
try:
|
try:
|
||||||
lineno = 0
|
for lineno, line in enumerate(f, start=1):
|
||||||
for line in f:
|
|
||||||
lineno += 1
|
|
||||||
if lineno > numLines > 0:
|
if lineno > numLines > 0:
|
||||||
break
|
break
|
||||||
expression = parseLineForExpression(line)
|
expression = parseLineForExpression(line)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue