scripts: Fix twisterlib for ruff - SIM110

This fixes ruff linting error SIM1101,
where a builtin, like any() or all()
has been reimplemented.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
This commit is contained in:
Lukasz Mrugala 2024-11-27 11:44:21 +00:00 committed by Carles Cufí
commit c8ac6c3add
3 changed files with 2 additions and 11 deletions

View file

@ -748,7 +748,6 @@
]
"./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
]
@ -832,7 +831,6 @@
"./scripts/pylib/twister/twisterlib/quarantine.py" = [
"B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
"SIM110", # https://docs.astral.sh/ruff/rules/reimplemented-builtin
"UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
]
@ -882,7 +880,6 @@
"F401", # https://docs.astral.sh/ruff/rules/unused-import
"F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders
"SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if
"SIM110", # https://docs.astral.sh/ruff/rules/reimplemented-builtin
"UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
"UP032", # https://docs.astral.sh/ruff/rules/f-string

View file

@ -137,7 +137,4 @@ class QuarantineData:
def _is_element_matched(element: str, list_of_elements: list[re.Pattern]) -> bool:
"""Return True if given element is matching to any of elements from the list"""
for pattern in list_of_elements:
if pattern.fullmatch(element):
return True
return False
return any(pattern.fullmatch(element) for pattern in list_of_elements)

View file

@ -726,10 +726,7 @@ class TestPlan:
return 1
def check_platform(self, platform, platform_list):
for p in platform_list:
if p in platform.aliases:
return True
return False
return any(p in platform.aliases for p in platform_list)
def apply_filters(self, **kwargs):