diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5428477..ca83003 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,6 +7,10 @@ repos: - id: check-toml - id: end-of-file-fixer - id: trailing-whitespace + - repo: https://github.com/PyCQA/autoflake + rev: v2.2.0 + hooks: + - id: autoflake - repo: https://github.com/psf/black rev: 23.7.0 hooks: diff --git a/pyproject.toml b/pyproject.toml index 87f32d8..889f767 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,6 +35,7 @@ lint = [ "mypy>=1.5.1", "bandit[toml]>=1.7.5", "tox-pdm>=0.6.1", + "autoflake>=2.2.0", ] [tool.pylint.main] @@ -52,3 +53,9 @@ ignored-argument-names = "_.*|^ignored_|^unused_" [tool.bandit] exclude_dirs = ["tests", ".tox", ".venv"] + +[tool.autoflake] +recursive = true +remove-all-unused-imports=true +remove-duplicate-keys = true +remove-unused-variables = true diff --git a/tests/checks/test_bundle.py b/tests/checks/test_bundle.py index 9167fef..8e0432e 100644 --- a/tests/checks/test_bundle.py +++ b/tests/checks/test_bundle.py @@ -1,4 +1,3 @@ -import re from pathlib import Path from typing import Any, Union diff --git a/tox.ini b/tox.ini index 6947ef4..1f140e5 100644 --- a/tox.ini +++ b/tox.ini @@ -32,3 +32,11 @@ groups = lint commands = bandit -c pyproject.toml -r . + +[testenv:format] +groups = + lint +commands = + autoflake --in-place src tests + isort src tests + black src tests