forked from rlworkgroup/garage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
105 lines (104 loc) · 5.19 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
fail_fast: false # set to true to have pre-commit stop running hooks after the first failure.
repos:
- repo: local
hooks:
- id: check-commit-message
name: Check commit message
language: script
entry: scripts/check_commit_message
stages: [commit-msg]
- id: check-flake8
name: Check Flake8
language: script
entry: scripts/travisci/check_flake8.sh
stages: [commit, push]
- id: pylint
name: pylint
entry: pylint
args: ['-j 0', '--rcfile=setup.cfg']
stages: [commit, push]
language: system
files: \.py$
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.3.0
# https://github.com/pre-commit/pre-commit-hooks/blob/master/README.md
stages: [commit, push]
hooks:
# - id: autopep8-wrapper # Runs autopep8 over python source.
# stages: [commit, push]
- id: check-added-large-files # Prevent giant files from being committed.
stages: [commit, push]
- id: check-ast # Simply check whether files parse as valid python.
stages: [commit, push]
# - id: check-builtin-literals # Require literal syntax when initializing empty or zero Python builtin types.
# stages: [commit, push]
- id: check-byte-order-marker # Forbid files which have a UTF-8 byte-order marker
stages: [commit, push]
# - id: check-case-conflict # Check for files with names that would conflict on a case-insensitive filesystem
# stages: [commit, push]
- id: check-docstring-first # Checks for a common error of placing code before the docstring.
stages: [commit, push]
- id: check-executables-have-shebangs # Checks that non-binary executables have a proper shebang.
stages: [commit, push]
- id: check-json # Attempts to load all json files to verify syntax.
stages: [commit, push]
- id: check-merge-conflict # Check for files that contain merge conflict strings.
stages: [commit, push]
- id: check-symlinks # Checks for symlinks which do not point to anything.
stages: [commit, push]
- id: check-vcs-permalinks # Ensures that links to vcs websites are permalinks.
stages: [commit, push]
- id: check-xml # Attempts to load all xml files to verify syntax.
stages: [commit, push]
- id: check-yaml # Attempts to load all yaml files to verify syntax.
stages: [commit, push]
- id: debug-statements # Check for debugger imports and py37+ breakpoint() calls in python source.
stages: [commit, push]
# - id: detect-aws-credentials # Checks for the existence of AWS secrets that you have set up with the AWS CLI
# stages: [commit, push]
- id: detect-private-key # Checks for the existence of private keys.
stages: [commit, push]
# - id: double-quote-string-fixer # This hook replaces double quoted strings with single quoted strings.
# stages: [commit, push]
- id: end-of-file-fixer # Makes sure files end in a newline and only a newline.
stages: [commit, push]
# - id: fix-encoding-pragma # Add # -*- coding: utf-8 -*- to the top of python files.
# stages: [commit, push]
# - id: file-contents-sorter # Sort the lines in specified files (defaults to alphabetical). You must provide list of target files as input to it.
# stages: [commit, push]
# - id: flake8 # Run flake8 on your python files.
# stages: [commit, push]
- id: forbid-new-submodules # Prevent addition of new git submodules.
stages: [commit, push]
- id: mixed-line-ending # Replaces or checks mixed line ending.
stages: [commit, push]
# - id: name-tests-test # Assert that files in tests/ end in _test.py
# stages: [commit, push]
# - id: no-commit-to-branch # Protect specific branches from direct checkins.
# stages: [commit, push]
# - id: pyflakes # Run pyflakes on your python files.
# stages: [commit, push]
- id: pretty-format-json # Checks that all your JSON files have keys that are sorted and indented.
stages: [commit, push]
# - id: requirements-txt-fixer # Sorts entries in requirements.txt, removes 0.0.0 entries
# stages: [commit, push]
# - id: sort-simple-yaml # Sorts simple YAML files which consist only of top-level keys, preserving comments and blocks.
# stages: [commit, push]
- id: trailing-whitespace # Trims trailing whitespace.
stages: [commit, push]
# First pass: check format
- repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.25.0
hooks:
- id: yapf
name: Check format by yapf
args: ['-dpr']
stages: [commit, push]
# Second pass: format in-place
- repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.25.0
hooks:
- id: yapf
name: Format in-place by yapf
args: ['-ipr']
stages: [commit, push]