Skip to content

Commit 77fbf6b

Browse files
resolve conversation
1 parent a270cd8 commit 77fbf6b

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

exasol/toolbox/nox/_format.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from collections.abc import Iterable
3+
from typing import Iterable
44

55
import nox
66
from nox import Session
@@ -27,7 +27,7 @@ def _pyupgrade(session: Session, files: Iterable[str]) -> None:
2727
"poetry",
2828
"run",
2929
"pyupgrade",
30-
"--py39-plus",
30+
"--py38-plus",
3131
"--exit-zero-even-if-changed",
3232
*files,
3333
)

exasol/toolbox/nox/_lint.py

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
import argparse
44
import sys
5-
from collections.abc import Iterable
65
from pathlib import Path
76
from typing import (
87
Dict,
8+
Iterable,
99
List,
1010
)
1111

@@ -160,3 +160,34 @@ def dependency_check(session: Session) -> None:
160160
if illegal := dependencies.illegal:
161161
report_illegal(illegal, console)
162162
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)

0 commit comments

Comments
 (0)