Skip to content

Commit 46dfa15

Browse files
committed
Add pre-commit
basic layout Signed-off-by: nstarman <[email protected]>
1 parent 2e07238 commit 46dfa15

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

.pre-commit-config.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
4+
hooks:
5+
- id: check-added-large-files
6+
# Prevent giant files from being committed.
7+
- id: check-ast
8+
# Simply check whether files parse as valid python.
9+
- id: check-case-conflict
10+
# Check for files with names that would conflict on a case-insensitive
11+
# filesystem like MacOS HFS+ or Windows FAT.
12+
- id: check-json
13+
# Attempts to load all json files to verify syntax.
14+
- id: check-merge-conflict
15+
# Check for files that contain merge conflict strings.
16+
- id: check-symlinks
17+
# Checks for symlinks which do not point to anything.
18+
- id: check-toml
19+
# Attempts to load all TOML files to verify syntax.
20+
- id: check-xml
21+
# Attempts to load all xml files to verify syntax.
22+
- id: check-yaml
23+
# Attempts to load all yaml files to verify syntax.
24+
exclude: ".*(.github.*)$"
25+
- id: debug-statements
26+
# Check for debugger imports and py37+ breakpoint() calls in python
27+
# source.
28+
- id: detect-private-key
29+
# Checks for the existence of private keys.
30+
- id: end-of-file-fixer
31+
# Makes sure files end in a newline and only a newline.
32+
- id: trailing-whitespace
33+
# Trims trailing whitespace.
34+
exclude_types: [python]
35+
36+
- repo: https://github.com/pre-commit/pygrep-hooks
37+
rev: v1.10.0
38+
hooks:
39+
- id: python-check-mock-methods
40+
# Prevent common mistakes of assert mck.not_called(), assert
41+
# mck.called_once_with(...) and mck.assert_called.
42+
- id: text-unicode-replacement-char
43+
# Forbid files which have a UTF-8 Unicode replacement character.
44+
- id: python-check-blanket-noqa
45+
# Enforce that all noqa annotations always occur with specific codes.
46+
47+
- repo: https://github.com/psf/black-pre-commit-mirror
48+
rev: 23.7.0
49+
hooks:
50+
- id: black

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ doc = [
2929
[build-system]
3030
requires = ["setuptools"]
3131
build-backend = "setuptools.build_meta"
32+
33+
[tool.black]
34+
line-length = 88

0 commit comments

Comments
 (0)