.pre-commit-config.yaml 8.3 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 27
    -   id: sort-simple-yaml
        files: (api|backward)\.yaml$
L
test  
liaogang 已提交
28
-   repo: local
Y
Yu Yang 已提交
29
    hooks:
30
    -   id: clang-format-with-version-check
L
test  
liaogang 已提交
31 32
        name: clang-format
        description: Format files with ClangFormat.
33
        entry: bash ./tools/codestyle/clang_format.hook -i
L
test  
liaogang 已提交
34
        language: system
35
        files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto|xpu|kps)$
36 37 38 39
        exclude: |
            (?x)^(
                paddle/fluid/distributed/ps/thirdparty/round_robin.h
            )$
Y
Yi Wang 已提交
40 41 42 43 44 45 46 47
-   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 已提交
48 49 50 51 52 53 54 55
-   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 已提交
56 57 58 59
-   repo: local
    hooks:
    -   id: copyright_checker
        name: copyright_checker
60
        entry: python ./tools/codestyle/copyright.hook
D
dzhwinter 已提交
61
        language: system
62
        files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto|xpu|kps|py|sh)$
63 64 65 66
        exclude: |
            (?x)^(
                paddle/utils/.*
            )$
67 68 69 70 71 72 73 74 75 76
-   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
            )$
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189

-   repo: https://github.com/cmake-lint/cmake-lint
    rev: 1.4.2
    hooks:
    -   id: cmakelint
        args: [--config=./tools/codestyle/.cmakelintrc]
        # exclude files which need to be fixed
        exclude: |
            (?x)^(
                CMakeLists.txt|
                paddle/fluid/pybind/CMakeLists.txt|
                python/paddle/fluid/tests/unittests/CMakeLists.txt|
                paddle/fluid/eager/auto_code_generator/CMakeLists.txt|
                paddle/fluid/framework/CMakeLists.txt|
                paddle/fluid/eager/auto_code_generator/final_state_generator/CMakeLists.txt|
                cmake/third_party.cmake|
                paddle/fluid/inference/tests/infer_ut/CMakeLists.txt|
                cmake/configure.cmake|
                paddle/fluid/inference/api/demo_ci/CMakeLists.txt|
                cmake/flags.cmake|
                cmake/inference_lib.cmake|
                cmake/external/protobuf.cmake|
                cmake/system.cmake|
                cmake/cudnn.cmake|
                cmake/external/mkldnn.cmake|
                cmake/unity_build.cmake|
                paddle/fluid/framework/fleet/CMakeLists.txt|
                paddle/fluid/inference/CMakeLists.txt|
                paddle/fluid/inference/tests/api/CMakeLists.txt|
                paddle/fluid/operators/CMakeLists.txt|
                paddle/phi/api/lib/CMakeLists.txt|
                cmake/external/gflags.cmake|
                cmake/external/lite.cmake|
                cmake/external/poplar.cmake|
                cmake/python_module.cmake|
                python/paddle/fluid/tests/unittests/asp/CMakeLists.txt|
                cmake/cuda.cmake|
                cmake/FindNumPy.cmake|
                cmake/phi.cmake|
                paddle/fluid/framework/ir/CMakeLists.txt|
                paddle/fluid/platform/CMakeLists.txt|
                python/paddle/fluid/tests/unittests/mlu/CMakeLists.txt|
                python/paddle/tests/CMakeLists.txt|
                cmake/ccache.cmake|
                cmake/coveralls.cmake|
                cmake/external/glog.cmake|
                cmake/external/onnxruntime.cmake|
                cmake/external/openblas.cmake|
                cmake/external/xpu.cmake|
                cmake/hip.cmake|
                paddle/fluid/distributed/CMakeLists.txt|
                paddle/fluid/framework/details/CMakeLists.txt|
                paddle/fluid/imperative/CMakeLists.txt|
                paddle/fluid/inference/analysis/ir_passes/CMakeLists.txt|
                paddle/fluid/inference/api/CMakeLists.txt|
                paddle/fluid/operators/controlflow/CMakeLists.txt|
                python/paddle/fluid/tests/unittests/distributed_passes/CMakeLists.txt|
                cmake/cblas.cmake|
                cmake/coverallsGcovJsons.cmake|
                cmake/external/brpc.cmake|
                cmake/external/cryptopp.cmake|
                cmake/external/gtest.cmake|
                cmake/external/llvm.cmake|
                cmake/external/utf8proc.cmake|
                cmake/external/warpctc.cmake|
                cmake/external/zlib.cmake|
                cmake/FindGperftools.cmake|
                cmake/operators.cmake|
                cmake/tensorrt.cmake|
                paddle/fluid/inference/api/details/CMakeLists.txt|
                python/paddle/fluid/tests/unittests/xpu/CMakeLists.txt|
                cmake/external/arm_brpc.cmake|
                cmake/external/concurrentqueue.cmake|
                cmake/external/eigen.cmake|
                cmake/external/mklml.cmake|
                cmake/external/paddle2onnx.cmake|
                cmake/miopen.cmake|
                cmake/nccl.cmake|
                cmake/simd.cmake|
                paddle/fluid/distributed/fleet_executor/CMakeLists.txt|
                paddle/fluid/eager/api/generated/fluid_generated/forwards/CMakeLists.txt|
                paddle/fluid/framework/io/CMakeLists.txt|
                paddle/fluid/imperative/tests/CMakeLists.txt|
                paddle/fluid/inference/analysis/CMakeLists.txt|
                paddle/fluid/inference/tests/infer_ut/external-cmake/gtest-cpp.cmake|
                paddle/fluid/memory/allocation/CMakeLists.txt|
                paddle/fluid/memory/CMakeLists.txt|
                paddle/fluid/operators/cinn/CMakeLists.txt|
                paddle/fluid/operators/collective/CMakeLists.txt|
                paddle/fluid/operators/ipu/CMakeLists.txt|
                paddle/fluid/operators/jit/CMakeLists.txt|
                paddle/fluid/operators/pscore/CMakeLists.txt|
                paddle/fluid/platform/device/ipu/CMakeLists.txt|
                paddle/fluid/platform/dynload/CMakeLists.txt|
                paddle/infrt/external_kernels/CMakeLists.txt|
                paddle/infrt/kernel/phi/CMakeLists.txt|
                paddle/phi/backends/dynload/CMakeLists.txt|
                paddle/phi/CMakeLists.txt|
                paddle/phi/kernels/CMakeLists.txt|
                paddle/phi/tests/core/CMakeLists.txt|
                python/CMakeLists.txt|
                python/paddle/fluid/contrib/slim/tests/CMakeLists.txt|
                python/paddle/fluid/tests/unittests/autograd/CMakeLists.txt|
                python/paddle/fluid/tests/unittests/distribution/CMakeLists.txt|
                python/paddle/fluid/tests/unittests/dygraph_to_static/CMakeLists.txt|
                python/paddle/fluid/tests/unittests/fft/CMakeLists.txt|
                python/paddle/fluid/tests/unittests/ipu/CMakeLists.txt|
                python/paddle/fluid/tests/unittests/mkldnn/CMakeLists.txt|
                python/paddle/fluid/tests/unittests/npu/CMakeLists.txt|
                python/paddle/fluid/tests/unittests/ps/CMakeLists.txt|
                python/paddle/fluid/tests/unittests/rnn/CMakeLists.txt|
                python/paddle/fluid/tests/unittests/sequence/CMakeLists.txt
            )$