Skip to content

Commit 8c60281

Browse files
committed
scripts: kconfig: apply ruff fixes to hardenconfig.py
Wrap long lines so that there is no need to exclude this file from ruff anymore. Signed-off-by: Benjamin Cabé <[email protected]>
1 parent 390b124 commit 8c60281

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

.ruff-excludes.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -529,10 +529,6 @@
529529
"UP032", # https://docs.astral.sh/ruff/rules/f-string
530530
"UP038", # https://docs.astral.sh/ruff/rules/non-pep604-isinstance
531531
]
532-
"./scripts/kconfig/hardenconfig.py" = [
533-
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
534-
"UP032", # https://docs.astral.sh/ruff/rules/f-string
535-
]
536532
"./scripts/kconfig/kconfigfunctions.py" = [
537533
"B011", # https://docs.astral.sh/ruff/rules/assert-false
538534
"SIM114", # https://docs.astral.sh/ruff/rules/if-with-same-arms

scripts/kconfig/hardenconfig.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,24 @@ def compare_with_hardened_conf(kconf, hardened_kconf_filename):
5252
except KeyError:
5353
symbol = None
5454
current = None
55-
options.append(Option(name=name, current=current,
56-
recommended=recommended, symbol=symbol))
55+
options.append(
56+
Option(name=name, current=current, recommended=recommended, symbol=symbol)
57+
)
5758
for node in kconf.node_iter():
5859
for select in node.selects:
59-
if kconf.syms["EXPERIMENTAL"] in select or kconf.syms["DEPRECATED"] in select or kconf.syms["NOT_SECURE"] in select:
60-
options.append(Option(name=node.item.name, current=node.item.str_value, recommended='n', symbol=node.item))
60+
if (
61+
kconf.syms["EXPERIMENTAL"] in select
62+
or kconf.syms["DEPRECATED"] in select
63+
or kconf.syms["NOT_SECURE"] in select
64+
):
65+
options.append(
66+
Option(
67+
name=node.item.name,
68+
current=node.item.str_value,
69+
recommended='n',
70+
symbol=node.item,
71+
)
72+
)
6173

6274
return options
6375

0 commit comments

Comments
 (0)