Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions doc/changes/unreleased.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Unreleased

## ✨ Added
## ✨ Features

* [#73](https://github.com/exasol/python-toolbox/issues/73): Added nox target for auditing work spaces in regard to known vulnerabilities
* [#65](https://github.com/exasol/python-toolbox/issues/65): Added a Nox task for checking if the changelog got updated.
* [#65](https://github.com/exasol/python-toolbox/issues/65): Added a Nox task for checking if the changelog got updated.
* [#369](https://github.com/exasol/python-toolbox/issues/369): Removed option `-v` for `isort`
21 changes: 15 additions & 6 deletions exasol/toolbox/nox/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@


def _code_format(session: Session, mode: Mode, files: Iterable[str]) -> None:
isort = ["poetry", "run", "isort", "-v"]
black = ["poetry", "run", "black"]
isort = isort if mode == Mode.Fix else isort + ["--check"]
black = black if mode == Mode.Fix else black + ["--check"]
session.run(*isort, *files)
session.run(*black, *files)
def command(*args: str) -> list[str]:
return args if mode == Mode.Fix else list(args) + ["--check"]

session.run(*command("poetry", "run", "isort"), *files)
session.run(*command("poetry", "run", "black"), *files)


def _pyupgrade(session: Session, files: Iterable[str]) -> None:
Expand Down Expand Up @@ -47,3 +46,13 @@ def fmt_check(session: Session) -> None:
"""Checks the project for correct formatting"""
py_files = [f"{file}" for file in python_files(PROJECT_CONFIG.root)]
_code_format(session=session, mode=Mode.Check, files=py_files)


class XSession:
def run(self, *args):
print(f"session.run(args: {args})")


if __name__ == "__main__":
session = XSession()
_code_format(session, Mode.Fix, [])
Loading