-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
92 lines (84 loc) · 2.79 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
92 lines (84 loc) · 2.79 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
# Pre-commit hooks for Dreame Vacuum integration
# Run locally with prek (https://github.com/j178/prek), a Rust drop-in for
# pre-commit. Hook `rev:` bumps are handled by Renovate; CI enforces the hooks
# via the "Pre-commit (prek)" job in ci.yml.
repos:
# Ruff - Fast Python linter and formatter
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.16.1
hooks:
# Run the linter
- id: ruff-check
args: [--fix, --exit-non-zero-on-fix]
# Run the formatter
- id: ruff-format
# General file checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: end-of-file-fixer
- id: check-yaml
exclude: ^\.github/workflows/
- id: check-json
exclude: (.vscode|.devcontainer)
- id: pretty-format-json
args: ['--autofix', '--no-ensure-ascii']
files: (icons.json|translations/.+\.json$)
- id: check-added-large-files
args: [--maxkb=1000]
# _resources_data.py and _notification_images.py hold large base64
# image blobs shipped with the integration; they are on disk on
# purpose and split further would hurt startup time.
exclude: ^custom_components/dreame_vacuum/dreame/(_resources_data|_notification_images)\.py$
- id: check-case-conflict
- id: check-merge-conflict
- id: check-toml
- id: mixed-line-ending
args: [--fix=lf]
- id: detect-private-key
# Python syntax checks
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa
- id: python-check-blanket-type-ignore
# python-no-eval disabled - legitimate use in map.py for JS optimizer
# - id: python-no-eval
- id: python-use-type-annotations
# Security linter
- repo: https://github.com/PyCQA/bandit
rev: "1.9.4"
hooks:
- id: bandit
args: ["-c", "pyproject.toml"]
additional_dependencies: ["bandit[toml]"]
# Spell checker - uses .codespellrc for configuration
- repo: https://github.com/codespell-project/codespell
rev: v2.4.3
hooks:
- id: codespell
args: ["--config", ".codespellrc"]
# Local hooks
- repo: local
hooks:
- id: remove-co-authored-by
name: Remove Co-Authored-By Claude
entry: bash -c 'if [[ "$OSTYPE" == "darwin"* ]]; then sed -i "" "/Co-Authored-By:.*[Cc]laude/d" "$@"; else sed -i "/Co-Authored-By:.*[Cc]laude/d" "$@"; fi' --
language: system
stages: [commit-msg]
# Global settings
default_language_version:
python: python3
# Exclude certain paths
exclude: |
(?x)^(
\.git/|
\.github/|
__pycache__/|
\.pytest_cache/|
\.venv/|
venv/|
.*\.pyc
)$