scripts: Fix twisterlib for ruff - SIM202, SIM201
This fixes ruff linting error SIM201, where not is used instead of a more appropriate comparison operator. SIM202 exclusion was removed, as it didn't apply to anything. Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
This commit is contained in:
parent
f9c62afd26
commit
e8c54657e4
4 changed files with 4 additions and 10 deletions
|
@ -795,7 +795,6 @@
|
||||||
"SIM105", # https://docs.astral.sh/ruff/rules/suppressible-exception
|
"SIM105", # https://docs.astral.sh/ruff/rules/suppressible-exception
|
||||||
"SIM114", # https://docs.astral.sh/ruff/rules/if-with-same-arms
|
"SIM114", # https://docs.astral.sh/ruff/rules/if-with-same-arms
|
||||||
"SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler
|
"SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler
|
||||||
"SIM201", # https://docs.astral.sh/ruff/rules/negate-equal-op
|
|
||||||
"UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation
|
"UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation
|
||||||
"UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes
|
"UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes
|
||||||
"UP030", # https://docs.astral.sh/ruff/rules/format-literals
|
"UP030", # https://docs.astral.sh/ruff/rules/format-literals
|
||||||
|
@ -822,9 +821,6 @@
|
||||||
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
|
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
|
||||||
"UP032", # https://docs.astral.sh/ruff/rules/f-string
|
"UP032", # https://docs.astral.sh/ruff/rules/f-string
|
||||||
]
|
]
|
||||||
"./scripts/pylib/twister/twisterlib/jobserver.py" = [
|
|
||||||
"SIM201", # https://docs.astral.sh/ruff/rules/negate-equal-op
|
|
||||||
]
|
|
||||||
"./scripts/pylib/twister/twisterlib/mixins.py" = [
|
"./scripts/pylib/twister/twisterlib/mixins.py" = [
|
||||||
"UP004", # https://docs.astral.sh/ruff/rules/useless-object-inheritance
|
"UP004", # https://docs.astral.sh/ruff/rules/useless-object-inheritance
|
||||||
]
|
]
|
||||||
|
@ -856,7 +852,6 @@
|
||||||
"F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders
|
"F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders
|
||||||
"SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if
|
"SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if
|
||||||
"SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler
|
"SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler
|
||||||
"SIM201", # https://docs.astral.sh/ruff/rules/negate-equal-op
|
|
||||||
"UP004", # https://docs.astral.sh/ruff/rules/useless-object-inheritance
|
"UP004", # https://docs.astral.sh/ruff/rules/useless-object-inheritance
|
||||||
"UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation
|
"UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation
|
||||||
"UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes
|
"UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes
|
||||||
|
@ -890,7 +885,6 @@
|
||||||
"F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders
|
"F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders
|
||||||
"SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if
|
"SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if
|
||||||
"SIM110", # https://docs.astral.sh/ruff/rules/reimplemented-builtin
|
"SIM110", # https://docs.astral.sh/ruff/rules/reimplemented-builtin
|
||||||
"SIM202", # https://docs.astral.sh/ruff/rules/negate-not-equal-op
|
|
||||||
"UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes
|
"UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes
|
||||||
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
|
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
|
||||||
"UP032", # https://docs.astral.sh/ruff/rules/f-string
|
"UP032", # https://docs.astral.sh/ruff/rules/f-string
|
||||||
|
|
|
@ -116,7 +116,7 @@ class Handler:
|
||||||
logger.debug(f"Expected suite names:{expected_suite_names}")
|
logger.debug(f"Expected suite names:{expected_suite_names}")
|
||||||
logger.debug(f"Detected suite names:{detected_suite_names}")
|
logger.debug(f"Detected suite names:{detected_suite_names}")
|
||||||
if not expected_suite_names or \
|
if not expected_suite_names or \
|
||||||
not harness_status == TwisterStatus.PASS:
|
harness_status != TwisterStatus.PASS:
|
||||||
return
|
return
|
||||||
if not detected_suite_names:
|
if not detected_suite_names:
|
||||||
self._missing_suite_name(expected_suite_names, handler_time)
|
self._missing_suite_name(expected_suite_names, handler_time)
|
||||||
|
|
|
@ -150,14 +150,14 @@ class GNUMakeJobClient(JobClient):
|
||||||
# Use F_GETFL to see if file descriptors are valid
|
# Use F_GETFL to see if file descriptors are valid
|
||||||
if pipe:
|
if pipe:
|
||||||
rc = fcntl.fcntl(pipe[0], fcntl.F_GETFL)
|
rc = fcntl.fcntl(pipe[0], fcntl.F_GETFL)
|
||||||
if not rc & os.O_ACCMODE == os.O_RDONLY:
|
if rc & os.O_ACCMODE != os.O_RDONLY:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"FD %s is not readable (flags=%x); "
|
"FD %s is not readable (flags=%x); "
|
||||||
"ignoring GNU make jobserver", pipe[0], rc)
|
"ignoring GNU make jobserver", pipe[0], rc)
|
||||||
pipe = None
|
pipe = None
|
||||||
if pipe:
|
if pipe:
|
||||||
rc = fcntl.fcntl(pipe[1], fcntl.F_GETFL)
|
rc = fcntl.fcntl(pipe[1], fcntl.F_GETFL)
|
||||||
if not rc & os.O_ACCMODE == os.O_WRONLY:
|
if rc & os.O_ACCMODE != os.O_WRONLY:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"FD %s is not writable (flags=%x); "
|
"FD %s is not writable (flags=%x); "
|
||||||
"ignoring GNU make jobserver", pipe[1], rc)
|
"ignoring GNU make jobserver", pipe[1], rc)
|
||||||
|
|
|
@ -1730,7 +1730,7 @@ class TwisterRunner:
|
||||||
the static filter stats. So need to prepare them before pipline starts.
|
the static filter stats. So need to prepare them before pipline starts.
|
||||||
'''
|
'''
|
||||||
for instance in self.instances.values():
|
for instance in self.instances.values():
|
||||||
if instance.status == TwisterStatus.FILTER and not instance.reason == 'runtime filter':
|
if instance.status == TwisterStatus.FILTER and instance.reason != 'runtime filter':
|
||||||
self.results.filtered_static_increment()
|
self.results.filtered_static_increment()
|
||||||
self.results.filtered_configs_increment()
|
self.results.filtered_configs_increment()
|
||||||
self.results.filtered_cases_increment(len(instance.testsuite.testcases))
|
self.results.filtered_cases_increment(len(instance.testsuite.testcases))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue