From dd91b4b53f450a9607a8137f244d36af6159c575 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 3 Jul 2026 19:42:57 +0000 Subject: [PATCH 1/3] ci: add configuration files for linters Add configuration files for linters used by Zephyr compliance checks. These files are duplicated from the Zephyr repo. Signed-off-by: Daniel DeGrasse --- .checkpatch.conf | 32 + .clang-format | 119 +++ .ruff-excludes.toml | 1138 +++++++++++++++++++++++++++ .ruff.toml | 30 + .yamllint | 16 + LICENSES/Apache-2.0.txt | 202 +++++ LICENSES/README.md | 10 + dts/bindings/vendor-prefixes.txt | 18 + scripts/undef_kconfig_allowlist.txt | 10 + 9 files changed, 1575 insertions(+) create mode 100644 .checkpatch.conf create mode 100644 .clang-format create mode 100644 .ruff-excludes.toml create mode 100644 .ruff.toml create mode 100644 .yamllint create mode 100644 LICENSES/Apache-2.0.txt create mode 100644 LICENSES/README.md create mode 100644 dts/bindings/vendor-prefixes.txt create mode 100644 scripts/undef_kconfig_allowlist.txt diff --git a/.checkpatch.conf b/.checkpatch.conf new file mode 100644 index 000000000..bee6eaedb --- /dev/null +++ b/.checkpatch.conf @@ -0,0 +1,32 @@ +--emacs +--summary-file +--show-types +--max-line-length=100 +--min-conf-desc-length=1 +--typedefsfile=scripts/checkpatch/typedefsfile + +--ignore PRINTK_WITHOUT_KERN_LEVEL +--ignore SPLIT_STRING +--ignore VOLATILE +--ignore CONFIG_EXPERIMENTAL +--ignore PREFER_KERNEL_TYPES +--ignore PREFER_SECTION +--ignore AVOID_EXTERNS +--ignore NETWORKING_BLOCK_COMMENT_STYLE +--ignore DATE_TIME +--ignore MINMAX +--ignore CONST_STRUCT +--ignore FILE_PATH_CHANGES +--ignore SPDX_LICENSE_TAG +--ignore C99_COMMENT_TOLERANCE +--ignore REPEATED_WORD +--ignore UNDOCUMENTED_DT_STRING +--ignore DT_SPLIT_BINDING_PATCH +--ignore DT_SCHEMA_BINDING_PATCH +--ignore TRAILING_SEMICOLON +--ignore COMPLEX_MACRO +--ignore MULTISTATEMENT_MACRO_USE_DO_WHILE +--ignore ENOSYS +--ignore IS_ENABLED_CONFIG +--ignore EXPORT_SYMBOL +--ignore COMPARISON_TO_NULL diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..b913146d9 --- /dev/null +++ b/.clang-format @@ -0,0 +1,119 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Note: The list of ForEachMacros can be obtained using: +# +# git grep -h '^#define [^[:space:]]*FOR_EACH[^[:space:]]*(' include/ \ +# | sed "s,^#define \([^[:space:]]*FOR_EACH[^[:space:]]*\)(.*$, - '\1'," \ +# | sort | uniq +# +# References: +# - https://clang.llvm.org/docs/ClangFormatStyleOptions.html + +--- +BasedOnStyle: LLVM +AlignConsecutiveMacros: AcrossComments +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortEnumsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AttributeMacros: + - __aligned + - __deprecated + - __packed + - __printf_like + - __syscall + - __syscall_always_inline + - __subsystem +BitFieldColonSpacing: After +BreakBeforeBraces: Linux +ColumnLimit: 100 +ConstructorInitializerIndentWidth: 8 +ContinuationIndentWidth: 8 +ForEachMacros: + - 'ARRAY_FOR_EACH' + - 'ARRAY_FOR_EACH_PTR' + - 'FOR_EACH' + - 'FOR_EACH_FIXED_ARG' + - 'FOR_EACH_IDX' + - 'FOR_EACH_IDX_FIXED_ARG' + - 'FOR_EACH_NONEMPTY_TERM' + - 'FOR_EACH_FIXED_ARG_NONEMPTY_TERM' + - 'RB_FOR_EACH' + - 'RB_FOR_EACH_CONTAINER' + - 'SYS_DLIST_FOR_EACH_CONTAINER' + - 'SYS_DLIST_FOR_EACH_CONTAINER_SAFE' + - 'SYS_DLIST_FOR_EACH_NODE' + - 'SYS_DLIST_FOR_EACH_NODE_SAFE' + - 'SYS_SEM_LOCK' + - 'SYS_SFLIST_FOR_EACH_CONTAINER' + - 'SYS_SFLIST_FOR_EACH_CONTAINER_SAFE' + - 'SYS_SFLIST_FOR_EACH_NODE' + - 'SYS_SFLIST_FOR_EACH_NODE_SAFE' + - 'SYS_SLIST_FOR_EACH_CONTAINER' + - 'SYS_SLIST_FOR_EACH_CONTAINER_SAFE' + - 'SYS_SLIST_FOR_EACH_NODE' + - 'SYS_SLIST_FOR_EACH_NODE_SAFE' + - '_WAIT_Q_FOR_EACH' + - '_WAIT_Q_FOR_EACH_SAFE' + - 'Z_FOR_EACH' + - 'Z_FOR_EACH_ENGINE' + - 'Z_FOR_EACH_EXEC' + - 'Z_FOR_EACH_FIXED_ARG' + - 'Z_FOR_EACH_FIXED_ARG_EXEC' + - 'Z_FOR_EACH_IDX' + - 'Z_FOR_EACH_IDX_EXEC' + - 'Z_FOR_EACH_IDX_FIXED_ARG' + - 'Z_FOR_EACH_IDX_FIXED_ARG_EXEC' + - 'Z_GENLIST_FOR_EACH_CONTAINER' + - 'Z_GENLIST_FOR_EACH_CONTAINER_SAFE' + - 'Z_GENLIST_FOR_EACH_NODE' + - 'Z_GENLIST_FOR_EACH_NODE_SAFE' + - 'STRUCT_SECTION_FOREACH' + - 'STRUCT_SECTION_FOREACH_ALTERNATE' + - 'TYPE_SECTION_FOREACH' + - 'K_SPINLOCK' + - 'COAP_RESOURCE_FOREACH' + - 'COAP_SERVICE_FOREACH' + - 'COAP_SERVICE_FOREACH_RESOURCE' + - 'HTTP_RESOURCE_FOREACH' + - 'HTTP_SERVER_CONTENT_TYPE_FOREACH' + - 'HTTP_SERVICE_FOREACH' + - 'HTTP_SERVICE_FOREACH_RESOURCE' + - 'I3C_BUS_FOR_EACH_I3CDEV' + - 'I3C_BUS_FOR_EACH_I3CDEV_SAFE' + - 'I3C_BUS_FOR_EACH_I2CDEV' + - 'I3C_BUS_FOR_EACH_I2CDEV_SAFE' + - 'MIN_HEAP_FOREACH' +IfMacros: + - 'CHECKIF' +# Disabled for now, see bug https://github.com/zephyrproject-rtos/zephyr/issues/48520 +#IncludeBlocks: Regroup +IncludeCategories: + - Regex: '^".*\.h"$' + Priority: 0 + - Regex: '^<(assert|complex|ctype|errno|fenv|float|inttypes|limits|locale|math|setjmp|signal|stdarg|stdbool|stddef|stdint|stdio|stdlib|string|tgmath|time|wchar|wctype)\.h>$' + Priority: 1 + - Regex: '^\$' + Priority: 2 + - Regex: '.*' + Priority: 3 +IndentCaseLabels: false +IndentGotoLabels: false +IndentWidth: 8 +InsertBraces: true +InsertNewlineAtEOF: true +SpaceBeforeInheritanceColon: False +SpaceBeforeParens: ControlStatementsExceptControlMacros +SortIncludes: Never +UseTab: ForContinuationAndIndentation +WhitespaceSensitiveMacros: + - COND_CODE_0 + - COND_CODE_1 + - IF_DISABLED + - IF_ENABLED + - LISTIFY + - STRINGIFY + - Z_STRINGIFY + - DT_FOREACH_PROP_ELEM_SEP diff --git a/.ruff-excludes.toml b/.ruff-excludes.toml new file mode 100644 index 000000000..3a8c076fa --- /dev/null +++ b/.ruff-excludes.toml @@ -0,0 +1,1138 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: Copyright The Zephyr Project Contributors + +# This list is generated, it contains all python scripts that existed before ruff was introduced, +# remove entries for files that pass CI compliance testing. + +[lint.per-file-ignores] +"./arch/x86/zefi/zefi.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./boards/microchip/mec172xevb_assy6906/support/mec172x_remote_flasher.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./doc/_scripts/redirects.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long +] +"./modules/mbedtls/create_psa_files.py" = [ + "E101", # https://docs.astral.sh/ruff/rules/mixed-spaces-and-tabs + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP032", # https://docs.astral.sh/ruff/rules/f-string + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./samples/modules/tflite-micro/magic_wand/train/data_augmentation.py" = [ + "B007", # https://docs.astral.sh/ruff/rules/unused-loop-control-variable + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import +] +"./samples/modules/tflite-micro/magic_wand/train/data_augmentation_test.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import +] +"./samples/modules/tflite-micro/magic_wand/train/data_load.py" = [ + "B007", # https://docs.astral.sh/ruff/rules/unused-loop-control-variable + "B020", # https://docs.astral.sh/ruff/rules/loop-variable-overrides-iterator + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP004", # https://docs.astral.sh/ruff/rules/useless-object-inheritance + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./samples/modules/tflite-micro/magic_wand/train/data_load_test.py" = [ + "B007", # https://docs.astral.sh/ruff/rules/unused-loop-control-variable + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import +] +"./samples/modules/tflite-micro/magic_wand/train/data_prepare.py" = [ + "B007", # https://docs.astral.sh/ruff/rules/unused-loop-control-variable + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP009", # https://docs.astral.sh/ruff/rules/utf8-encoding-declaration + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./samples/modules/tflite-micro/magic_wand/train/data_prepare_test.py" = [ + "B007", # https://docs.astral.sh/ruff/rules/unused-loop-control-variable + "F821", # https://docs.astral.sh/ruff/rules/undefined-name + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./samples/modules/tflite-micro/magic_wand/train/data_split.py" = [ + "B007", # https://docs.astral.sh/ruff/rules/unused-loop-control-variable + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP009", # https://docs.astral.sh/ruff/rules/utf8-encoding-declaration + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./samples/modules/tflite-micro/magic_wand/train/data_split_person.py" = [ + "B007", # https://docs.astral.sh/ruff/rules/unused-loop-control-variable + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP009", # https://docs.astral.sh/ruff/rules/utf8-encoding-declaration + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import +] +"./samples/modules/tflite-micro/magic_wand/train/data_split_person_test.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import +] +"./samples/modules/tflite-micro/magic_wand/train/data_split_test.py" = [ + "B007", # https://docs.astral.sh/ruff/rules/unused-loop-control-variable + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./samples/modules/tflite-micro/magic_wand/train/train.py" = [ + "B007", # https://docs.astral.sh/ruff/rules/unused-loop-control-variable + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM113", # https://docs.astral.sh/ruff/rules/enumerate-for-loop + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./samples/modules/tflite-micro/magic_wand/train/train_test.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import +] +"./samples/net/cellular_modem/server/te_udp_echo.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses +] +"./samples/net/cellular_modem/server/te_udp_receive.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses +] +"./samples/sensor/sensor_shell/pytest/test_sensor_shell.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long +] +"./samples/subsys/testsuite/pytest/basic/pytest/test_sample.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM112", # https://docs.astral.sh/ruff/rules/uncapitalized-environment-variables +] +"./scripts/build/gen_app_partitions.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long +] +"./scripts/ci/upload_test_results_es.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E713", # https://docs.astral.sh/ruff/rules/not-in-test + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/coredump/coredump_parser/elf_parser.py" = [ + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler +] +"./scripts/coredump/coredump_parser/log_parser.py" = [ + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler +] +"./scripts/coredump/coredump_serial_log_parser.py" = [ + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler +] +"./scripts/dts/gen_defines.py" = [ + "B007", # https://docs.astral.sh/ruff/rules/unused-loop-control-variable + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E741", # https://docs.astral.sh/ruff/rules/ambiguous-variable-name + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import + "UP045", # https://docs.astral.sh/ruff/rules/non-pep604-annotation-optional +] +"./scripts/dts/python-devicetree/src/devicetree/_private.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/dts/python-devicetree/src/devicetree/dtlib.py" = [ + "UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation-union + "UP045", # https://docs.astral.sh/ruff/rules/non-pep604-annotation-optional +] +"./scripts/dts/python-devicetree/src/devicetree/edtlib.py" = [ + "SIM905", # https://docs.astral.sh/ruff/rules/split-static-string + "UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation-union + "UP045", # https://docs.astral.sh/ruff/rules/non-pep604-annotation-optional +] +"./scripts/dts/python-devicetree/src/devicetree/grutils.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/dts/python-devicetree/tests/test_dtlib.py" = [ + "B011", # https://docs.astral.sh/ruff/rules/assert-false + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E101", # https://docs.astral.sh/ruff/rules/mixed-spaces-and-tabs + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP045", # https://docs.astral.sh/ruff/rules/non-pep604-annotation-optional +] +"./scripts/dts/python-devicetree/tests/test_edtlib.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E701", # https://docs.astral.sh/ruff/rules/multiple-statements-on-one-line-colon + "E731", # https://docs.astral.sh/ruff/rules/lambda-assignment + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM117", # https://docs.astral.sh/ruff/rules/multiple-with-statements +] +"./scripts/dump_bugs_pickle.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM110", # https://docs.astral.sh/ruff/rules/reimplemented-builtin + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/footprint/fpdiff.py" = [ + "B023", # https://docs.astral.sh/ruff/rules/function-uses-loop-variable + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/footprint/pack_as_twister.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM401", # https://docs.astral.sh/ruff/rules/if-else-block-instead-of-dict-get + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/footprint/track.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/footprint/upload_data.py" = [ + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM118", # https://docs.astral.sh/ruff/rules/in-dict-keys + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/gen_gcov_files.py" = [ + "SIM105", # https://docs.astral.sh/ruff/rules/suppressible-exception + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./scripts/generate_usb_vif/generate_vif.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM103", # https://docs.astral.sh/ruff/rules/needless-bool +] +"./scripts/get_maintainer.py" = [ + "B904", # https://docs.astral.sh/ruff/rules/raise-without-from-inside-except + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/github_helpers.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/gitlint/zephyr_commit_rules.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP030", # https://docs.astral.sh/ruff/rules/format-literals + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/kconfig/guiconfig.py" = [ + "B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F403", # https://docs.astral.sh/ruff/rules/undefined-local-with-import-star + "F405", # https://docs.astral.sh/ruff/rules/undefined-local-with-import-star-usage + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP024", # https://docs.astral.sh/ruff/rules/os-error-alias + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/kconfig/kconfigfunctions.py" = [ + "B011", # https://docs.astral.sh/ruff/rules/assert-false + "SIM114", # https://docs.astral.sh/ruff/rules/if-with-same-arms + "SIM118", # https://docs.astral.sh/ruff/rules/in-dict-keys + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/kconfig/kconfiglib.py" = [ + "B904", # https://docs.astral.sh/ruff/rules/raise-without-from-inside-except + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F841", # https://docs.astral.sh/ruff/rules/unused-variable + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "SIM105", # https://docs.astral.sh/ruff/rules/suppressible-exception + "SIM112", # https://docs.astral.sh/ruff/rules/uncapitalized-environment-variables + "UP004", # https://docs.astral.sh/ruff/rules/useless-object-inheritance + "UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters + "UP024", # https://docs.astral.sh/ruff/rules/os-error-alias + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/kconfig/lint.py" = [ + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/kconfig/menuconfig.py" = [ + "B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM105", # https://docs.astral.sh/ruff/rules/suppressible-exception + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import + "UP024", # https://docs.astral.sh/ruff/rules/os-error-alias + "UP032", # https://docs.astral.sh/ruff/rules/f-string + "UP036", # https://docs.astral.sh/ruff/rules/outdated-version-block +] +"./scripts/make_bugs_pickle.py" = [ + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/net/enumerate_http_status.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/profiling/stackcollapse.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP033", # https://docs.astral.sh/ruff/rules/lru-cache-with-maxsize-none +] +"./scripts/pylib/build_helpers/domains.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/pylib/pytest-twister-harness/src/twister_harness/device/factory.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/pylib/pytest-twister-harness/src/twister_harness/device/fifo_handler.py" = [ + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler +] +"./scripts/pylib/pytest-twister-harness/src/twister_harness/fixtures.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/pylib/pytest-twister-harness/src/twister_harness/helpers/domains_helper.py" = [ + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./scripts/pylib/pytest-twister-harness/src/twister_harness/helpers/shell.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E741", # https://docs.astral.sh/ruff/rules/ambiguous-variable-name + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if +] +"./scripts/pylib/pytest-twister-harness/src/twister_harness/helpers/utils.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./scripts/pylib/pytest-twister-harness/src/twister_harness/twister_harness_config.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/pylib/pytest-twister-harness/tests/conftest.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/pylib/pytest-twister-harness/tests/device/binary_adapter_test.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/pylib/pytest-twister-harness/tests/device/hardware_adapter_test.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/pylib/pytest-twister-harness/tests/device/qemu_adapter_test.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/pylib/pytest-twister-harness/tests/helpers/shell_test.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long +] +"./scripts/pylib/pytest-twister-harness/tests/resources/fifo_mock.py" = [ + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP012", # https://docs.astral.sh/ruff/rules/unnecessary-encode-utf8 +] +"./scripts/pylib/pytest-twister-harness/tests/resources/zen_of_python.py" = [ + "SIM905", # https://docs.astral.sh/ruff/rules/split-static-string +] +"./scripts/pylib/twister/expr_parser.py" = [ + "SIM103", # https://docs.astral.sh/ruff/rules/needless-bool + "SIM110", # https://docs.astral.sh/ruff/rules/reimplemented-builtin + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./scripts/pylib/twister/scl.py" = [ + "F401", # https://docs.astral.sh/ruff/rules/unused-import + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./scripts/pylib/twister/twisterlib/testplan.py" = [ + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "F401", # https://docs.astral.sh/ruff/rules/unused-import +] +"./scripts/pylint/checkers/argparse-checker.py" = [ + "F821", # https://docs.astral.sh/ruff/rules/undefined-name + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/release/bug_bash.py" = [ + "B010", # https://docs.astral.sh/ruff/rules/set-attr-with-constant + "B904", # https://docs.astral.sh/ruff/rules/raise-without-from-inside-except + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP004", # https://docs.astral.sh/ruff/rules/useless-object-inheritance + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP030", # https://docs.astral.sh/ruff/rules/format-literals + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/release/list_backports.py" = [ + "B009", # https://docs.astral.sh/ruff/rules/get-attr-with-constant + "B010", # https://docs.astral.sh/ruff/rules/set-attr-with-constant + "B904", # https://docs.astral.sh/ruff/rules/raise-without-from-inside-except + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP004", # https://docs.astral.sh/ruff/rules/useless-object-inheritance + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP030", # https://docs.astral.sh/ruff/rules/format-literals + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/release/list_devicetree_bindings_changes.py" = [ + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM117", # https://docs.astral.sh/ruff/rules/multiple-with-statements + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation-union + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import + "UP045", # https://docs.astral.sh/ruff/rules/non-pep604-annotation-optional +] +"./scripts/snippets.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/tests/twister/test_cmakecache.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders +] +"./scripts/tests/twister/test_config_parser.py" = [ + "B017", # https://docs.astral.sh/ruff/rules/assert-raises-exception + "B033", # https://docs.astral.sh/ruff/rules/duplicate-value + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "SIM117", # https://docs.astral.sh/ruff/rules/multiple-with-statements +] +"./scripts/tests/twister/test_data/mixins/test_to_ignore.py" = [ + "B011", # https://docs.astral.sh/ruff/rules/assert-false +] +"./scripts/tests/twister/test_environment.py" = [ + "SIM117", # https://docs.astral.sh/ruff/rules/multiple-with-statements +] +"./scripts/tests/twister/test_handlers.py" = [ + "B011", # https://docs.astral.sh/ruff/rules/assert-false + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "UP012", # https://docs.astral.sh/ruff/rules/unnecessary-encode-utf8 +] +"./scripts/tests/twister/test_hardwaremap.py" = [ + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./scripts/tests/twister/test_harness.py" = [ + "B017", # https://docs.astral.sh/ruff/rules/assert-raises-exception + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E713", # https://docs.astral.sh/ruff/rules/not-in-test + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/tests/twister/test_jobserver.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders +] +"./scripts/tests/twister/test_platform.py" = [ + "B011", # https://docs.astral.sh/ruff/rules/assert-false +] +"./scripts/tests/twister/test_runner.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/tests/twister/test_scl.py" = [ + "SIM117", # https://docs.astral.sh/ruff/rules/multiple-with-statements + "UP025", # https://docs.astral.sh/ruff/rules/unicode-kind-prefix +] +"./scripts/tests/twister/test_testinstance.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long +] +"./scripts/tests/twister/test_testplan.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E101", # https://docs.astral.sh/ruff/rules/mixed-spaces-and-tabs + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "SIM118", # https://docs.astral.sh/ruff/rules/in-dict-keys + "W191", # https://docs.astral.sh/ruff/rules/tab-indentation +] +"./scripts/tests/twister/test_testsuite.py" = [ + "B011", # https://docs.astral.sh/ruff/rules/assert-false +] +"./scripts/tests/twister/test_twister.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long +] +"./scripts/tests/twister_blackbox/conftest.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tests/twister_blackbox/test_addon.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tests/twister_blackbox/test_config.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tests/twister_blackbox/test_coverage.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/tests/twister_blackbox/test_data/tests/pytest/pytest/test_sample.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM112", # https://docs.astral.sh/ruff/rules/uncapitalized-environment-variables +] +"./scripts/tests/twister_blackbox/test_device.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/tests/twister_blackbox/test_disable.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tests/twister_blackbox/test_error.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E721", # https://docs.astral.sh/ruff/rules/type-comparison + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tests/twister_blackbox/test_filter.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tests/twister_blackbox/test_footprint.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tests/twister_blackbox/test_hardwaremap.py" = [ + "B007", # https://docs.astral.sh/ruff/rules/unused-loop-control-variable + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler +] +"./scripts/tests/twister_blackbox/test_outfile.py" = [ + "B011", # https://docs.astral.sh/ruff/rules/assert-false + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tests/twister_blackbox/test_output.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tests/twister_blackbox/test_platform.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tests/twister_blackbox/test_printouts.py" = [ + "B011", # https://docs.astral.sh/ruff/rules/assert-false + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tests/twister_blackbox/test_quarantine.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tests/twister_blackbox/test_report.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E701", # https://docs.astral.sh/ruff/rules/multiple-statements-on-one-line-colon + "E713", # https://docs.astral.sh/ruff/rules/not-in-test + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/tests/twister_blackbox/test_runner.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tests/twister_blackbox/test_shuffle.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tests/twister_blackbox/test_testlist.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tests/twister_blackbox/test_testplan.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tests/twister_blackbox/test_tooling.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tracing/parse_ctf.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tracing/trace_capture_uart.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP012", # https://docs.astral.sh/ruff/rules/unnecessary-encode-utf8 + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/tracing/trace_capture_usb.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/utils/board_v1_to_v2.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/utils/convert_guidelines.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/utils/gen_util_macros.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/utils/migrate_mcumgr_kconfigs.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/utils/ntc_thermistor_table.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/utils/pinctrl_nrf_migrate.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP004", # https://docs.astral.sh/ruff/rules/useless-object-inheritance + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import + "UP045", # https://docs.astral.sh/ruff/rules/non-pep604-annotation-optional +] +"./scripts/west_commands/fetchers/__init__.py" = [ + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/fetchers/core.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/west_commands/fetchers/http.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/run_common.py" = [ + "B904", # https://docs.astral.sh/ruff/rules/raise-without-from-inside-except + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E741", # https://docs.astral.sh/ruff/rules/ambiguous-variable-name + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "SIM114", # https://docs.astral.sh/ruff/rules/if-with-same-arms + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/sdk.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E713", # https://docs.astral.sh/ruff/rules/not-in-test + "E741", # https://docs.astral.sh/ruff/rules/ambiguous-variable-name + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "SIM300", # https://docs.astral.sh/ruff/rules/yoda-conditions + "UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters +] +"./scripts/west_commands/sign.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/tests/conftest.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/tests/test_blackmagicprobe.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/tests/test_bossac.py" = [ + "E101", # https://docs.astral.sh/ruff/rules/mixed-spaces-and-tabs + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM117", # https://docs.astral.sh/ruff/rules/multiple-with-statements + "W191", # https://docs.astral.sh/ruff/rules/tab-indentation +] +"./scripts/west_commands/tests/test_build.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/tests/test_canopen_program.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/tests/test_dediprog.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/tests/test_dfu_util.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/tests/test_gd32isp.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/tests/test_mdb.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/tests/test_nrf.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP045", # https://docs.astral.sh/ruff/rules/non-pep604-annotation-optional +] +"./scripts/west_commands/tests/test_nxp_s32dbg.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders +] +"./scripts/west_commands/tests/test_pyocd.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/tests/test_stm32cubeprogrammer.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/tests/test_stm32flash.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM117", # https://docs.astral.sh/ruff/rules/multiple-with-statements +] +"./scripts/west_commands/tests/test_xsdb.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/twister_cmd.py" = [ + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/zcmake.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "SIM114", # https://docs.astral.sh/ruff/rules/if-with-same-arms + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/zephyr_module.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./soc/intel/intel_adsp/tools/cavstool.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E701", # https://docs.astral.sh/ruff/rules/multiple-statements-on-one-line-colon + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./soc/intel/intel_adsp/tools/cavstool_client.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "SIM201", # https://docs.astral.sh/ruff/rules/negate-equal-op + "UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses +] +"./soc/intel/intel_adsp/tools/remote-fw-service.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP012", # https://docs.astral.sh/ruff/rules/unnecessary-encode-utf8 + "UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses +] +"./soc/intel/intel_ish/utils/build_ish_firmware.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP009", # https://docs.astral.sh/ruff/rules/utf8-encoding-declaration +] +"./soc/microchip/mec/common/spigen/mec_spi_gen.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP030", # https://docs.astral.sh/ruff/rules/format-literals + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./soc/nuvoton/npcm/common/esiost/esiost.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./soc/nuvoton/npcm/common/esiost/esiost_args.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./soc/nuvoton/npcx/common/ecst/ecst.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./soc/nuvoton/npcx/common/ecst/ecst_args.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM110", # https://docs.astral.sh/ruff/rules/reimplemented-builtin + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./soc/silabs/silabs_sim3/sim3u/gen_crossbar_config.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long +] +"./tests/boot/with_mcumgr/pytest/west_sign_wrapper.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./tests/kernel/timer/timer_behavior/pytest/saleae_logic2.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/kernel/timer/timer_behavior/pytest/test_timer.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./tests/lib/devicetree/memory_region_flags/pytest/test_memory_region_flags.py" = [ + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/misc/check_init_priorities/validate_check_init_priorities_output.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./tests/net/lib/lwm2m/interop/pytest/conftest.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/net/lib/lwm2m/interop/pytest/leshan.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/net/lib/lwm2m/interop/pytest/test_bootstrap.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM118", # https://docs.astral.sh/ruff/rules/in-dict-keys + "UP018", # https://docs.astral.sh/ruff/rules/native-literals +] +"./tests/net/lib/lwm2m/interop/pytest/test_nosec.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/net/lib/lwm2m/interop/pytest/test_portfolio.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM118", # https://docs.astral.sh/ruff/rules/in-dict-keys +] +"./tests/net/socket/tls_configurations/pytest/test_app_vs_openssl.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./tests/subsys/debug/gdbstub/pytest/test_gdbstub.py" = [ + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/ztest/ztest_param/pytest/test_parameters.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] + +[format] +exclude = [ + "./arch/x86/zefi/zefi.py", + "./boards/microchip/mec172xevb_assy6906/support/mec172x_remote_flasher.py", + "./doc/_scripts/gen_devicetree_rest.py", + "./doc/_scripts/redirects.py", + "./doc/conf.py", + "./doc/develop/test/twister/sample_blackbox_test.py", + "./modules/mbedtls/create_psa_files.py", + "./samples/boards/nordic/coresight_stm/pytest/test_stm.py", + "./samples/modules/tflite-micro/magic_wand/train/data_augmentation.py", + "./samples/modules/tflite-micro/magic_wand/train/data_augmentation_test.py", + "./samples/modules/tflite-micro/magic_wand/train/data_load.py", + "./samples/modules/tflite-micro/magic_wand/train/data_load_test.py", + "./samples/modules/tflite-micro/magic_wand/train/data_prepare.py", + "./samples/modules/tflite-micro/magic_wand/train/data_prepare_test.py", + "./samples/modules/tflite-micro/magic_wand/train/data_split.py", + "./samples/modules/tflite-micro/magic_wand/train/data_split_person.py", + "./samples/modules/tflite-micro/magic_wand/train/data_split_person_test.py", + "./samples/modules/tflite-micro/magic_wand/train/data_split_test.py", + "./samples/modules/tflite-micro/magic_wand/train/train.py", + "./samples/modules/tflite-micro/magic_wand/train/train_test.py", + "./samples/modules/thrift/hello/client/hello_client.py", + "./samples/net/cellular_modem/server/te_udp_echo.py", + "./samples/net/cellular_modem/server/te_udp_receive.py", + "./samples/net/cloud/aws_iot_mqtt/src/creds/convert_keys.py", + "./samples/sensor/sensor_shell/pytest/test_sensor_shell.py", + "./samples/subsys/profiling/perf/pytest/test_perf.py", + "./samples/subsys/testsuite/pytest/basic/pytest/conftest.py", + "./samples/subsys/testsuite/pytest/basic/pytest/test_sample.py", + "./samples/subsys/zbus/remote_mock/remote_mock.py", + "./scripts/check_maintainers.py", + "./scripts/ci/upload_test_results_es.py", + "./scripts/dts/gen_defines.py", + "./scripts/dts/gen_edt.py", + "./scripts/dts/python-devicetree/src/devicetree/_private.py", + "./scripts/dts/python-devicetree/src/devicetree/dtlib.py", + "./scripts/dts/python-devicetree/src/devicetree/edtlib.py", + "./scripts/dts/python-devicetree/src/devicetree/grutils.py", + "./scripts/dts/python-devicetree/tests/test_dtlib.py", + "./scripts/dts/python-devicetree/tests/test_edtlib.py", + "./scripts/dump_bugs_pickle.py", + "./scripts/footprint/fpdiff.py", + "./scripts/footprint/pack_as_twister.py", + "./scripts/footprint/track.py", + "./scripts/footprint/upload_data.py", + "./scripts/gen_gcov_files.py", + "./scripts/generate_usb_vif/constants/xml_constants.py", + "./scripts/generate_usb_vif/generate_vif.py", + "./scripts/get_maintainer.py", + "./scripts/github_helpers.py", + "./scripts/gitlint/zephyr_commit_rules.py", + "./scripts/kconfig/guiconfig.py", + "./scripts/kconfig/kconfig.py", + "./scripts/kconfig/kconfigfunctions.py", + "./scripts/kconfig/kconfiglib.py", + "./scripts/kconfig/lint.py", + "./scripts/kconfig/menuconfig.py", + "./scripts/list_boards.py", + "./scripts/list_hardware.py", + "./scripts/list_shields.py", + "./scripts/make_bugs_pickle.py", + "./scripts/net/enumerate_http_status.py", + "./scripts/profiling/stackcollapse.py", + "./scripts/pylib/build_helpers/domains.py", + "./scripts/pylib/pytest-twister-harness/src/twister_harness/fixtures.py", + "./scripts/pylib/pytest-twister-harness/src/twister_harness/helpers/mcumgr.py", + "./scripts/pylib/pytest-twister-harness/src/twister_harness/plugin.py", + "./scripts/pylib/pytest-twister-harness/src/twister_harness/twister_harness_config.py", + "./scripts/pylib/pytest-twister-harness/tests/conftest.py", + "./scripts/pylib/pytest-twister-harness/tests/device/binary_adapter_test.py", + "./scripts/pylib/pytest-twister-harness/tests/device/hardware_adapter_test.py", + "./scripts/pylib/pytest-twister-harness/tests/device/qemu_adapter_test.py", + "./scripts/pylib/pytest-twister-harness/tests/helpers/shell_test.py", + "./scripts/pylib/pytest-twister-harness/tests/plugin_test.py", + "./scripts/pylib/twister/expr_parser.py", + "./scripts/pylib/twister/scl.py", + "./scripts/pylib/twister/twisterlib/cmakecache.py", + "./scripts/pylib/twister/twisterlib/config_parser.py", + "./scripts/pylib/twister/twisterlib/coverage.py", + "./scripts/pylib/twister/twisterlib/environment.py", + "./scripts/pylib/twister/twisterlib/error.py", + "./scripts/pylib/twister/twisterlib/handlers.py", + "./scripts/pylib/twister/twisterlib/hardwaremap.py", + "./scripts/pylib/twister/twisterlib/harness.py", + "./scripts/pylib/twister/twisterlib/jobserver.py", + "./scripts/pylib/twister/twisterlib/log_helper.py", + "./scripts/pylib/twister/twisterlib/package.py", + "./scripts/pylib/twister/twisterlib/platform.py", + "./scripts/pylib/twister/twisterlib/quarantine.py", + "./scripts/pylib/twister/twisterlib/reports.py", + "./scripts/pylib/twister/twisterlib/runner.py", + "./scripts/pylib/twister/twisterlib/size_calc.py", + "./scripts/pylib/twister/twisterlib/statuses.py", + "./scripts/pylib/twister/twisterlib/testinstance.py", + "./scripts/pylib/twister/twisterlib/testplan.py", + "./scripts/pylib/twister/twisterlib/testsuite.py", + "./scripts/pylint/checkers/argparse-checker.py", + "./scripts/release/bug_bash.py", + "./scripts/release/list_backports.py", + "./scripts/release/list_devicetree_bindings_changes.py", + "./scripts/snippets.py", + "./scripts/tests/twister/conftest.py", + "./scripts/tests/twister/pytest_integration/test_harness_pytest.py", + "./scripts/tests/twister/test_cmakecache.py", + "./scripts/tests/twister/test_config_parser.py", + "./scripts/tests/twister/test_environment.py", + "./scripts/tests/twister/test_errors.py", + "./scripts/tests/twister/test_handlers.py", + "./scripts/tests/twister/test_hardwaremap.py", + "./scripts/tests/twister/test_harness.py", + "./scripts/tests/twister/test_jobserver.py", + "./scripts/tests/twister/test_log_helper.py", + "./scripts/tests/twister/test_platform.py", + "./scripts/tests/twister/test_quarantine.py", + "./scripts/tests/twister/test_runner.py", + "./scripts/tests/twister/test_scl.py", + "./scripts/tests/twister/test_testinstance.py", + "./scripts/tests/twister/test_testplan.py", + "./scripts/tests/twister/test_testsuite.py", + "./scripts/tests/twister/test_twister.py", + "./scripts/tests/twister_blackbox/conftest.py", + "./scripts/tests/twister_blackbox/test_addon.py", + "./scripts/tests/twister_blackbox/test_config.py", + "./scripts/tests/twister_blackbox/test_coverage.py", + "./scripts/tests/twister_blackbox/test_data/tests/pytest/pytest/conftest.py", + "./scripts/tests/twister_blackbox/test_data/tests/pytest/pytest/test_sample.py", + "./scripts/tests/twister_blackbox/test_device.py", + "./scripts/tests/twister_blackbox/test_disable.py", + "./scripts/tests/twister_blackbox/test_error.py", + "./scripts/tests/twister_blackbox/test_filter.py", + "./scripts/tests/twister_blackbox/test_footprint.py", + "./scripts/tests/twister_blackbox/test_hardwaremap.py", + "./scripts/tests/twister_blackbox/test_outfile.py", + "./scripts/tests/twister_blackbox/test_output.py", + "./scripts/tests/twister_blackbox/test_platform.py", + "./scripts/tests/twister_blackbox/test_printouts.py", + "./scripts/tests/twister_blackbox/test_quarantine.py", + "./scripts/tests/twister_blackbox/test_report.py", + "./scripts/tests/twister_blackbox/test_runner.py", + "./scripts/tests/twister_blackbox/test_shuffle.py", + "./scripts/tests/twister_blackbox/test_testlist.py", + "./scripts/tests/twister_blackbox/test_testplan.py", + "./scripts/tests/twister_blackbox/test_tooling.py", + "./scripts/tracing/parse_ctf.py", + "./scripts/tracing/trace_capture_uart.py", + "./scripts/tracing/trace_capture_usb.py", + "./scripts/utils/board_v1_to_v2.py", + "./scripts/utils/convert_guidelines.py", + "./scripts/utils/gen_util_macros.py", + "./scripts/utils/migrate_includes.py", + "./scripts/utils/migrate_mcumgr_kconfigs.py", + "./scripts/utils/migrate_posix_kconfigs.py", + "./scripts/utils/ntc_thermistor_table.py", + "./scripts/utils/pinctrl_nrf_migrate.py", + "./scripts/utils/twister_to_list.py", + "./scripts/west_commands/bindesc.py", + "./scripts/west_commands/boards.py", + "./scripts/west_commands/build.py", + "./scripts/west_commands/build_helpers.py", + "./scripts/west_commands/completion.py", + "./scripts/west_commands/debug.py", + "./scripts/west_commands/export.py", + "./scripts/west_commands/fetchers/__init__.py", + "./scripts/west_commands/fetchers/core.py", + "./scripts/west_commands/fetchers/http.py", + "./scripts/west_commands/flash.py", + "./scripts/west_commands/patch.py", + "./scripts/west_commands/robot.py", + "./scripts/west_commands/run_common.py", + "./scripts/west_commands/run_tests.py", + "./scripts/west_commands/runners/__init__.py", + "./scripts/west_commands/runners/blackmagicprobe.py", + "./scripts/west_commands/runners/bossac.py", + "./scripts/west_commands/runners/canopen_program.py", + "./scripts/west_commands/runners/core.py", + "./scripts/west_commands/runners/dediprog.py", + "./scripts/west_commands/runners/dfu.py", + "./scripts/west_commands/runners/esp32.py", + "./scripts/west_commands/runners/ezflashcli.py", + "./scripts/west_commands/runners/gd32isp.py", + "./scripts/west_commands/runners/hifive1.py", + "./scripts/west_commands/runners/intel_adsp.py", + "./scripts/west_commands/runners/intel_cyclonev.py", + "./scripts/west_commands/runners/jlink.py", + "./scripts/west_commands/runners/linkserver.py", + "./scripts/west_commands/runners/mdb.py", + "./scripts/west_commands/runners/misc.py", + "./scripts/west_commands/runners/native.py", + "./scripts/west_commands/runners/nrf_common.py", + "./scripts/west_commands/runners/nrfjprog.py", + "./scripts/west_commands/runners/nrfutil.py", + "./scripts/west_commands/runners/nsim.py", + "./scripts/west_commands/runners/nxp_s32dbg.py", + "./scripts/west_commands/runners/openocd.py", + "./scripts/west_commands/runners/probe_rs.py", + "./scripts/west_commands/runners/pyocd.py", + "./scripts/west_commands/runners/qemu.py", + "./scripts/west_commands/runners/renode-robot.py", + "./scripts/west_commands/runners/renode.py", + "./scripts/west_commands/runners/silabs_commander.py", + "./scripts/west_commands/runners/spi_burn.py", + "./scripts/west_commands/runners/stm32cubeprogrammer.py", + "./scripts/west_commands/runners/stm32flash.py", + "./scripts/west_commands/runners/teensy.py", + "./scripts/west_commands/runners/trace32.py", + "./scripts/west_commands/runners/uf2.py", + "./scripts/west_commands/runners/xsdb.py", + "./scripts/west_commands/runners/xtensa.py", + "./scripts/west_commands/sdk.py", + "./scripts/west_commands/shields.py", + "./scripts/west_commands/sign.py", + "./scripts/west_commands/simulate.py", + "./scripts/west_commands/spdx.py", + "./scripts/west_commands/tests/conftest.py", + "./scripts/west_commands/tests/test_blackmagicprobe.py", + "./scripts/west_commands/tests/test_bossac.py", + "./scripts/west_commands/tests/test_build.py", + "./scripts/west_commands/tests/test_canopen_program.py", + "./scripts/west_commands/tests/test_dediprog.py", + "./scripts/west_commands/tests/test_dfu_util.py", + "./scripts/west_commands/tests/test_gd32isp.py", + "./scripts/west_commands/tests/test_imports.py", + "./scripts/west_commands/tests/test_mdb.py", + "./scripts/west_commands/tests/test_nrf.py", + "./scripts/west_commands/tests/test_nxp_s32dbg.py", + "./scripts/west_commands/tests/test_pyocd.py", + "./scripts/west_commands/tests/test_stm32cubeprogrammer.py", + "./scripts/west_commands/tests/test_stm32flash.py", + "./scripts/west_commands/tests/test_twister.py", + "./scripts/west_commands/twister_cmd.py", + "./scripts/west_commands/zcmake.py", + "./scripts/west_commands/zephyr_ext_common.py", + "./scripts/west_commands/zspdx/cmakefileapi.py", + "./scripts/west_commands/zspdx/cmakefileapijson.py", + "./scripts/west_commands/zspdx/licenses.py", + "./scripts/west_commands/zspdx/walker.py", + "./scripts/west_commands/zspdx/writer.py", + "./scripts/zephyr_module.py", + "./soc/aspeed/ast10x0/tools/gen_uart_booting_image.py", + "./soc/intel/intel_adsp/tools/cavstool.py", + "./soc/intel/intel_adsp/tools/cavstool_client.py", + "./soc/intel/intel_adsp/tools/remote-fw-service.py", + "./soc/intel/intel_ish/utils/build_ish_firmware.py", + "./soc/microchip/mec/common/spigen/mec_spi_gen.py", + "./soc/nuvoton/npcm/common/esiost/esiost.py", + "./soc/nuvoton/npcm/common/esiost/esiost_args.py", + "./soc/nuvoton/npcx/common/ecst/ecst.py", + "./soc/nuvoton/npcx/common/ecst/ecst_args.py", + "./soc/silabs/silabs_sim3/sim3u/gen_crossbar_config.py", + "./tests/bluetooth/classic/gap_s/pytest/test_gap_s.py", + "./tests/bluetooth/classic/sdp_s/pytest/test_sdp.py", + "./tests/boot/with_mcumgr/pytest/test_downgrade_prevention.py", + "./tests/boot/with_mcumgr/pytest/test_upgrade.py", + "./tests/boot/with_mcumgr/pytest/west_sign_wrapper.py", + "./tests/kernel/timer/timer_behavior/pytest/saleae_logic2.py", + "./tests/kernel/timer/timer_behavior/pytest/test_timer.py", + "./tests/lib/devicetree/memory_region_flags/pytest/test_memory_region_flags.py", + "./tests/misc/check_init_priorities/validate_check_init_priorities_output.py", + "./tests/net/lib/lwm2m/interop/pytest/conftest.py", + "./tests/net/lib/lwm2m/interop/pytest/leshan.py", + "./tests/net/lib/lwm2m/interop/pytest/test_blockwise.py", + "./tests/net/lib/lwm2m/interop/pytest/test_bootstrap.py", + "./tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py", + "./tests/net/lib/lwm2m/interop/pytest/test_nosec.py", + "./tests/net/lib/lwm2m/interop/pytest/test_portfolio.py", + "./tests/net/socket/tls_configurations/pytest/test_app_vs_openssl.py", + "./tests/net/socket/udp/generate-c-string.py", + "./tests/subsys/debug/gdbstub/pytest/test_gdbstub.py", + "./tests/ztest/ztest_param/pytest/test_parameters.py", +] diff --git a/.ruff.toml b/.ruff.toml new file mode 100644 index 000000000..5858ae9e8 --- /dev/null +++ b/.ruff.toml @@ -0,0 +1,30 @@ +# Copyright (c) 2024 Basalte bv +# SPDX-License-Identifier: Apache-2.0 + +extend = ".ruff-excludes.toml" + +line-length = 100 +target-version = "py312" + +[lint] +select = [ + # zephyr-keep-sorted-start + "B", # flake8-bugbear + "E", # pycodestyle + "F", # pyflakes + "I", # isort + "SIM", # flake8-simplify + "UP", # pyupgrade + "W", # pycodestyle warnings + # zephyr-keep-sorted-stop +] + +ignore = [ + # zephyr-keep-sorted-start + "SIM108", # Allow if-else blocks instead of forcing ternary operator + # zephyr-keep-sorted-stop +] + +[format] +quote-style = "preserve" +line-ending = "lf" diff --git a/.yamllint b/.yamllint new file mode 100644 index 000000000..73bafc2cb --- /dev/null +++ b/.yamllint @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: Apache-2.0 + +extends: default + +rules: + line-length: + max: 100 + comments: + min-spaces-from-content: 1 + indentation: + spaces: 2 + indent-sequences: consistent + document-start: + present: false + truthy: + check-keys: false diff --git a/LICENSES/Apache-2.0.txt b/LICENSES/Apache-2.0.txt new file mode 100644 index 000000000..7a4a3ea24 --- /dev/null +++ b/LICENSES/Apache-2.0.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/LICENSES/README.md b/LICENSES/README.md new file mode 100644 index 000000000..cec213426 --- /dev/null +++ b/LICENSES/README.md @@ -0,0 +1,10 @@ +> [!IMPORTANT] +> The license files in this directory are maintained as per the recommendation +> of the REUSE specification (https://reuse.software/spec-3.3). +> These are licenses that may apply to some components hosted in the source tree +> but that do not end up in built binaries +> (see https://docs.zephyrproject.org/latest/LICENSING.html#zephyr-licensing). +> +> These files do _not_ define the license of the Zephyr project itself. +> Zephyr is licensed under the Apache 2.0 license, as specified in +> the [LICENSE](/LICENSE) file at the root of the repository. diff --git a/dts/bindings/vendor-prefixes.txt b/dts/bindings/vendor-prefixes.txt new file mode 100644 index 000000000..4a315fe5e --- /dev/null +++ b/dts/bindings/vendor-prefixes.txt @@ -0,0 +1,18 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 Analog Devices +# SPDX-License-Identifier: Apache-2.0 +# +# Device tree binding vendor prefix registry. Keep this list in +# alphabetical order. +# +# This isn't an exhaustive list, but you should add new prefixes to it +# before using them to avoid name-space collisions. +# +# The contents of this file are parsed during documentation generation. +# Anything that starts with a '#' is treated as a comment and ignored. +# Non-empty lines should be in this format: +# +# + +# zephyr-keep-sorted-start +vendor Custom Vendor +# zephyr-keep-sorted-stop diff --git a/scripts/undef_kconfig_allowlist.txt b/scripts/undef_kconfig_allowlist.txt new file mode 100644 index 000000000..92d622ff1 --- /dev/null +++ b/scripts/undef_kconfig_allowlist.txt @@ -0,0 +1,10 @@ +# List of additional Kconfigs in this repo that +# should not be flagged as undefined Kconfigs by +# the CI checks +BLINK +BLINK_GPIO_LED +BLINK_INIT_PRIORITY +BLINK_LOG_LEVEL +CUSTOM +CUSTOM_GET_VALUE_DEFAULT +EXAMPLE_SENSOR From 03d5bd60bf11814f603e113622b14051f3bf3bae Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 3 Jul 2026 19:55:21 +0000 Subject: [PATCH 2/3] scripts: format example_west_command to follow ruff guidelines Format example_west_command to comply with ruff CI checks Signed-off-by: Daniel DeGrasse --- scripts/example_west_command.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/example_west_command.py b/scripts/example_west_command.py index b64cc7182..f0e426c31 100644 --- a/scripts/example_west_command.py +++ b/scripts/example_west_command.py @@ -8,11 +8,11 @@ from west.commands import WestCommand # your extension must subclass this -class ExampleWestCommand(WestCommand): +class ExampleWestCommand(WestCommand): def __init__(self): super().__init__( - 'example-west-command', # gets stored as self.name + 'example-west-command', # gets stored as self.name 'an example west extension command', # self.help # self.description: '''\ @@ -22,21 +22,20 @@ def __init__(self): reflowed for you. You can also pass formatter_class=argparse.RawDescriptionHelpFormatter when calling parser_adder.add_parser() below if you want to keep your line -endings.''') +endings.''', + ) def do_add_parser(self, parser_adder): # This is a bit of boilerplate, which allows you full control over the # type of argparse handling you want. The "parser_adder" argument is # the return value of an argparse.ArgumentParser.add_subparsers() call. - parser = parser_adder.add_parser(self.name, - help=self.help, - description=self.description) + parser = parser_adder.add_parser(self.name, help=self.help, description=self.description) # Add some example options using the standard argparse module API. parser.add_argument('-o', '--optional', help='an optional argument') parser.add_argument('required', help='a required argument') - return parser # gets stored as self.parser + return parser # gets stored as self.parser def do_run(self, args, unknown_args): # This gets called when the user runs the command, e.g.: From 872fa10d12953e3c395bf6f0843341ab463cc446 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 3 Jul 2026 19:24:26 +0000 Subject: [PATCH 3/3] ci: add support for running out of tree compliance checks Add support for running compliance checks on code contributed to the example repository, as a demonstration for how to implement custom compliance checks on top of those Zephyr provides Signed-off-by: Daniel DeGrasse --- .github/workflows/compliance.yml | 119 +++++++++++++++++++++++++++++++ scripts/repo_compliance.py | 40 +++++++++++ 2 files changed, 159 insertions(+) create mode 100644 .github/workflows/compliance.yml create mode 100755 scripts/repo_compliance.py diff --git a/.github/workflows/compliance.yml b/.github/workflows/compliance.yml new file mode 100644 index 000000000..098e9d6e1 --- /dev/null +++ b/.github/workflows/compliance.yml @@ -0,0 +1,119 @@ +name: Compliance Checks + +on: pull_request + +permissions: + contents: read + +jobs: + check_compliance: + runs-on: ubuntu-24.04 + name: Run compliance checks on patch series (PR) + steps: + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.12 + + - name: Checkout the code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + path: example-application + fetch-depth: 0 + + - name: Rebase onto the target branch + working-directory: example-application + env: + BASE_REF: ${{ github.base_ref }} + run: | + git config --global user.email "you@example.com" + git config --global user.name "Your Name" + git config --global --add safe.directory $PWD + git remote -v + # Ensure there's no merge commits in the PR + [[ "$(git rev-list --merges --count origin/${BASE_REF}..)" == "0" ]] || \ + (echo "::error ::Merge commits not allowed, rebase instead";false) + rm -fr ".git/rebase-apply" + rm -fr ".git/rebase-merge" + git rebase origin/${BASE_REF} + git clean -f -d + # debug + git log --pretty=oneline | head -n 10 + + - name: Install west + shell: bash + run: | + if ! command -v west &> /dev/null; then + echo "west could not be found, installing..." + python -m pip install west==1.5.0 + fi + + - name: Initialize west workspace + shell: bash + run: | + west init -l example-application + + - name: Update west workspace + shell: bash + run: | + west update -o=--depth=1 -n + + - name: Install Python dependencies + shell: bash + run: | + pip install -r zephyr/scripts/requirements-compliance.txt + + - name: Run Compliance Tests + continue-on-error: true + id: compliance + working-directory: example-application + env: + BASE_REF: ${{ github.base_ref }} + UNDEF_KCONFIG_OUTSIDE_ALLOWLIST_FILE: + ${{ github.workspace }}/example-application/scripts/undef_kconfig_allowlist.txt + run: | + export ZEPHYR_BASE=$PWD/../zephyr + # debug + ls -la + git log --pretty=oneline | head -n 10 + ./scripts/repo_compliance.py --annotate -e SysbuildKconfig \ + -c origin/${BASE_REF}.. + + - name: upload-results + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 + continue-on-error: true + with: + name: compliance.xml + path: example-application/compliance.xml + + - name: check-warns + shell: bash + working-directory: example-application + run: | + if [[ ! -s "compliance.xml" ]]; then + exit 1; + fi + + warns=("ClangFormat" "LicenseAndCopyrightCheck") + files=($(./scripts/repo_compliance.py -l)) + + for file in "${files[@]}"; do + f="${file}.txt" + if [[ -s $f ]]; then + results=$(cat $f) + results="${results//'%'/'%25'}" + results="${results//$'\n'/'%0A'}" + results="${results//$'\r'/'%0D'}" + if [[ "${warns[@]}" =~ "${file}" ]]; then + echo "::warning file=${f}::$results" + else + echo "::error file=${f}::$results" + exit=1 + fi + fi + done + + if [ "${exit}" == "1" ]; then + exit 1; + fi diff --git a/scripts/repo_compliance.py b/scripts/repo_compliance.py new file mode 100755 index 000000000..5c57e12a2 --- /dev/null +++ b/scripts/repo_compliance.py @@ -0,0 +1,40 @@ +#!/bin/env python3 +# Copyright (c) 2026 Analog Devices, Inc. +# SPDX-License-Identifier: Apache-2.0 + +# This script runs compliance checks on the repository for coding standards. +# It imports logic from Zephyr's own check_compliance.py script, but overrides +# checks that are specific to Zephyr's own repository structure + +import os +import sys +from pathlib import Path + +ZEPHYR_BASE = os.environ.get("ZEPHYR_BASE", str(Path(__file__).resolve().parents[2] / "zephyr")) +sys.path.insert(0, str(Path(ZEPHYR_BASE) / "scripts" / "ci")) + +import check_compliance # noqa: E402 + + +class SampleCheck(check_compliance.ComplianceTest): + """ + Example of a custom compliance check that can be added to the CI checks run in this repo. + This check simply passes when run, unless a file in the root of the repo + called "fail.txt" exists. If present, the check will fail and print a message to the console. + """ + + name = "SampleCheck" + doc = "Sample check that fails if fail.txt exists in the root of the repo" + + def run(self): + """ + Run the sample check. + """ + fail_file = Path(check_compliance.GIT_TOP) / "fail.txt" + if fail_file.exists(): + self.failure("SampleCheck failed because fail.txt exists in the root of the repo.") + return False + + +# Run compliance checks using Zephyr's check_compliance.py script +check_compliance.main(sys.argv[1:])