[Feature] Add pre-commit (#178)

* fix ci

* .

* .

* .
This commit is contained in:
Wei Fu 2025-07-16 12:50:07 +08:00 committed by GitHub
parent 517353c065
commit 4490b117e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 60 additions and 0 deletions

60
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,60 @@
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.7
hooks:
- id: clang-format
files: \.(c|cc|cxx|cpp|h|hpp|hxx|cu|cuh)$
args:
- --style=file
- --fallback-style=Google
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
files: \.(yaml|yml)$
- id: end-of-file-fixer
files: \.(py|md|yaml|yml|c|cc|cxx|cpp|h|hpp|hxx|cu|cuh)$
- id: trailing-whitespace
files: \.(py|md|yaml|yml|c|cc|cxx|cpp|h|hpp|hxx|cu|cuh)$
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
hooks:
- id: mdformat
args:
- --wrap=88
additional_dependencies:
- mdformat-gfm
- mdformat-tables
- mdformat-frontmatter
- repo: https://github.com/pycqa/autoflake
rev: v2.3.1
hooks:
- id: autoflake
args:
- -i
- -r
- --remove-all-unused-imports
- --remove-unused-variables
files: ^(arealite/|examples/arealite/).*\.py$
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
args:
- --profile=black
- --multi-line=3
- --line-length=88
files: \.py$
- repo: https://github.com/psf/black/
rev: 25.1.0
hooks:
- id: black
language_version: python3
args:
- --line-length=88
files: \.py$