|
16 | 16 | LINT_PATH = "./src" |
17 | 17 | REQUIREMENTS_PATH = "./requirements" |
18 | 18 |
|
| 19 | + |
| 20 | +LINTING_COMMANDS = ( |
| 21 | + ( |
| 22 | + "isort", |
| 23 | + "--verbose", |
| 24 | + "--force-single-line-imports", |
| 25 | + "--profile", |
| 26 | + "black", |
| 27 | + "--add-import", |
| 28 | + "from __future__ import annotations", |
| 29 | + LINT_PATH, |
| 30 | + TESTS_PATH, |
| 31 | + ), |
| 32 | + ("black", "--verbose", LINT_PATH, TESTS_PATH), |
| 33 | + ("flake8", "--show-source", "--verbose", LINT_PATH, TESTS_PATH), |
| 34 | + ("mypy", "--no-incremental", "--package", MODULE_NAME), |
| 35 | + ("mypy", "--no-incremental", TESTS_PATH), |
| 36 | +) |
| 37 | + |
19 | 38 | # What we allowed to clean (delete) |
20 | 39 | CLEANABLE_TARGETS = [ |
21 | 40 | "./dist", |
@@ -55,10 +74,7 @@ def dev(session: nox.Session) -> None: |
55 | 74 | python = partial(session.run, f"{venv_path}/python", "-m") |
56 | 75 | contraint = ("--constraint", f"{REQUIREMENTS_PATH}/constraints.txt") |
57 | 76 |
|
58 | | - for requirement_file in get_requirement_files(): |
59 | | - python("pip", "install", "-r", requirement_file, *contraint, external=True) |
60 | | - |
61 | | - python("pip", "install", "--editable", ".", *contraint, external=True) |
| 77 | + python("pip", "install", "--editable", ".[dev,test]", *contraint, external=True) |
62 | 78 |
|
63 | 79 | python("pip", "install", "pre-commit", external=True) |
64 | 80 | session.run(f"{venv_path}/pre-commit", "install", external=True) |
@@ -109,26 +125,12 @@ def run_linters_and_formatters(session: nox.Session) -> None: |
109 | 125 | print_standard_logs(session) |
110 | 126 |
|
111 | 127 | contraint = ("--constraint", f"{REQUIREMENTS_PATH}/constraints.txt") |
112 | | - session.install(".[dev]", *contraint) |
| 128 | + session.install(".[dev,test]", *contraint) |
113 | 129 |
|
114 | 130 | python = partial(session.run, "python", "-m") |
115 | 131 |
|
116 | | - # Handle anything tool that applies corrections first. |
117 | | - python( |
118 | | - "isort", |
119 | | - "--verbose", |
120 | | - "--force-single-line-imports", |
121 | | - "--profile", |
122 | | - "black", |
123 | | - "--add-import", |
124 | | - "from __future__ import annotations", |
125 | | - LINT_PATH, |
126 | | - ) |
127 | | - python("black", "--verbose", LINT_PATH) |
128 | | - |
129 | | - # Linters: aka, things that yell but want you to fix things |
130 | | - python("flake8", "--show-source", "--verbose", LINT_PATH) |
131 | | - python("mypy", "--no-incremental", "--package", MODULE_NAME) |
| 132 | + for linter_command in LINTING_COMMANDS: |
| 133 | + python(*linter_command) |
132 | 134 |
|
133 | 135 |
|
134 | 136 | @nox.session() |
|
0 commit comments