Skip to content

Commit

Permalink
Use isort in the format and lint sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
barisione committed Aug 13, 2022
1 parent 184c9b7 commit 5df1a80
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def tests(session):
)
)

ISORT_OPTIONS = ["--profile", "black", "--lines-after-imports", "2"]


# `format` is a builtin so the function is named differently.
@nox.session(name="format")
Expand All @@ -37,13 +39,15 @@ def format_(session):
# Only use positional arguments which are linted files.
files = files & {str(Path(f).resolve()) for f in session.posargs}

session.install("black", "flake8", "mypy", "check-manifest")
session.install("isort", "black", "flake8", "mypy", "check-manifest")
session.run("isort", *ISORT_OPTIONS, *files)
session.run("black", *files)


@nox.session()
def lint(session):
session.install(*["black", "flake8", "mypy", "check-manifest"])
session.install("isort", "black", "flake8", "mypy", "check-manifest")
session.run("isort", "--check-only", *ISORT_OPTIONS, *LINTED_PATHS)
session.run("black", "--check", *LINTED_PATHS)
session.run("flake8", *LINTED_PATHS)
session.run("mypy", *LINTED_PATHS)
Expand Down

0 comments on commit 5df1a80

Please sign in to comment.