scripts: Fix twisterlib for ruff - UP021, UP022
This fixes ruff linting errors UP021 and UP022, where obsolete subprocess parameters were still used. Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
This commit is contained in:
parent
52cd7d673f
commit
fbde9f1b1a
4 changed files with 21 additions and 15 deletions
|
@ -775,14 +775,12 @@
|
|||
"F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders
|
||||
"SIM105", # https://docs.astral.sh/ruff/rules/suppressible-exception
|
||||
"UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes
|
||||
"UP022", # https://docs.astral.sh/ruff/rules/replace-stdout-stderr
|
||||
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
|
||||
"UP032", # https://docs.astral.sh/ruff/rules/f-string
|
||||
]
|
||||
"./scripts/pylib/twister/twisterlib/environment.py" = [
|
||||
"B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default
|
||||
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
|
||||
"UP021", # https://docs.astral.sh/ruff/rules/replace-universal-newlines
|
||||
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
|
||||
]
|
||||
"./scripts/pylib/twister/twisterlib/handlers.py" = [
|
||||
|
@ -842,7 +840,6 @@
|
|||
"SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if
|
||||
"SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler
|
||||
"UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes
|
||||
"UP022", # https://docs.astral.sh/ruff/rules/replace-stdout-stderr
|
||||
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
|
||||
"UP032", # https://docs.astral.sh/ruff/rules/f-string
|
||||
]
|
||||
|
|
|
@ -182,10 +182,12 @@ class Lcov(CoverageTool):
|
|||
|
||||
def get_version(self):
|
||||
try:
|
||||
result = subprocess.run(['lcov', '--version'],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
text=True, check=True)
|
||||
result = subprocess.run(
|
||||
['lcov', '--version'],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=True
|
||||
)
|
||||
version_output = result.stdout.strip().replace('lcov: LCOV version ', '')
|
||||
return version_output
|
||||
except subprocess.CalledProcessError as e:
|
||||
|
@ -293,10 +295,12 @@ class Gcovr(CoverageTool):
|
|||
|
||||
def get_version(self):
|
||||
try:
|
||||
result = subprocess.run(['gcovr', '--version'],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
text=True, check=True)
|
||||
result = subprocess.run(
|
||||
['gcovr', '--version'],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=True
|
||||
)
|
||||
version_lines = result.stdout.strip().split('\n')
|
||||
if version_lines:
|
||||
version_output = version_lines[0].replace('gcovr ', '')
|
||||
|
|
|
@ -1036,7 +1036,7 @@ class TwisterEnv:
|
|||
try:
|
||||
subproc = subprocess.run(["git", "describe", "--abbrev=12", "--always"],
|
||||
stdout=subprocess.PIPE,
|
||||
universal_newlines=True,
|
||||
text=True,
|
||||
cwd=ZEPHYR_BASE)
|
||||
if subproc.returncode == 0:
|
||||
_version = subproc.stdout.strip()
|
||||
|
@ -1052,7 +1052,7 @@ class TwisterEnv:
|
|||
try:
|
||||
subproc = subprocess.run(["git", "show", "-s", "--format=%cI", "HEAD"],
|
||||
stdout=subprocess.PIPE,
|
||||
universal_newlines=True,
|
||||
text=True,
|
||||
cwd=ZEPHYR_BASE)
|
||||
if subproc.returncode == 0:
|
||||
self.commit_date = subproc.stdout.strip()
|
||||
|
|
|
@ -1093,8 +1093,13 @@ class ProjectBuilder(FilterBuilder):
|
|||
def demangle(self, symbol_name):
|
||||
if symbol_name[:2] == '_Z':
|
||||
try:
|
||||
cpp_filt = subprocess.run('c++filt', input=symbol_name, text=True, check=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
cpp_filt = subprocess.run(
|
||||
'c++filt',
|
||||
input=symbol_name,
|
||||
text=True,
|
||||
check=True,
|
||||
capture_output=True
|
||||
)
|
||||
if self.trace:
|
||||
logger.debug(f"Demangle: '{symbol_name}'==>'{cpp_filt.stdout}'")
|
||||
return cpp_filt.stdout.strip()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue