Skip to content

Commit 50afe1b

Browse files
committed
scripts: west_commands: zspdx: scanner: Fix linter issues
Fix issues reported by ruff. Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
1 parent 756e409 commit 50afe1b

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

.ruff-excludes.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,11 +1232,6 @@
12321232
"UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes
12331233
"UP032", # https://docs.astral.sh/ruff/rules/f-string
12341234
]
1235-
"./scripts/west_commands/zspdx/scanner.py" = [
1236-
"SIM113", # https://docs.astral.sh/ruff/rules/enumerate-for-loop
1237-
"UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters
1238-
"UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes
1239-
]
12401235
"./scripts/west_commands/zspdx/walker.py" = [
12411236
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
12421237
"F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders

scripts/west_commands/zspdx/scanner.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# Document scanning should occur.
1717
class ScannerConfig:
1818
def __init__(self):
19-
super(ScannerConfig, self).__init__()
19+
super().__init__()
2020

2121
# when assembling a Package's data, should we auto-conclude the
2222
# Package's license, based on the licenses of its Files?
@@ -63,11 +63,9 @@ def getExpressionData(filePath, numLines):
6363
"""
6464
log.dbg(f" - getting licenses for {filePath}")
6565

66-
with open(filePath, "r") as f:
66+
with open(filePath) as f:
6767
try:
68-
lineno = 0
69-
for line in f:
70-
lineno += 1
68+
for lineno, line in enumerate(f, start=1):
7169
if lineno > numLines > 0:
7270
break
7371
expression = parseLineForExpression(line)

0 commit comments

Comments
 (0)