From 4490b117e4107ddfcde9deb0ccc10e0384a5adc6 Mon Sep 17 00:00:00 2001 From: Wei Fu <36355462+garrett4wade@users.noreply.github.com> Date: Wed, 16 Jul 2025 12:50:07 +0800 Subject: [PATCH] [Feature] Add pre-commit (#178) * fix ci * . * . * . --- .pre-commit-config.yaml | 60 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..90ec420 --- /dev/null +++ b/.pre-commit-config.yaml @@ -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$