-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
116 lines (105 loc) · 3.64 KB
/
.pre-commit-config.yaml
File metadata and controls
116 lines (105 loc) · 3.64 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
# =============================================================================
# Pre-commit Configuration
# =============================================================================
#
# Git hook scripts to run on every commit.
# Documentation: https://pre-commit.com/
#
# Install:
# pre-commit install
#
# Run on all files:
# pre-commit run --all-files
#
# This file is portable across swing-* repos.
#
# =============================================================================
default_stages: [pre-commit]
default_language_version:
python: python3.12
repos:
# ---------------------------------------------------------------------------
# General Quality Checks
# ---------------------------------------------------------------------------
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-merge-conflict
- id: check-added-large-files
args: ["--maxkb=1000"]
- id: check-case-conflict
- id: check-symlinks
- id: detect-private-key
- id: end-of-file-fixer
exclude: ^(VERSION|.*\.min\..*|.*/static/.*)$
- id: trailing-whitespace
exclude: ^(.*\.min\..*|.*/static/.*)$
- id: mixed-line-ending
args: ["--fix=lf"]
# ---------------------------------------------------------------------------
# Data File Validation
# ---------------------------------------------------------------------------
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-json
exclude: ^(\.vscode/|tsconfig.*\.json$)
- id: check-yaml
args: ["--unsafe"]
- id: check-toml
# ---------------------------------------------------------------------------
# Python - Code Formatting
# ---------------------------------------------------------------------------
- repo: https://github.com/asottile/add-trailing-comma
rev: v3.1.0
hooks:
- id: add-trailing-comma
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
language_version: python3.12
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
args: ["--profile", "black"]
# ---------------------------------------------------------------------------
# Python - Linting
# ---------------------------------------------------------------------------
- repo: https://github.com/pycqa/flake8
rev: 7.1.1
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-comprehensions
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa
- id: python-check-blanket-type-ignore
- id: python-no-eval
- id: python-use-type-annotations
# ---------------------------------------------------------------------------
# HTML / Jinja Templates
# ---------------------------------------------------------------------------
- repo: https://github.com/djlint/djLint
rev: v1.36.4
hooks:
- id: djlint-reformat-django
files: \.(html|jinja|jinja2)$
exclude: (node_modules|\.venv|htmlcov|site|dist|build)/
- id: djlint-django
files: \.(html|jinja|jinja2)$
exclude: (node_modules|\.venv|htmlcov|site|dist|build)/
# ---------------------------------------------------------------------------
# Security
# ---------------------------------------------------------------------------
- repo: https://github.com/PyCQA/bandit
rev: 1.8.3
hooks:
- id: bandit
args: ["-c", "pyproject.toml", "-r"]
additional_dependencies: ["bandit[toml]"]
exclude: ^(tst/|tests/)