Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
122 lines (109 loc) · 3.54 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
122 lines (109 loc) · 3.54 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
# Pre-commit hooks for VideoAnnotator
# Install with: pre-commit install
# Exclude tokens directory (contains encrypted blobs / non-JSON-safe data)
# viewer_static: vendored build output, never hand-edited. viewer/: TypeScript, checked by its own
# lint/typecheck (these hooks are Python-oriented and reject its JSONC tsconfig files).
exclude: ^(tokens/|src/videoannotator/viewer_static/|viewer/)
repos:
# Built-in hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
args: ["--maxkb=10000"]
- id: check-json
- id: check-toml
- id: check-xml
- id: check-merge-conflict
- id: debug-statements
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: mixed-line-ending
- id: check-case-conflict
- id: check-docstring-first
- id: check-ast
- id: fix-byte-order-marker
# Python linting and formatting with Ruff (replaces Black, isort, flake8)
- repo: https://github.com/astral-sh/ruff-pre-commit
# Pinned to a known-good stable release for reproducibility.
rev: v0.16.9
hooks:
- id: ruff
args: [--fix]
exclude: ^tests/
- id: ruff-format
# Type checking
# Same command, version and config as CI (the mirrors-mypy hook checked a
# fraction of the package with an old mypy and missed errors CI caught).
- repo: local
hooks:
- id: mypy
name: mypy
entry: uv run --no-sync mypy src/videoannotator
language: system
types: [python]
files: ^src/videoannotator/
pass_filenames: false
# Security scanning
- repo: https://github.com/PyCQA/bandit
rev: 1.9.4
hooks:
- id: bandit
args: [-r, src, -f, json]
pass_filenames: false
exclude: tests/
additional_dependencies: [pbr]
stages: [manual]
# Shell script linting
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.11.0.1
hooks:
- id: shellcheck
files: ^scripts/
stages: [manual]
# The launcher runs on researchers' machines: checked on every commit.
- id: shellcheck
name: shellcheck (launcher)
files: ^launcher/(videoannotator-start|install\.sh)$
# Launcher behaviour, from tests/launcher/cases.json (needs bats and jq)
- repo: local
hooks:
- id: bats-launcher
name: bats (launcher)
entry: bats tests/launcher
language: system
pass_filenames: false
files: ^(launcher/|tests/launcher/)
# Dockerfile linting
- repo: https://github.com/hadolint/hadolint
rev: v2.15.1
hooks:
- id: hadolint
args: [--ignore, DL3008, --ignore, DL3009]
# Python dependency security
- repo: https://github.com/Lucas-C/pre-commit-hooks-safety
rev: v1.4.2
hooks:
- id: python-safety-dependencies-check
stages: [manual]
# Git commit message linting
- repo: https://github.com/commitizen-tools/commitizen
rev: v4.19.0
hooks:
- id: commitizen
stages: [commit-msg]
# Note: autoflake functionality now handled by ruff --fix
# Configuration for specific hooks
ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit hooks
for more information, see https://pre-commit.ci
autofix_prs: true
autoupdate_branch: ""
autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate"
autoupdate_schedule: weekly
skip: []
submodules: false