|
1 | 1 | repos: |
2 | | -# Common hooks |
3 | | -- repo: https://github.com/pre-commit/pre-commit-hooks |
4 | | - rev: v4.1.0 |
| 2 | + # Common hooks |
| 3 | + - repo: https://github.com/pre-commit/pre-commit-hooks |
| 4 | + rev: v4.4.0 |
5 | 5 | hooks: |
6 | | - - id: check-added-large-files |
7 | | - - id: check-merge-conflict |
8 | | - - id: check-symlinks |
9 | | - - id: detect-private-key |
10 | | - - id: end-of-file-fixer |
11 | | - - id: trailing-whitespace |
12 | | - files: (.*\.(py|bzl|md|rst|c|cc|cxx|cpp|cu|h|hpp|hxx|xpu|kps|cmake|yaml|yml|hook|scpp)|BUILD|.*\.BUILD|WORKSPACE|CMakeLists\.txt)$ |
13 | | -- repo: https://github.com/Lucas-C/pre-commit-hooks.git |
14 | | - rev: v1.1.14 |
| 6 | + - id: check-added-large-files |
| 7 | + - id: check-merge-conflict |
| 8 | + - id: check-symlinks |
| 9 | + - id: detect-private-key |
| 10 | + - id: end-of-file-fixer |
| 11 | + - id: sort-simple-yaml |
| 12 | + files: (ops|backward|op_[a-z_]+)\.yaml$ |
| 13 | + - id: trailing-whitespace |
| 14 | + - repo: https://github.com/Lucas-C/pre-commit-hooks.git |
| 15 | + rev: v1.5.1 |
15 | 16 | hooks: |
16 | | - - id: remove-crlf |
17 | | - - id: remove-tabs |
| 17 | + - id: remove-crlf |
| 18 | + - id: remove-tabs |
18 | 19 | name: Tabs remover (C++) |
19 | | - files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|xpu|kps)$ |
| 20 | + files: \.(c|cc|cxx|cpp|cu|h|cuh|hpp|hxx|xpu|kps)$ |
20 | 21 | args: [--whitespaces-count, '2'] |
21 | | - - id: remove-tabs |
| 22 | + - id: remove-tabs |
22 | 23 | name: Tabs remover (Python) |
23 | 24 | files: (.*\.(py|bzl)|BUILD|.*\.BUILD|WORKSPACE)$ |
24 | 25 | args: [--whitespaces-count, '4'] |
25 | | -# For Python files |
26 | | -- repo: https://github.com/psf/black.git |
27 | | - rev: 22.8.0 |
| 26 | + # For Python files |
| 27 | + - repo: https://github.com/astral-sh/ruff-pre-commit |
| 28 | + rev: v0.14.4 |
28 | 29 | hooks: |
29 | | - - id: black |
30 | | - files: (.*\.(py|pyi|bzl)|BUILD|.*\.BUILD|WORKSPACE)$ |
31 | | -- repo: https://github.com/PyCQA/flake8 |
32 | | - rev: 4.0.1 |
| 30 | + - id: ruff-check |
| 31 | + args: [--fix, --exit-non-zero-on-fix, --no-cache] |
| 32 | + - id: ruff-format |
| 33 | + # For C++ files |
| 34 | + - repo: local |
33 | 35 | hooks: |
34 | | - - id: flake8 |
35 | | -- repo: https://github.com/PyCQA/autoflake |
36 | | - rev: v1.7.7 |
37 | | - hooks: |
38 | | - - id: autoflake |
39 | | - args: |
40 | | - - --in-place |
41 | | - - --remove-all-unused-imports |
42 | | - - --ignore-pass-after-docstring |
43 | | - - --ignore-init-module-imports |
44 | | - - --exclude=python/paddle/fluid/[!t]**,python/paddle/fluid/tra** |
45 | | -- repo: local |
46 | | - hooks: |
47 | | - - id: pylint-doc-string |
48 | | - name: pylint |
49 | | - description: Check python docstring style using docstring_checker. |
50 | | - entry: bash ./tools/codestyle/pylint_pre_commit.hook |
51 | | - language: system |
52 | | - files: \.(py)$ |
53 | | -# For C++ files |
54 | | -- repo: local |
55 | | - hooks: |
56 | | - - id: clang-format |
| 36 | + - id: clang-format |
57 | 37 | name: clang-format |
58 | 38 | description: Format files with ClangFormat. |
59 | | - entry: bash ./tools/codestyle/clang_format.hook -i |
| 39 | + entry: bash ./tools/codestyle/clang_format.sh -i |
60 | 40 | language: system |
61 | | - files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|xpu|kps|mm|m|scpp)$ |
62 | | -- repo: local |
| 41 | + files: \.(c|cc|cxx|cpp|cu|h|cuh|hpp|hxx|xpu|kps)$ |
| 42 | + - repo: local |
63 | 43 | hooks: |
64 | | - - id: cpplint-cpp-source |
| 44 | + - id: cpplint-cpp-source |
65 | 45 | name: cpplint |
66 | 46 | description: Check C++ code style using cpplint.py. |
67 | | - entry: bash ./tools/codestyle/cpplint_pre_commit.hook |
| 47 | + entry: bash ./tools/codestyle/cpplint_pre_commit.sh |
68 | 48 | language: system |
69 | | - files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|scpp)$ |
| 49 | + files: \.(cc|cxx|cpp|cu|h|hpp|hxx)$ |
70 | 50 | args: |
71 | | - - --extensions=c,cc,cxx,cpp,cu,cuh,h,hpp,hxx,kps |
72 | | - - --filter=-readability/fn_size,-build/include_what_you_use,-build/c++11,-whitespace/parens,-legal/copyright |
73 | | - - --quiet |
74 | | -# For CMake files |
75 | | -- repo: local |
76 | | - hooks: |
77 | | - - id: auto-generate-cmakelists |
78 | | - name: auto-generate-cmakelists |
79 | | - entry: bash ./tools/gen_ut_cmakelists.hook |
80 | | - language: system |
81 | | - files: testslist.csv$ |
82 | | -- repo: https://github.com/cheshirekow/cmake-format-precommit |
| 51 | + - --extensions=cc,cxx,cpp,cu,cuh,h,hpp,hxx,kps |
| 52 | + - --filter=-readability/fn_size,-build/include_what_you_use,-build/c++11,-whitespace/parens,-legal/copyright |
| 53 | + - --quiet |
| 54 | + # For CMake files |
| 55 | + - repo: https://github.com/cheshirekow/cmake-format-precommit |
83 | 56 | rev: v0.6.13 |
84 | 57 | hooks: |
85 | | - - id: cmake-format |
86 | | -- repo: https://github.com/cmake-lint/cmake-lint |
87 | | - rev: 1.4.2 |
| 58 | + - id: cmake-format |
| 59 | + - repo: https://github.com/PFCCLab/cmake-lint-paddle |
| 60 | + rev: v1.5.1 |
88 | 61 | hooks: |
89 | | - - id: cmakelint |
| 62 | + - id: cmakelint |
90 | 63 | args: [--config=./tools/codestyle/.cmakelintrc] |
| 64 | + # For YAML files |
| 65 | + - repo: https://github.com/PFCCLab/yamlfmt-pre-commit-mirror.git |
| 66 | + rev: v0.16.0 |
| 67 | + hooks: |
| 68 | + - id: yamlfmt |
| 69 | + files: | |
| 70 | + (?x)^( |
| 71 | + \.github/.+\.(yaml|yml)| |
| 72 | + \.pre-commit-config\.yaml| |
| 73 | + \.yamlfmt| |
| 74 | + sgconfig\.yml| |
| 75 | + ci/rules/.+\.yml| |
| 76 | + ci/rule-tests/.+\.yml |
| 77 | + ) |
0 commit comments