|
1 | | -# Copyright (c) 2022 Graphcore Ltd. All rights reserved. |
2 | | ---- |
3 | | -exclude: | |
4 | | - (?x)^( |
5 | | - build_scripts/.*| |
6 | | - willow/include/popart/vendored/.*| |
7 | | - .arclint| |
8 | | - .arcconfig| |
9 | | - .buildignore| |
10 | | - .clang-format| |
11 | | - .*Doxyfile.in| |
12 | | - .*LICENSE| |
13 | | - .*.drawio| |
14 | | - .*.json| |
15 | | - .*.md| |
16 | | - .*.png| |
17 | | - .*.pdf| |
18 | | - .*.rst |
19 | | - )$ |
| 1 | +# See https://pre-commit.com for more information |
| 2 | +# See https://pre-commit.com/hooks.html for more hooks |
20 | 3 | repos: |
21 | | - - repo: local |
22 | | - hooks: |
23 | | - - id: version-checker |
24 | | - name: Version checker |
25 | | - description: Ensures that the correct version of the linters are used. |
26 | | - entry: python3 -m scripts.lint.linters.check_versions |
27 | | - language: python |
28 | | - exclude: ".*" # Does not run on files |
29 | | - always_run: true |
30 | | - fail_fast: true |
31 | | - additional_dependencies: |
32 | | - - pyyaml |
33 | | - - id: copyright-linter |
34 | | - name: Copyright linter |
35 | | - description: Ensures that files have the proper copyright line. |
36 | | - entry: python3 -m scripts.lint.linters.copyright_linter |
37 | | - language: python |
38 | | - exclude: tests/integration/operators_test/rnn_helper.py |
39 | | - additional_dependencies: |
40 | | - # dataclasses was introduced in Python 3.7 |
41 | | - # For python 3.6 it therefore needs to be added as a dependency |
42 | | - - dataclasses |
43 | | - - id: popart-test-linter |
44 | | - name: PopART test-linter |
45 | | - description: | |
46 | | - checks that pytest test files have a corresponding |
47 | | - `add_popart_py_unit_test` entry in a neighbouring CMakeLists.txt |
48 | | - file |
49 | | - entry: python3 -m scripts.lint.linters.check_python_test_has_cmake_entry |
50 | | - language: python |
51 | | - files: .*.py |
52 | | - exclude: | |
53 | | - (?x)^( |
54 | | - tests/integration/operators_test/scatterreduce_test_basic.py | |
55 | | - docs/popart/files/tests/test_popart_doc_examples_custom_op.py| |
56 | | - docs/popart/files/tests/test_popart_doc_examples.py| |
57 | | - docs/popxl/files/tests/test_popxl_doc_examples_custom_op.py| |
58 | | - docs/popxl/files/tests/test_popxl_doc_examples.py| |
59 | | - docs/popxl/files/mnist.py| |
60 | | - docs/popxl/files/mnist_rts.py| |
61 | | - tests/linters/.* |
62 | | - )$ |
63 | | - # Note: pylint to be run locally: |
64 | | - # https://pylint.pycqa.org/en/latest/user_guide/pre-commit-integration.html |
65 | | - - id: pylint |
66 | | - name: pylint |
67 | | - entry: pylint |
68 | | - language: system |
69 | | - types: [python] |
70 | | - # -j 1 is needed for the linter not to hang |
71 | | - # https://github.com/PyCQA/pylint/issues/3899 |
72 | | - args: |
73 | | - [ |
74 | | - --rcfile=scripts/lint/linters/pylintrc, |
75 | | - -j 1 |
76 | | - ] |
77 | | - - repo: https://github.com/pre-commit/pre-commit-hooks |
78 | | - rev: v2.3.0 |
79 | | - hooks: |
80 | | - - id: check-yaml |
81 | | - # This file starts with @ which is a reserved yml character |
82 | | - exclude: popart.prodinfo.yml |
83 | | - - id: check-json |
84 | | - - id: check-merge-conflict |
85 | | - - id: debug-statements |
86 | | - - id: end-of-file-fixer |
87 | | - - id: mixed-line-ending |
88 | | - - id: trailing-whitespace |
89 | | - - repo: https://github.com/psf/black |
90 | | - rev: 21.12b0 |
91 | | - hooks: |
92 | | - - id: black |
93 | | - additional_dependencies: |
94 | | - - click==8.0.4 |
95 | | - # Prevent an error with the current version of black and Python version >3.6 (D73000). |
96 | | - - repo: https://github.com/asottile/blacken-docs |
97 | | - rev: v1.12.0 |
98 | | - hooks: |
99 | | - - id: blacken-docs |
100 | | - additional_dependencies: |
101 | | - - black==21.12b0 |
102 | | - - repo: https://github.com/pycqa/pydocstyle |
103 | | - rev: 6.1.1 |
104 | | - hooks: |
105 | | - - id: pydocstyle |
106 | | - # Tests are currently emitting a lot of errors, will be fixed at a later stage |
107 | | - exclude: tests/ |
108 | | - args: |
109 | | - # See explanation of error codes at http://www.pydocstyle.org/en/6.1.1/error_codes.html |
110 | | - # By using select, most checking is ignored |
111 | | - # This can be checked when enough errors has been fixed |
112 | | - - |- |
113 | | - --select= |
114 | | - D400, |
115 | | - D401 |
116 | | - - repo: https://github.com/pocc/pre-commit-hooks |
117 | | - rev: v1.3.5 |
118 | | - hooks: |
119 | | - # Install with pip3 install clang-format==9.0.0 |
120 | | - - id: clang-format |
121 | | - args: [ |
122 | | - -i, # Fix inplace |
123 | | - --style=file # Use .clang-tidy |
124 | | - ] |
125 | | - # - id: clang-tidy |
126 | | - # - id: oclint |
127 | | - # - id: uncrustify |
128 | | - - id: cppcheck |
129 | | - args: [ |
130 | | - --inline-suppr, |
131 | | - --suppressions-list=scripts/lint/linters/cppcheck-suppressions-list.txt |
132 | | - ] |
133 | | - - id: cpplint |
134 | | - # This check clashes with clang-format |
135 | | - args: [ |
136 | | - '--filter=-,-build/header_guard' |
137 | | - ] |
138 | | - exclude: | |
139 | | - (?x)^( |
140 | | - willow/include/popart/docs/pydocs_popart_core.hpp| |
141 | | - willow/include/popart/builder.gen.hpp| |
142 | | - willow/include/popart/onnxoperators.gen.hpp| |
143 | | - willow/src/opsets.gen.hpp |
144 | | - )$ |
145 | | -
|
146 | | - - repo: local |
147 | | - hooks: |
148 | | - # The clone linter should run after the format linters so that it only works on formatted files |
149 | | - - id: clone-linter |
150 | | - name: Clone linter |
151 | | - description: Ensures that all Ops implements a clone(). |
152 | | - entry: python3 -m scripts.lint.linters.clone_linter |
153 | | - language: python |
154 | | - files: "willow/include/popart/op/.*.hpp" |
155 | | - # - id: iwyu |
156 | | - # language: script |
157 | | - # name: Include what you use |
158 | | - # types: [c++] |
159 | | - # entry: scripts/lint/linters/iwyu/include_what_you_use_linter.sh |
160 | | - # # verify_cxx_11_interface.cpp is excluded as it relies on files generated |
161 | | - # # during build |
162 | | - # # opidentifier.hpp is deprecated and should be kept as is until removed |
163 | | - # # willow/include/popart/vendored/ contains external files, should avoid |
164 | | - # # changing them |
165 | | - # exclude: > |
166 | | - # (?x)^( |
167 | | - # tests/integration/verify_cxx_11_interface/verify_cxx_11_interface.cpp| |
168 | | - # willow/include/popart/opidentifier.hpp| |
169 | | - # willow/include/popart/vendored/ |
170 | | - # )$ |
| 4 | +- repo: https://github.com/pre-commit/pre-commit-hooks |
| 5 | + rev: v3.2.0 |
| 6 | + hooks: |
| 7 | + - id: trailing-whitespace |
| 8 | + - id: end-of-file-fixer |
| 9 | + - id: check-json |
| 10 | + - id: check-added-large-files |
| 11 | +- repo: https://github.com/pocc/pre-commit-hooks |
| 12 | + rev: v1.3.5 |
| 13 | + hooks: |
| 14 | + - id: clang-format |
| 15 | + additional_dependencies: [clang-format==16.0.6] |
| 16 | + files: \.(c|cpp|h|hpp)$ |
| 17 | +- repo: https://github.com/pre-commit/mirrors-yapf |
| 18 | + rev: v0.32.0 |
| 19 | + hooks: |
| 20 | + - id: yapf |
| 21 | + types: [python] |
| 22 | +- repo: ssh://git@github.com/Software-GCAI/precommit-scripts |
| 23 | + rev: v1.0.1 |
| 24 | + hooks: |
| 25 | + - id: gc-copyright |
0 commit comments