diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 30efa6b062..53fdd9b71c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -38,6 +38,14 @@ repos: - id: ruff-format exclude: ^source/3rdparty types_or: [python, pyi, jupyter] + - repo: https://github.com/pycqa/flake8 + # flake8 cannot autofix + rev: "7.1.1" + hooks: + - id: flake8 + additional_dependencies: + - torchfix==0.6.0 + - flake8-pyproject==1.2.3 # numpydoc - repo: https://github.com/Carreau/velin rev: 0.0.12 diff --git a/pyproject.toml b/pyproject.toml index b13dceeb07..4dbff24f13 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -419,3 +419,10 @@ plugins = ["source.3rdparty.coverage_plugins.jit_plugin"] load-plugins = "deepmd_checker" disable = "all" enable = "E8001,E8002" + +[tool.flake8] +select = [ + "TOR0", + "TOR1", + "TOR2", +]