-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
98 lines (91 loc) · 2.46 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
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
# Basic pre-commit hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
# File checks
- id: check-yaml
- id: check-toml
- id: check-json
- id: check-ast
- id: end-of-file-fixer
- id: trailing-whitespace
# Python-specific
- id: debug-statements
- id: check-docstring-first
- id: requirements-txt-fixer
# Security
- id: detect-private-key
- id: detect-aws-credentials
# Black - Python code formatter
- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
language_version: python3
args: [--line-length=88]
# Ruff - Fast Python linter
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.285
hooks:
- id: ruff
args: [
"--fix",
"--show-source",
"--select=E,F,W,I,N,B,A,C4,SIM,ERA,PD,NPY,DTZ,RUF",
"--ignore=E203,E501",
"--target-version=py38",
"--per-file-ignores=__init__.py:F401"
]
# MyPy - Static type checker
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
hooks:
- id: mypy
additional_dependencies: [types-all]
args: [
"--ignore-missing-imports",
"--disallow-untyped-defs",
"--check-untyped-defs",
"--warn-redundant-casts",
"--warn-unused-ignores",
"--show-error-codes",
"--no-implicit-optional"
]
# Docstring checker
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
args: [
"--convention=numpy",
"--add-ignore=D100,D104"
]
# Check for large files
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
args: ['--maxkb=1000']
# Pytest-check hook - ensure tests pass
- repo: local
hooks:
- id: pytest-check
name: pytest-check
entry: pytest
language: system
pass_filenames: false
always_run: true
args: [
"--disable-warnings",
"-v"
]
# Bandit - security linter
- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
hooks:
- id: bandit
args: ["-c", "pyproject.toml"]
additional_dependencies: ["bandit[toml]"]