Skip to content

Commit f2b5188

Browse files
pdgendtfabiobaltieri
authored andcommitted
scripts: Update and lock ruff
The ruff linter and formatter should get a locked version to be installed for compliance. This prevents new linter issues because of ruff updates itself. Ruff version 0.8.0 removed the deprecated UP027 rule so it's removed from the ignore list. Update the excludes file to match the actual reported issues. Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
1 parent 9ca1b0f commit f2b5188

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

.ruff-excludes.toml

+10-15
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@
126126
"SIM113", # https://docs.astral.sh/ruff/rules/enumerate-for-loop
127127
"SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler
128128
"UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import
129+
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
129130
"UP032", # https://docs.astral.sh/ruff/rules/f-string
130131
]
131132
"./samples/modules/tflite-micro/magic_wand/train/train_test.py" = [
@@ -199,13 +200,15 @@
199200
"F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders
200201
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
201202
"UP030", # https://docs.astral.sh/ruff/rules/format-literals
203+
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
202204
"UP032", # https://docs.astral.sh/ruff/rules/f-string
203205
]
204206
"./scripts/build/gen_isr_tables_parser_local.py" = [
205207
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
206208
"F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders
207209
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
208210
"UP030", # https://docs.astral.sh/ruff/rules/format-literals
211+
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
209212
"UP032", # https://docs.astral.sh/ruff/rules/f-string
210213
]
211214
"./scripts/build/gen_kobject_list.py" = [
@@ -254,6 +257,7 @@
254257
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
255258
"F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders
256259
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
260+
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
257261
]
258262
"./scripts/build/gen_syscalls.py" = [
259263
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
@@ -365,12 +369,14 @@
365369
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
366370
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
367371
"SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler
372+
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
368373
"UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses
369374
]
370375
"./scripts/coredump/coredump_parser/log_parser.py" = [
371376
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
372377
"SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler
373378
"UP030", # https://docs.astral.sh/ruff/rules/format-literals
379+
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
374380
"UP032", # https://docs.astral.sh/ruff/rules/f-string
375381
]
376382
"./scripts/coredump/coredump_serial_log_parser.py" = [
@@ -748,6 +754,8 @@
748754
]
749755
"./scripts/pylib/twister/expr_parser.py" = [
750756
"SIM103", # https://docs.astral.sh/ruff/rules/needless-bool
757+
"SIM110", # https://docs.astral.sh/ruff/rules/reimplemented-builtin
758+
"SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler
751759
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
752760
]
753761
"./scripts/pylib/twister/scl.py" = [
@@ -786,6 +794,7 @@
786794
"UP032", # https://docs.astral.sh/ruff/rules/f-string
787795
]
788796
"./scripts/release/list_devicetree_bindings_changes.py" = [
797+
"E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file
789798
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
790799
"SIM117", # https://docs.astral.sh/ruff/rules/multiple-with-statements
791800
"UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation
@@ -833,7 +842,6 @@
833842
]
834843
"./scripts/tests/twister/test_data/mixins/test_to_ignore.py" = [
835844
"B011", # https://docs.astral.sh/ruff/rules/assert-false
836-
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
837845
]
838846
"./scripts/tests/twister/test_environment.py" = [
839847
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
@@ -1259,7 +1267,6 @@
12591267
"UP032", # https://docs.astral.sh/ruff/rules/f-string
12601268
]
12611269
"./scripts/west_commands/zspdx/cmakecache.py" = [
1262-
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
12631270
"UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes
12641271
]
12651272
"./scripts/west_commands/zspdx/cmakefileapi.py" = [
@@ -1275,7 +1282,6 @@
12751282
"UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes
12761283
]
12771284
"./scripts/west_commands/zspdx/datatypes.py" = [
1278-
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
12791285
"UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters
12801286
]
12811287
"./scripts/west_commands/zspdx/getincludes.py" = [
@@ -1290,7 +1296,6 @@
12901296
"UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters
12911297
]
12921298
"./scripts/west_commands/zspdx/scanner.py" = [
1293-
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
12941299
"SIM113", # https://docs.astral.sh/ruff/rules/enumerate-for-loop
12951300
"UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters
12961301
"UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes
@@ -1336,14 +1341,6 @@
13361341
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
13371342
"UP009", # https://docs.astral.sh/ruff/rules/utf8-encoding-declaration
13381343
]
1339-
"./soc/mediatek/mtk_adsp/gen_img.py" = [
1340-
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
1341-
"SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler
1342-
]
1343-
"./soc/mediatek/mtk_adsp/mtk_adsp_load.py" = [
1344-
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
1345-
"SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler
1346-
]
13471344
"./soc/microchip/mec/common/spigen/mec_spi_gen.py" = [
13481345
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
13491346
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
@@ -1465,11 +1462,11 @@ exclude = [
14651462
"./doc/_extensions/zephyr/link-roles.py",
14661463
"./doc/_scripts/gen_boards_catalog.py",
14671464
"./doc/_scripts/gen_devicetree_rest.py",
1468-
"./doc/_scripts/gen_helpers.py",
14691465
"./doc/_scripts/redirects.py",
14701466
"./doc/conf.py",
14711467
"./doc/develop/test/twister/sample_blackbox_test.py",
14721468
"./modules/mbedtls/create_psa_files.py",
1469+
"./samples/boards/nordic/coresight_stm/pytest/test_stm.py",
14731470
"./samples/modules/tflite-micro/magic_wand/train/data_augmentation.py",
14741471
"./samples/modules/tflite-micro/magic_wand/train/data_augmentation_test.py",
14751472
"./samples/modules/tflite-micro/magic_wand/train/data_load.py",
@@ -1770,8 +1767,6 @@ exclude = [
17701767
"./soc/intel/intel_adsp/tools/cavstool_client.py",
17711768
"./soc/intel/intel_adsp/tools/remote-fw-service.py",
17721769
"./soc/intel/intel_ish/utils/build_ish_firmware.py",
1773-
"./soc/mediatek/mtk_adsp/gen_img.py",
1774-
"./soc/mediatek/mtk_adsp/mtk_adsp_load.py",
17751770
"./soc/microchip/mec/common/spigen/mec_spi_gen.py",
17761771
"./soc/nuvoton/npcm/common/esiost/esiost.py",
17771772
"./soc/nuvoton/npcm/common/esiost/esiost_args.py",

.ruff.toml

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ select = [
2222
ignore = [
2323
# zephyr-keep-sorted-start
2424
"SIM108", # Allow if-else blocks instead of forcing ternary operator
25-
"UP027", # deprecated pyupgrade rule
2625
# zephyr-keep-sorted-stop
2726
]
2827

scripts/requirements-compliance.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pykwalify
1010
pylint>=3
1111
python-magic
1212
python-magic-bin; sys_platform == "win32"
13-
ruff
13+
ruff==0.8.1
1414
sphinx-lint
1515
unidiff
1616
yamllint

0 commit comments

Comments
 (0)