forked from SciPhi-AI/R2R
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
124 lines (112 loc) · 3.92 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
124 lines (112 loc) · 3.92 KB
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
exclude: ^.venv/
- id: end-of-file-fixer
exclude: ^.venv/
- id: check-added-large-files
exclude: ^.venv/
- id: check-ast
exclude: ^.venv/
- id: check-yaml
args: [--allow-multiple-documents]
exclude: ^(.venv/|deployment/)
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
types_or: [markdown, javascript, jsx, ts, tsx, json, yaml]
args: ["--prose-wrap", "always", "--print-width", "80"]
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.48.0
hooks:
- id: markdownlint
args: ["--fix"]
files: \.md$
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.11.0.1
hooks:
- id: shellcheck
args: ["-x"]
- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.13.1-1
hooks:
- id: shfmt
args: ["-w", "-s", "-i", "2"]
- repo: local
hooks:
- id: check-typing-imports
name: Check for Dict, List, or Union usage
entry:
bash -c 'echo "Checking for typing imports..." && FOUND=$(cd "$(git
rev-parse --show-toplevel)" && find . -path "*/py/*.py" | grep -v
"venv" | grep -v "/.venv/" | grep -v "/site-packages/" | grep -v
"test_" | grep -v "/migrations/" | xargs grep -l "from
typing.*import.*[^d]Dict\|from typing.*import.*List\|from
typing.*import.*Union" 2>/dev/null || echo "") && if [ -n "$FOUND" ];
then echo "$FOUND"; echo " Please import dict instead of Dict, list
instead of List, and the logical OR operator"; exit 1; else echo "No
problematic imports found!"; exit 0; fi'
language: system
types: [python]
pass_filenames: false
- repo: local
hooks:
- id: check-print-statements
name: Check for print statements
entry:
bash -c 'echo "Checking for print statements..." && FOUND=$(cd "$(git
rev-parse --show-toplevel)" && find . -path "*/py/*.py" | grep -v
"venv" | grep -v "/.venv/" | grep -v "/site-packages/" | grep -v
"test_" | grep -v "/core/examples/" | grep -v "/migrations/" | grep -v
"/tests/" | grep -v "/examples.py" | xargs grep -l "print("
2>/dev/null || echo "") && if [ -n "$FOUND" ]; then echo "$FOUND";
echo "Found print statements!"; exit 1; else echo "No print statements
found!"; exit 0; fi'
language: system
types: [python]
pass_filenames: false
exclude: ^(.venv/|py/.venv/|py/core/examples/|py/migrations/|py/tests/)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.10
hooks:
- id: ruff
args: [--fix]
files: ^py/
exclude: ^(py/tests/|.venv/)
- id: ruff-format
files: ^py/
exclude: ^(py/tests/|.venv/)
- repo: local
hooks:
- id: mypy
name: mypy
entry:
bash -c 'cd "$(git rev-parse --show-toplevel)/py" && python -m mypy
--exclude "migrations" --exclude "venv*" --exclude "test_*" .'
language: system
types: [python]
pass_filenames: false
exclude: ^(.venv/|migrations/)
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v4.4.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: [] # Add extra types if needed: ["feat", "fix", "chore", "docs", "refactor", "test", "ci", "perf", "style"]
- repo: https://github.com/gitleaks/gitleaks
rev: v8.21.2
hooks:
- id: gitleaks
- repo: https://github.com/rhysd/actionlint
rev: v1.7.12
hooks:
- id: actionlint
- repo: https://github.com/PyCQA/bandit
rev: 1.7.8
hooks:
- id: bandit
args: ["-ll", "-i"]
files: ^py/