Skip to content

Commit 0fa1b43

Browse files
authored
style: enable TorchFix in pre-commit (#4230)
Enable [TorchFix](https://github.com/pytorch-labs/torchfix). Need to resolve the following issues before merging: - #4229 - #4143 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Integrated `flake8` for enhanced code quality checks. - Added `ruff-format` hook for improved linting. - Implemented consistent license header insertion for various file types. - **Bug Fixes** - Updated `check-added-large-files` hook to enforce a maximum file size of 1024 KB. - **Documentation** - Updated linting configuration with new rules under `[tool.flake8]`. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Jinzhe Zeng <[email protected]>
1 parent b78832d commit 0fa1b43

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ repos:
3838
- id: ruff-format
3939
exclude: ^source/3rdparty
4040
types_or: [python, pyi, jupyter]
41+
- repo: https://github.com/pycqa/flake8
42+
# flake8 cannot autofix
43+
rev: "7.1.1"
44+
hooks:
45+
- id: flake8
46+
additional_dependencies:
47+
- torchfix==0.6.0
48+
- flake8-pyproject==1.2.3
4149
# numpydoc
4250
- repo: https://github.com/Carreau/velin
4351
rev: 0.0.12

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,3 +419,10 @@ plugins = ["source.3rdparty.coverage_plugins.jit_plugin"]
419419
load-plugins = "deepmd_checker"
420420
disable = "all"
421421
enable = "E8001,E8002"
422+
423+
[tool.flake8]
424+
select = [
425+
"TOR0",
426+
"TOR1",
427+
"TOR2",
428+
]

0 commit comments

Comments
 (0)