.pre-commit-config.yaml 2.9 KB
Newer Older
Y
Yi Wang 已提交
1
repos:
Y
Yu Yang 已提交
2
-   repo: https://github.com/Lucas-C/pre-commit-hooks.git
3
    rev: v1.1.14
Y
Yu Yang 已提交
4 5
    hooks:
    -   id: remove-crlf
L
liaogang 已提交
6
        files: (?!.*third_party)^.*$ | (?!.*book)^.*$
7
-   repo: https://github.com/google/yapf
8
    rev: v0.32.0
Y
Yu Yang 已提交
9
    hooks:
Y
Yi Wang 已提交
10 11
    -   id: yapf
        files: (.*\.(py|bzl)|BUILD|.*\.BUILD|WORKSPACE)$
12 13 14 15 16
        exclude: |
            (?x)^(
                python/paddle/fluid/tests/unittests/dygraph_to_static/test_error.py|
                python/paddle/fluid/tests/unittests/dygraph_to_static/test_origin_info.py
            )$
Y
Yu Yang 已提交
17
-   repo: https://github.com/pre-commit/pre-commit-hooks
18
    rev: v4.1.0
Y
Yu Yang 已提交
19 20 21 22 23
    hooks:
    -   id: check-added-large-files
    -   id: check-merge-conflict
    -   id: check-symlinks
    -   id: detect-private-key
L
liaogang 已提交
24
        files: (?!.*third_party)^.*$ | (?!.*book)^.*$
Y
Yu Yang 已提交
25
    -   id: end-of-file-fixer
26
    -   id: sort-simple-yaml
27
        files: (api|backward|api_[a-z_]+)\.yaml$
28 29
    -   id: trailing-whitespace
        files: (.*\.(py|bzl)|BUILD|.*\.BUILD|WORKSPACE)$
L
test  
liaogang 已提交
30
-   repo: local
Y
Yu Yang 已提交
31
    hooks:
32
    -   id: clang-format
L
test  
liaogang 已提交
33 34
        name: clang-format
        description: Format files with ClangFormat.
35
        entry: bash ./tools/codestyle/clang_format.hook -i
L
test  
liaogang 已提交
36
        language: system
37
        files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|xpu|kps)$
38 39 40 41
        exclude: |
            (?x)^(
                paddle/fluid/distributed/ps/thirdparty/round_robin.h
            )$
Y
Yi Wang 已提交
42 43 44 45 46 47 48 49
-   repo: local
    hooks:
    -   id: cpplint-cpp-source
        name: cpplint
        description: Check C++ code style using cpplint.py.
        entry: bash ./tools/codestyle/cpplint_pre_commit.hook
        language: system
        files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx)$
G
gongweibao 已提交
50 51 52 53 54 55 56 57
-   repo: local
    hooks:
    -   id: pylint-doc-string
        name: pylint
        description: Check python docstring style using docstring_checker.
        entry: bash ./tools/codestyle/pylint_pre_commit.hook
        language: system
        files: \.(py)$
D
dzhwinter 已提交
58 59 60 61
-   repo: local
    hooks:
    -   id: copyright_checker
        name: copyright_checker
62
        entry: python ./tools/codestyle/copyright.hook
D
dzhwinter 已提交
63
        language: system
64
        files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto|xpu|kps|py|sh)$
65 66 67 68
        exclude: |
            (?x)^(
                paddle/utils/.*
            )$
R
Roc 已提交
69 70 71 72 73 74 75
-   repo: local
    hooks:
    -   id: auto-generate-cmakelists
        name: auto-generate-cmakelists
        entry: bash ./tools/gen_ut_cmakelists.hook
        language: system
        files: testslist.csv$
76 77 78 79 80 81 82 83 84 85
-   repo: https://github.com/cheshirekow/cmake-format-precommit
    rev: v0.6.13
    hooks:
    -   id: cmake-format
        # exclude paddle/fluid/operators/CMakeLists.txt, see the comment
        # https://github.com/PaddlePaddle/Paddle/pull/43057#pullrequestreview-993471860
        exclude: |
            (?x)^(
                paddle/fluid/operators/CMakeLists.txt
            )$
86 87 88 89 90 91

-   repo: https://github.com/cmake-lint/cmake-lint
    rev: 1.4.2
    hooks:
    -   id: cmakelint
        args: [--config=./tools/codestyle/.cmakelintrc]