refactor template
This commit is contained in:
@@ -3,37 +3,34 @@ from invoke import task
|
||||
|
||||
|
||||
@task
|
||||
def clean(ctx):
|
||||
"""
|
||||
Remove all files and directories that are not under version control to ensure a pristine working environment.
|
||||
Use caution as this operation cannot be undone and might remove untracked files.
|
||||
|
||||
"""
|
||||
|
||||
ctx.run("git clean -nfdx")
|
||||
|
||||
response = (
|
||||
input("Are you sure you want to remove all untracked files? (y/n) [n]: ")
|
||||
.strip()
|
||||
.lower()
|
||||
)
|
||||
if response == "y":
|
||||
ctx.run("git clean -fdx")
|
||||
def venv(c):
|
||||
"""Sync dependencies."""
|
||||
c.run("uv sync --group dev")
|
||||
|
||||
|
||||
@task
|
||||
def lint(ctx):
|
||||
"""
|
||||
Perform static analysis on the source code to check for syntax errors and enforce style consistency.
|
||||
"""
|
||||
ctx.run("ruff check src", pty=True)
|
||||
ctx.run("ruff format --check src", pty=True)
|
||||
ctx.run("mypy src", pty=True)
|
||||
def format(c):
|
||||
"""Format code."""
|
||||
c.run("uv run ruff format src tests")
|
||||
|
||||
|
||||
@task
|
||||
def test(ctx):
|
||||
"""
|
||||
Run tests with coverage information.
|
||||
"""
|
||||
ctx.run("pytest --cov=src --cov-report=term-missing", pty=True)
|
||||
def lint(c):
|
||||
"""Run linters."""
|
||||
c.run("uv run ruff check src tests")
|
||||
c.run("uv run ruff format --check src tests")
|
||||
c.run("uv run mypy src")
|
||||
|
||||
|
||||
@task
|
||||
def test(c):
|
||||
"""Run tests with coverage."""
|
||||
c.run("uv run pytest --cov=src --cov-report=term-missing")
|
||||
|
||||
|
||||
@task
|
||||
def clean(c):
|
||||
"""Preview files to delete (safe mode)."""
|
||||
c.run("git clean -nfdx")
|
||||
if input("Delete? [y/N] ").lower() == "y":
|
||||
c.run("git clean -fdx")
|
||||
|
||||
Reference in New Issue
Block a user