Skip to content

Commit 6395b09

Browse files
committed
chore(lint): Fix mypy static check issues
Signed-off-by: Helio Chissini de Castro <[email protected]>
1 parent d31eb36 commit 6395b09

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

src/orthw/commands/package_config/find.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from orthw.utils.required import require_initialized
2727

2828

29-
def find(package_id: str) -> int:
29+
def find(package_id: str) -> None:
3030
require_initialized()
3131

3232
ort_config_package_configurations_dir: Path = config.ort_config_package_configurations_dir

src/orthw/commands/scan.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from pathlib import Path
2020

2121
import click
22-
from docker.models.containers import Container
2322

2423
from orthw.utils import logging
2524
from orthw.utils.cmdgroups import command_group
@@ -31,7 +30,7 @@ def scan(
3130
output_dir: str | None = None,
3231
format_: str = "JSON",
3332
docker: bool = False,
34-
) -> int | Container:
33+
) -> int:
3534
"""Runs ORT Scanner on given source code directory to detect licenses and copyrights
3635
3736
Args:

src/orthw/orthw.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import pkgutil
2121
import sys
2222
from pathlib import Path
23+
from typing import Any
2324

2425
import click
2526

@@ -42,7 +43,7 @@ def __init__(self) -> None:
4243

4344
for module in pkgutil.iter_modules():
4445
if module.name.startswith("orthw") and hasattr(module.module_finder, "path"):
45-
path = Path(module.module_finder.path) / module.name / "commands"
46+
path = Path(module.module_finder.path) / module.name / "commands" # pyright: ignore
4647
self.module_import(path)
4748

4849
def module_import(self, path: Path) -> None:
@@ -76,7 +77,7 @@ def run(self) -> int:
7677
return 1
7778

7879
@property
79-
def commands(self) -> list[click.MultiCommand] | None:
80+
def commands(self) -> Any:
8081
"""Return the dynamic commands from plugins"""
8182
return command_group().commands()
8283

src/orthw/utils/process.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def run(
3434
workdir: Path | None = None,
3535
output_dir: Path | None = None,
3636
is_docker: bool = False,
37-
) -> int | Container:
37+
) -> int:
3838
"""Run a process with defined arguments in the proper setting for bare metal or docker
3939
4040
Args:
@@ -68,12 +68,15 @@ def run(
6868
sys.exit(1)
6969

7070
if is_docker:
71-
return _run_in_docker(
71+
container: Container = _run_in_docker(
7272
args,
7373
console_output=console_output,
7474
workdir=workdir,
7575
output_dir=output_dir,
7676
)
77+
result = container.wait() # Wait for the container to finish
78+
exit_code: int = result.get("StatusCode", 1) # Get the exit code, default to 1 on error
79+
return exit_code
7780
else:
7881
return __run_host(
7982
args,
@@ -100,7 +103,7 @@ def __run_host(
100103
workdir (Path | None, optional): Work directory.
101104
output_dir (Path | None, optional): Output dir is necessary to pass along.
102105
Returns:
103-
int: _description_
106+
int: Run status code
104107
"""
105108
if admin():
106109
logging.error("This script is not allowed to run as admin.")

0 commit comments

Comments
 (0)