Skip to content

Commit 2df9948

Browse files
authored
Merge pull request #166 from pre-commit/pre_commit_hooks_yaml
Add .pre-commit-hooks.yaml for forward compatibility
2 parents 6f21fdf + 7752c42 commit 2df9948

2 files changed

Lines changed: 156 additions & 0 deletions

File tree

.pre-commit-hooks.yaml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
- id: autopep8-wrapper
2+
name: autopep8 wrapper
3+
description: "Runs autopep8 over python source. If you configure additional arguments you'll want to at least include -i."
4+
entry: autopep8-wrapper
5+
language: python
6+
files: \.py$
7+
args: [-i]
8+
- id: check-added-large-files
9+
name: Check for added large files
10+
description: Prevent giant files from being committed
11+
entry: check-added-large-files
12+
language: python
13+
# Match all files
14+
files: ''
15+
- id: check-ast
16+
name: Check python ast
17+
description: Simply check whether the files parse as valid python.
18+
entry: check-ast
19+
language: python
20+
files: '\.py$'
21+
- id: check-byte-order-marker
22+
name: Check for byte-order marker
23+
description: Forbid files which have a UTF-8 byte-order marker
24+
entry: check-byte-order-marker
25+
language: python
26+
files: '\.py$'
27+
- id: check-case-conflict
28+
name: Check for case conflicts
29+
description: Check for files that would conflict in case-insensitive filesystems
30+
entry: check-case-conflict
31+
language: python
32+
# Match all files
33+
files: ''
34+
- id: check-docstring-first
35+
name: Check docstring is first
36+
description: Checks a common error of defining a docstring after code.
37+
entry: check-docstring-first
38+
language: python
39+
files: \.py$
40+
- id: check-json
41+
name: Check JSON
42+
description: This hook checks json files for parseable syntax.
43+
entry: check-json
44+
language: python
45+
files: \.json$
46+
- id: pretty-format-json
47+
name: Pretty format JSON
48+
description: This hook sets a standard for formatting JSON files.
49+
entry: pretty-format-json
50+
language: python
51+
files: \.json$
52+
- id: check-merge-conflict
53+
name: Check for merge conflicts
54+
description: Check for files that contain merge conflict strings.
55+
entry: check-merge-conflict
56+
language: python
57+
# Match all files
58+
files: ''
59+
- id: check-symlinks
60+
name: Check for broken symlinks
61+
description: Checks for symlinks which do not point to anything.
62+
entry: check-symlinks
63+
language: python
64+
# Match all files
65+
files: ''
66+
- id: check-xml
67+
name: Check Xml
68+
description: This hook checks xml files for parseable syntax.
69+
entry: check-xml
70+
language: python
71+
files: \.xml$
72+
- id: check-yaml
73+
name: Check Yaml
74+
description: This hook checks yaml files for parseable syntax.
75+
entry: check-yaml
76+
language: python
77+
files: \.(yaml|yml|eyaml)$
78+
- id: debug-statements
79+
name: Debug Statements (Python)
80+
description: This hook checks that debug statements (pdb, ipdb, pudb) are not imported on commit.
81+
entry: debug-statement-hook
82+
language: python
83+
files: \.py$
84+
- id: detect-aws-credentials
85+
name: Detect AWS Credentials
86+
description: Detects *your* aws credentials from the aws cli credentials file
87+
entry: detect-aws-credentials
88+
language: python
89+
files: ''
90+
- id: detect-private-key
91+
name: Detect Private Key
92+
description: Detects the presence of private keys
93+
entry: detect-private-key
94+
language: python
95+
files: ''
96+
- id: double-quote-string-fixer
97+
name: Fix double quoted strings
98+
description: This hook replaces double quoted strings with single quoted strings
99+
entry: double-quote-string-fixer
100+
language: python
101+
files: \.py$
102+
- id: end-of-file-fixer
103+
name: Fix End of Files
104+
description: Ensures that a file is either empty, or ends with one newline.
105+
entry: end-of-file-fixer
106+
language: python
107+
files: \.(asciidoc|adoc|coffee|cpp|css|c|ejs|erb|groovy|h|haml|hh|hpp|hxx|html|in|j2|jade|json|js|less|markdown|md|ml|mli|pp|py|rb|rs|R|scala|scss|sh|slim|tex|tmpl|ts|txt|yaml|yml)$
108+
- id: fix-encoding-pragma
109+
name: Fix python encoding pragma
110+
language: python
111+
entry: fix-encoding-pragma
112+
description: 'Add # -*- coding: utf-8 -*- to the top of python files'
113+
files: \.py$
114+
- id: flake8
115+
name: Flake8
116+
description: This hook runs flake8.
117+
entry: flake8
118+
language: python
119+
files: \.py$
120+
- id: forbid-new-submodules
121+
name: Forbid new submodules
122+
language: python
123+
entry: forbid-new-submodules
124+
description: Prevent addition of new git submodules
125+
files: ''
126+
- id: name-tests-test
127+
name: Tests should end in _test.py
128+
description: This verifies that test files are named correctly
129+
entry: name-tests-test
130+
language: python
131+
files: tests/.+\.py$
132+
- id: pyflakes
133+
name: Pyflakes (DEPRECATED, use flake8)
134+
description: This hook runs pyflakes. (This is deprecated, use flake8).
135+
entry: pyflakes
136+
language: python
137+
files: \.py$
138+
- id: requirements-txt-fixer
139+
name: Fix requirements.txt
140+
description: Sorts entries in requirements.txt
141+
entry: requirements-txt-fixer
142+
language: python
143+
files: requirements.*\.txt$
144+
- id: trailing-whitespace
145+
name: Trim Trailing Whitespace
146+
description: This hook trims trailing whitespace.
147+
entry: trailing-whitespace-fixer
148+
language: python
149+
files: \.(asciidoc|adoc|coffee|cpp|css|c|ejs|erb|groovy|h|haml|hh|hpp|hxx|html|in|j2|jade|json|js|less|markdown|md|ml|mli|pp|py|rb|rs|R|scala|scss|sh|slim|tex|tmpl|ts|txt|yaml|yml)$

tests/meta_test.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import io
2+
3+
4+
def test_hooks_yaml_same_contents():
5+
legacy_contents = io.open('hooks.yaml').read()
6+
contents = io.open('.pre-commit-hooks.yaml').read()
7+
assert legacy_contents == contents

0 commit comments

Comments
 (0)