-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
105 lines (95 loc) · 2.95 KB
/
.pre-commit-config.yaml
File metadata and controls
105 lines (95 loc) · 2.95 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
# Pre-commit hooks for LabLink
# Install: pip install pre-commit && pre-commit install
# Run manually: pre-commit run --all-files
repos:
# Code formatting
- repo: https://github.com/psf/black
rev: 24.1.1
hooks:
- id: black
name: Format code with black
language_version: python3.11
args: ['--line-length=127']
# Import sorting
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
name: Sort imports with isort
args: ['--profile', 'black', '--line-length', '127']
# Linting
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
name: Lint with flake8
args: ['--max-line-length=127', '--extend-ignore=E203,W503', '--max-complexity=15']
additional_dependencies: [flake8-docstrings, flake8-bugbear]
# Security scanning
- repo: https://github.com/PyCQA/bandit
rev: 1.7.6
hooks:
- id: bandit
name: Security scan with bandit
args: ['-r', 'server/', 'client/', '-ll', '--skip', 'B608,B101']
exclude: 'tests/'
# General file checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
name: Trim trailing whitespace
- id: end-of-file-fixer
name: Fix end of files
- id: check-yaml
name: Check YAML syntax
- id: check-json
name: Check JSON syntax
- id: check-toml
name: Check TOML syntax
- id: check-added-large-files
name: Check for large files
args: ['--maxkb=1000']
- id: check-case-conflict
name: Check for case conflicts
- id: check-merge-conflict
name: Check for merge conflicts
- id: debug-statements
name: Check for debug statements
- id: mixed-line-ending
name: Check for mixed line endings
# Python-specific checks
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa
name: Check for blanket noqa
- id: python-check-mock-methods
name: Check mock methods
- id: python-no-eval
name: Check for eval usage
- id: python-no-log-warn
name: Check for log.warn usage
# Type checking (optional, can be slow)
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
name: Type check with mypy
args: ['--ignore-missing-imports', '--no-strict-optional']
additional_dependencies: [types-requests, types-PyYAML]
exclude: 'tests/'
# Configuration
default_language_version:
python: python3.11
# Run specific hooks in specific stages
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