diff --git a/pyproject.toml b/pyproject.toml index 826c1179..b3eaa0d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,6 +57,7 @@ pytest = "^7.1" pytest-cov = "^4.0" pytest-sugar = "^0.9.5" pytest-xdist = "^2.0" +ruff = "^0.1.3" tox = {version = "^3.13", optional = true} flake8 = "^3.8" flake8-import-order = "^0.18.1" diff --git a/tasks.py b/tasks.py index 148899c7..d41e2955 100644 --- a/tasks.py +++ b/tasks.py @@ -66,13 +66,20 @@ def isort(c, check=False, diff=False): @task -def flake8(c): - c.run(f"git diff HEAD | {VENV_BIN}/flake8 --diff --max-line-length=88", pty=PTY) +def ruff(c, fix=False, diff=False): + """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 -def lint(c): - flake8(c) +def lint(c, fix=False, diff=False): + """Check code style via linting tools.""" + ruff(c, fix=fix, diff=diff) @task