Skip to content

Commit c9a63f2

Browse files
resolve conversation
1 parent 62e98ce commit c9a63f2

File tree

2 files changed

+218
-211
lines changed

2 files changed

+218
-211
lines changed

exasol/toolbox/nox/_lint.py

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def find_illegal(part) -> list[str]:
9595
if _source_filter(version)
9696
]
9797

98-
illegal: dict[str, list[str]] = {}
98+
illegal: Dict[str, List[str]] = {}
9999
toml = tomlkit.loads(pyproject_toml)
100100
poetry = toml.get("tool", {}).get("poetry", {})
101101

@@ -115,11 +115,11 @@ def find_illegal(part) -> list[str]:
115115
return Dependencies(illegal)
116116

117117
@property
118-
def illegal(self) -> dict[str, list[str]]:
118+
def illegal(self) -> Dict[str, List[str]]:
119119
return self._illegal
120120

121121

122-
def report_illegal(illegal: dict[str, list[str]], console: rich.console.Console):
122+
def report_illegal(illegal: Dict[str, List[str]], console: rich.console.Console):
123123
count = sum(len(deps) for deps in illegal.values())
124124
suffix = "y" if count == 1 else "ies"
125125
console.print(f"{count} illegal dependenc{suffix}\n", style="red")
@@ -148,7 +148,7 @@ def type_check(session: Session) -> None:
148148
def security_lint(session: Session) -> None:
149149
"""Runs the security linter on the project"""
150150
py_files = [f"{file}" for file in python_files(PROJECT_CONFIG.root)]
151-
_security_lint(session, py_files)
151+
_security_lint(session, list(filter(lambda file: "test" not in file, py_files)))
152152

153153

154154
@nox.session(name="lint:dependencies", python=False)
@@ -159,35 +159,4 @@ def dependency_check(session: Session) -> None:
159159
console = rich.console.Console()
160160
if illegal := dependencies.illegal:
161161
report_illegal(illegal, console)
162-
sys.exit(1)
163-
164-
165-
@nox.session(name="lint:import", python=False)
166-
def import_lint(session: Session) -> None:
167-
"""(experimental) Runs import linter on the project"""
168-
parser = argparse.ArgumentParser(
169-
usage="nox -s import-lint -- [options]",
170-
description="Runs the import linter on the project",
171-
)
172-
parser.add_argument(
173-
"-c",
174-
"--config",
175-
type=str,
176-
help="path to the configuration file for the importlinter",
177-
metavar="TEXT",
178-
)
179-
180-
args: argparse.Namespace = parser.parse_args(args=session.posargs)
181-
file: str = args.config
182-
path: Path | None = None
183-
if file is None:
184-
path = getattr(
185-
PROJECT_CONFIG, "import_linter_config", Path(".import_linter_config")
186-
)
187-
else:
188-
path = Path(file)
189-
if not path.exists():
190-
session.error(
191-
"Please make sure you have a configuration file for the importlinter"
192-
)
193-
_import_lint(session=session, path=path)
162+
sys.exit(1)

0 commit comments

Comments
 (0)