Skip to content

Commit 756e409

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

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

.ruff-excludes.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,12 +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/sbom.py" = [
1236-
"F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders
1237-
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
1238-
"SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler
1239-
"UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters
1240-
]
12411235
"./scripts/west_commands/zspdx/scanner.py" = [
12421236
"SIM113", # https://docs.astral.sh/ruff/rules/enumerate-for-loop
12431237
"UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters

scripts/west_commands/zspdx/sbom.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66

77
from west import log
88

9-
from zspdx.walker import WalkerConfig, Walker
109
from zspdx.scanner import ScannerConfig, scanDocument
10+
from zspdx.walker import Walker, WalkerConfig
1111
from zspdx.writer import writeSPDX
1212

1313

1414
# SBOMConfig contains settings that will be passed along to the various
1515
# SBOM maker subcomponents.
1616
class SBOMConfig:
1717
def __init__(self):
18-
super(SBOMConfig, self).__init__()
18+
super().__init__()
1919

2020
# prefix for Document namespaces; should not end with "/"
2121
self.namespacePrefix = ""
@@ -58,8 +58,8 @@ def setupCmakeQuery(build_dir):
5858
return True
5959
else:
6060
# file doesn't exist, let's create an empty file
61-
cm_fd = open(queryFilePath, "w")
62-
cm_fd.close()
61+
with open(queryFilePath, "w"):
62+
pass
6363
return True
6464

6565

@@ -69,8 +69,8 @@ def setupCmakeQuery(build_dir):
6969
def makeSPDX(cfg):
7070
# report any odd configuration settings
7171
if cfg.analyzeIncludes and not cfg.includeSDK:
72-
log.wrn(f"config: requested to analyze includes but not to generate SDK SPDX document;")
73-
log.wrn(f"config: will proceed but will discard detected includes for SDK header files")
72+
log.wrn("config: requested to analyze includes but not to generate SDK SPDX document;")
73+
log.wrn("config: will proceed but will discard detected includes for SDK header files")
7474

7575
# set up walker configuration
7676
walkerCfg = WalkerConfig()

0 commit comments

Comments
 (0)