inv task now uses ruff

This commit is contained in:
Chris Rose 2023-10-28 10:54:09 -07:00
commit 58fd855385
No known key found for this signature in database
2 changed files with 12 additions and 4 deletions

View file

@ -57,6 +57,7 @@ pytest = "^7.1"
pytest-cov = "^4.0" pytest-cov = "^4.0"
pytest-sugar = "^0.9.5" pytest-sugar = "^0.9.5"
pytest-xdist = "^2.0" pytest-xdist = "^2.0"
ruff = "^0.1.3"
tox = {version = "^3.13", optional = true} tox = {version = "^3.13", optional = true}
flake8 = "^3.8" flake8 = "^3.8"
flake8-import-order = "^0.18.1" flake8-import-order = "^0.18.1"

View file

@ -66,13 +66,20 @@ def isort(c, check=False, diff=False):
@task @task
def flake8(c): def ruff(c, fix=False, diff=False):
c.run(f"git diff HEAD | {VENV_BIN}/flake8 --diff --max-line-length=88", pty=PTY) """Run Ruff to ensure code meets project standards."""
diff_flag, fix_flag = "", ""
if fix:
fix_flag = "--fix"
if diff:
diff_flag = "--diff"
c.run(f"{VENV_BIN}/ruff check {diff_flag} {fix_flag} .", pty=PTY)
@task @task
def lint(c): def lint(c, fix=False, diff=False):
flake8(c) """Check code style via linting tools."""
ruff(c, fix=fix, diff=diff)
@task @task