-
Notifications
You must be signed in to change notification settings - Fork 54
/
.pre-commit-config.yaml
61 lines (61 loc) · 1.88 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
repos:
# Common hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-added-large-files
- id: check-merge-conflict
- id: detect-private-key
- id: end-of-file-fixer
- id: sort-simple-yaml
files: .+\.yaml$
- id: trailing-whitespace
files: (.*\.(py|bzl|md|rst|c|cc|cxx|cpp|cu|h|hpp|hxx|xpu|kps|cmake|yaml|yml|hook)|BUILD|.*\.BUILD|WORKSPACE|CMakeLists\.txt)$
exclude: ^tests/code_library/[code_case|model_case]
- repo: local
hooks:
- id: copyright_checker
name: copyright checker
entry: python ./tools/codestyle/copyright.hook
language: system
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto|xpu|kps|py|sh)$
exclude: ^tests/code_library/[code_case|model_case]
# For Python files
- repo: https://github.com/psf/black.git
rev: 22.8.0
hooks:
- id: black
files: (.*\.py)$
exclude: ^tests/code_library/[code_case|model_case]
- repo: https://github.com/pycqa/isort
rev: 5.11.5
hooks:
- id: isort
exclude: ^tests/code_library/[code_case|model_case]
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
- id: flake8
args: ["--config=.flake8"]
- repo: https://github.com/PyCQA/autoflake
rev: v1.7.7
hooks:
- id: autoflake
args:
- --in-place
- --remove-all-unused-imports
- --ignore-init-module-imports
- --exclude=paconvert/transformer/basic_transformer.py,tests/code_library/code_case/paddle_code/*
# For json files
- repo: local
hooks:
- id: check-json
name: json format check
entry: python ./tools/codestyle/json.hook
language: system
files: \.json$
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-json
files: \.json$