Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
executable file
·82 lines (75 loc) · 3.05 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
executable file
·82 lines (75 loc) · 3.05 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
repos:
# ===================================================================
# ruff — Python linter + formatter (replaces flake8, black, isort)
# ===================================================================
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
hooks:
- id: ruff
args: [--fix, --config=ruff.toml]
files: ^(src|packages|app|tests|scripts)/.*\.py$
exclude: ^(packages/omniparse|packages/omni-ocr)/
- id: ruff-format
args: [--config=ruff.toml]
files: ^(src|packages|app|tests|scripts)/.*\.py$
exclude: ^(packages/omniparse|packages/omni-ocr)/
# ===================================================================
# Standard pre-commit hooks
# ===================================================================
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
exclude: \.(png|jpg|jpeg|gif|svg|ico)$
- id: end-of-file-fixer
exclude: \.(png|jpg|jpeg|gif|svg|ico)$
- id: check-yaml
args: [--unsafe]
- id: check-json
- id: check-toml
- id: check-added-large-files
args: [--maxkb=500]
- id: check-merge-conflict
- id: check-case-conflict
- id: detect-private-key
- id: check-executables-have-shebangs
- id: no-commit-to-branch
args: [--branch, main, --branch, develop]
# ===================================================================
# Security: detect secrets
# ===================================================================
- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
hooks:
- id: detect-secrets
args: [--baseline, .secrets.baseline, --exclude-files, '.*/samples/.*']
exclude: package-lock\.json
# ===================================================================
# Security: bandit (Python security linter)
# ===================================================================
- repo: https://github.com/PyCQA/bandit
rev: 1.8.0
hooks:
- id: bandit
args: [-ll, -x, tests, packages/omniparse, packages/omni-ocr]
additional_dependencies: ["bandit[toml]"]
# ===================================================================
# Docstring enforcement (optional — enable incrementally)
# ===================================================================
# - repo: https://github.com/pycqa/pydocstyle
# rev: 6.3.0
# hooks:
# - id: pydocstyle
# args: [--convention=pep257, --add-ignore=D100,D104,D105,D107]
# files: ^(src|packages|app)/.*\.py$
# exclude: ^(packages/omniparse|packages/omni-ocr)/
# ===================================================================
# Global settings
# ===================================================================
ci:
autoupdate_schedule: weekly
skip: [bandit] # bandit is slow; run in CI only
autofix_commit_msg: "style: auto-fix by pre-commit hooks"
fail_fast: false
default_stages: [pre-commit, pre-push]
minimum_pre_commit_version: "3.0.0"