forked from graphcore/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.pre-commit-config.yaml
121 lines (121 loc) · 3.57 KB
/
.pre-commit-config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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
# Copyright (c) 2022 Graphcore Ltd. All rights reserved.
---
exclude: |
(?x)^(
.arcconfig|
.*\.gitignore|
utils/lint/codespell_ignore.txt
)$
repos:
- repo: local
hooks:
- id: copyright-linter
name: Copyright linter
description: Ensures that files have the proper copyright line.
entry: python3 -m utils.lint.linters.copyright_linter
language: python
exclude: |
(?x)^(
.*\.txt|
.*\.json|
.*\.jp(e?)g|
.*\.png|
.*\.pth|
.*\.ini|
.*Makefile|
.*ipynb|
.*LICENSE|
.*COPYRIGHT
)$
additional_dependencies:
# dataclasses was introduced in Python 3.7
# For python 3.6 it therefore needs to be added as a dependency
- dataclasses
- GitPython
- id: trademark-linter
name: Trademark linter
description: Ensures that files have the proper trademark line.
entry: python3 -m utils.lint.linters.trademark_linter
language: python
exclude: |
(?x)^(
utils/lint/linters/trademark_linter.py|
utils/tutorials_tests/test_lint/test_trademark_lint.py|
.+requirements\.txt|
.+\.json|
.*\.jp(e?)g|
.*\.png|
.*\.pth
)$
- id: url-linter
name: URL linter
description: Ensures that URLs in files are correct.
entry: python3 -m utils.lint.linters.url_linter
language: python
require_serial: true
files: |
(?x)^(
.+\.txt|
.+\.md|
.*\.ipynb|
.*\.rst
)$
additional_dependencies:
- requests
- id: fstring-linter
name: f-string linter
description: Ensures that we use Python 3.6 f-strings over .format().
entry: python3 -m utils.lint.linters.fstring_linter
language: python
require_serial: true
files: (?x).*\.py$
- id: pytest-linter
name: Pytest linter
description: Ensures that tests use Pytest (not unittest or SubProcessChecker).
entry: python3 -m utils.lint.linters.pytest_linter
language: python
require_serial: true
files: (?x).*\.py$
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: check-json
- id: check-merge-conflict
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 21.12b0 # Matching black used by blacken-docs
hooks:
- id: black
additional_dependencies:
- click==8.0.4
- id: black-jupyter
additional_dependencies:
- click==8.0.4
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.0 # Newest version that supports Python 3.6
hooks:
- id: blacken-docs
additional_dependencies:
- black==21.12b0 # Newest version that supports blacken-docs==1.12.0
- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
hooks:
# Install with pip3 install clang-format==9.0.0
- id: clang-format
args: [
-i, # Fix inplace
--style=file, # Use .clang-tidy
]
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
- id: codespell
args: [
-I,
utils/lint/codespell_ignore.txt,
]
exclude: cspell.json