diff --git a/pste/migrations/alembic.ini b/pste/migrations/alembic.ini index f8ed480..cef7e94 100644 --- a/pste/migrations/alembic.ini +++ b/pste/migrations/alembic.ini @@ -8,6 +8,17 @@ # the 'revision' command, regardless of autogenerate # revision_environment = false +[post_write_hooks] +hooks=ruff-check,ruff-format + +ruff-check.type = exec +ruff-check.executable = ruff +ruff-check.options = check REVISION_SCRIPT_FILENAME + +ruff-format.type = exec +ruff-format.executable = ruff +ruff-format.options = format REVISION_SCRIPT_FILENAME + # Logging configuration [loggers] diff --git a/pste/models/file.py b/pste/models/file.py index c6137f6..c10e195 100644 --- a/pste/models/file.py +++ b/pste/models/file.py @@ -91,7 +91,7 @@ def to_dict(self) -> dict: } -def after_delete(mapper, connection, target: File): +def after_delete(mapper, connection, target: File): # noqa: ARG001 with contextlib.suppress(OSError): Path(target.path).unlink() diff --git a/pste/models/user.py b/pste/models/user.py index 53272a9..cfb27fd 100644 --- a/pste/models/user.py +++ b/pste/models/user.py @@ -103,11 +103,11 @@ def quota(self, humanize: bool = False) -> int | str: return quota -def after_delete(mapper, connection, target: User): +def after_delete(mapper, connection, target: User): # noqa: ARG001 shutil.rmtree(target.storage_directory, ignore_errors=True) -def after_insert(mapper, connection, target: User): +def after_insert(mapper, connection, target: User): # noqa: ARG001 Path(target.storage_directory).mkdir(parents=True, exist_ok=True) diff --git a/pyproject.toml b/pyproject.toml index ac811be..8709cb5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,8 +44,10 @@ extend-exclude = [ [tool.ruff.lint] select = [ "A", + "ARG", "B", "BLE", + "C4", "C90", "DTZ", "E", @@ -57,12 +59,16 @@ select = [ "N", "PL", "PTH", + "Q", "RET", "RSE", "RUF", "S", "SIM", + "SLF", + "T10", "T20", + "TID", "UP", "W", "YTT", @@ -75,7 +81,7 @@ ignore = [ ] [tool.ruff.lint.extend-per-file-ignores] -"pste/migrations/*" = ["ERA001"] +"pste/migrations/*" = ["ERA001", "ARG001"] [tool.ruff.format] line-ending = "lf"