Skip to content

Commit 5df1a80

Browse files
committed
Use isort in the format and lint sessions
1 parent 184c9b7 commit 5df1a80

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

noxfile.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ def tests(session):
2626
)
2727
)
2828

29+
ISORT_OPTIONS = ["--profile", "black", "--lines-after-imports", "2"]
30+
2931

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

40-
session.install("black", "flake8", "mypy", "check-manifest")
42+
session.install("isort", "black", "flake8", "mypy", "check-manifest")
43+
session.run("isort", *ISORT_OPTIONS, *files)
4144
session.run("black", *files)
4245

4346

4447
@nox.session()
4548
def lint(session):
46-
session.install(*["black", "flake8", "mypy", "check-manifest"])
49+
session.install("isort", "black", "flake8", "mypy", "check-manifest")
50+
session.run("isort", "--check-only", *ISORT_OPTIONS, *LINTED_PATHS)
4751
session.run("black", "--check", *LINTED_PATHS)
4852
session.run("flake8", *LINTED_PATHS)
4953
session.run("mypy", *LINTED_PATHS)

0 commit comments

Comments
 (0)