-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
90 lines (89 loc) · 2.35 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
---
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
# Filesystem
- id: check-case-conflict
- id: check-symlinks
# Whitespace
- id: trailing-whitespace
- id: end-of-file-fixer
- id: mixed-line-ending
# Syntax
- id: check-merge-conflict
- id: check-executables-have-shebangs
- id: pretty-format-json
args:
- --autofix
- --indent=2
- --no-sort-keys
- id: check-toml
- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
- id: yamllint
args:
- --strict
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-mock-methods
- id: rst-backticks
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/PyCQA/doc8
rev: v1.1.1
hooks:
- id: doc8
args:
- --quiet
- repo: local
hooks:
- id: attrs-apis
name: Use new attrs APIs (@attrs.define, @attrs.frozen, attrs.field())
language: pygrep
entry: >
(?x)(
# Legacy APIs
@attr\.s
|attr\.ib\(
|@attr\.dataclass
# Legacy namespace
|@attr\.define
|@attr\.frozen
|@attr\.mutable
|attr\.field\(
# Use @attrs.define instead
|@attrs\.mutable
)
types: [python]
- id: logging.getLogger
name: Use structlog.get_logger() instead of logging.getLogger()
language: pygrep
entry: logging.getLogger\(
types: [python]
- id: missing-__init__.py
name: missing __init__.py
language: system
types: [python]
entry: >
sh -c '
MISSING=false
for f in $@; do
f="$(dirname ${f})"
if [ ! -f "${f}/__init__.py" ]; then
MISSING=true
echo "ERROR: No __init__.py found for ${f}/";
fi
done
if [ $MISSING == true ]; then
exit 1
fi
'