Skip to content

Commit

Permalink
resolve conversation
Browse files Browse the repository at this point in the history
  • Loading branch information
Jannis-Mittenzwei committed Nov 29, 2024
1 parent a270cd8 commit 77fbf6b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
4 changes: 2 additions & 2 deletions exasol/toolbox/nox/_format.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from collections.abc import Iterable
from typing import Iterable

import nox
from nox import Session
Expand All @@ -27,7 +27,7 @@ def _pyupgrade(session: Session, files: Iterable[str]) -> None:
"poetry",
"run",
"pyupgrade",
"--py39-plus",
"--py38-plus",
"--exit-zero-even-if-changed",
*files,
)
Expand Down
33 changes: 32 additions & 1 deletion exasol/toolbox/nox/_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import argparse
import sys
from collections.abc import Iterable
from pathlib import Path
from typing import (
Dict,
Iterable,
List,
)

Expand Down Expand Up @@ -160,3 +160,34 @@ def dependency_check(session: Session) -> None:
if illegal := dependencies.illegal:
report_illegal(illegal, console)
sys.exit(1)


@nox.session(name="lint:import", python=False)
def import_lint(session: Session) -> None:
"""(experimental) Runs import linter on the project"""
parser = argparse.ArgumentParser(
usage="nox -s import-lint -- [options]",
description="Runs the import linter on the project",
)
parser.add_argument(
"-c",
"--config",
type=str,
help="path to the configuration file for the importlinter",
metavar="TEXT",
)

args: argparse.Namespace = parser.parse_args(args=session.posargs)
file: str = args.config
path: Path | None = None
if file is None:
path = getattr(
PROJECT_CONFIG, "import_linter_config", Path(".import_linter_config")
)
else:
path = Path(file)
if not path.exists():
session.error(
"Please make sure you have a configuration file for the importlinter"
)
_import_lint(session=session, path=path)

0 comments on commit 77fbf6b

Please sign in to comment.