-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new: dev: Invoke: quality task implemented #154
Run `inv qa` to test this functionality. CAVEAT: at the moment, qa runs flake8, pylint and mypy sequentially. Black is not run because it would modify the source code.
- Loading branch information
1 parent
ef891b3
commit d1cfaeb
Showing
5 changed files
with
62 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[flake8] | ||
max-line-length = 79 | ||
exclude = **/__pycache__ | ||
max-complexity = 20 | ||
ignore = E203, W503 | ||
jobs=4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
flake8 >= 6.0.0 | ||
invoke >= 2.0.0 | ||
mypy>=0.942 | ||
pycodestyle>=2.8.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
"""Quality assessment tasks. Run all quality checks with `inv qa`. | ||
The quality checks are: | ||
- black | ||
- flake8 | ||
- pylint | ||
- mypy | ||
""" | ||
|
||
from invoke import task | ||
from .colors import colorize | ||
|
||
from .system import OperatingSystem, get_current_system | ||
|
||
PTY = True | ||
if get_current_system() == OperatingSystem.WINDOWS: | ||
PTY = False | ||
|
||
|
||
# @task | ||
# def black(c_r): | ||
# """Run code formatter: black.""" | ||
# print(colorize("-> Running black...")) | ||
# c_r.run(f"black {c_r.project_slug}", pty=PTY) | ||
|
||
|
||
@task | ||
def flake(c_r): | ||
"""Run style guide enforcement: flake8.""" | ||
print(colorize("-> Running flake8...")) | ||
c_r.run(f"flake8 {c_r.project_slug}", warn=True, pty=PTY) | ||
|
||
|
||
@task | ||
def pylint(c_r): | ||
"""Run code analysis: pylint.""" | ||
print(colorize("-> Running pylint...")) | ||
c_r.run(f"pylint {c_r.project_slug}", warn=True, pty=PTY) | ||
|
||
|
||
@task | ||
def mypy(c_r): | ||
"""Run static type checking: mypy.""" | ||
print(colorize("-> Running mypy...")) | ||
c_r.run(f"mypy {c_r.project_slug}", warn=True, pty=PTY) | ||
|
||
|
||
# @task(post=[black, flake, pylint, mypy], default=True) | ||
@task(post=[flake, pylint, mypy], default=True) | ||
def all(c_r): # pylint: disable=W0622,W0613 # noqa: F811 | ||
"""Run all quality checks.""" |