Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
134 lines (117 loc) · 4.05 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
134 lines (117 loc) · 4.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
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
123
124
125
126
127
128
129
130
131
132
133
134
# Pre-commit hooks para ejecutar checks localmente antes de push
# Instalación: pip install pre-commit && pre-commit install
#
# Uso:
# - Automático: Se ejecuta en cada git commit
# - Manual: pre-commit run --all-files
#
# Para saltar hooks (emergencias): git commit --no-verify
repos:
# ============================================================================
# HOOKS BÁSICOS DE CALIDAD
# ============================================================================
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
# Evitar commits directos a main
- id: no-commit-to-branch
args: ['--branch', 'main', '--branch', 'master']
# Detectar archivos grandes (>500KB)
- id: check-added-large-files
args: ['--maxkb=500']
# Verificar que archivos terminen con newline
- id: end-of-file-fixer
# Remover whitespace al final de líneas
- id: trailing-whitespace
# Verificar sintaxis YAML
- id: check-yaml
args: ['--unsafe'] # Permite tags de Docker Compose
# Verificar sintaxis JSON
- id: check-json
# Detectar merge conflict markers
- id: check-merge-conflict
# Verificar que scripts tengan shebang
- id: check-shebang-scripts-are-executable
# Detectar private keys
- id: detect-private-key
# Verificar formato de archivos Docker Compose
- id: check-yaml
files: docker-compose.*\.yml$
# ============================================================================
# SEGURIDAD - DETECCIÓN DE SECRETOS
# ============================================================================
- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
hooks:
- id: detect-secrets
args:
- '--baseline'
- '.secrets.baseline'
exclude: |
(?x)^(
\.env\.example|
\.pre-commit-config\.yaml|
package-lock\.json|
.*\.lock
)$
# ============================================================================
# PYTHON - FORMATEO Y LINTING
# ============================================================================
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
language_version: python3.13
- repo: https://github.com/pycqa/flake8
rev: 7.1.1
hooks:
- id: flake8
args:
- '--max-line-length=127'
- '--extend-ignore=E203,W503'
exclude: |
(?x)^(
.*/__pycache__/.*|
.*/.venv/.*|
.*/.pytest_cache/.*
)$
- repo: https://github.com/pycqa/bandit
rev: 1.7.10
hooks:
- id: bandit
args: ['-ll', '-i'] # Low severity, ignore nosec comments
files: \.py$
exclude: |
(?x)^(
.*/tests/.*|
.*/test_.*\.py
)$
# ============================================================================
# DOCKER - LINTING
# ============================================================================
- repo: https://github.com/hadolint/hadolint
rev: v2.12.0
hooks:
- id: hadolint-docker
args: ['--ignore', 'DL3008', '--ignore', 'DL3009']
# ============================================================================
# PYTHON - IMPORTS Y TYPE CHECKING
# ============================================================================
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
args: ['--profile', 'black']
# ============================================================================
# MARKDOWN Y DOCUMENTACIÓN
# ============================================================================
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
types_or: [markdown, yaml, json]
exclude: |
(?x)^(
CHANGELOG\.md|
.*\.min\.json
)$