-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
60 lines (54 loc) · 1.53 KB
/
.pre-commit-config.yaml
File metadata and controls
60 lines (54 loc) · 1.53 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
# Pre-commit hooks for Python Step by Step book
# Install with: pip install pre-commit && pre-commit install
repos:
# General file checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
exclude: \.md$|\.qmd$ # Markdown may need trailing spaces
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
args: ['--maxkb=1000']
- id: check-case-conflict
- id: check-merge-conflict
- id: mixed-line-ending
args: ['--fix=lf']
# Markdown/Quarto linting
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.37.0
hooks:
- id: markdownlint
args: ['--fix']
files: \.(md|qmd)$
exclude: ^templates/
# Python code quality (for examples)
- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black
language_version: python3
files: \.py$
# YAML formatting
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier
types_or: [yaml, json]
exclude: ^_book/|^_site/
# Check for secrets
- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
hooks:
- id: detect-secrets
args: ['--baseline', '.secrets.baseline']
# Local hooks
- repo: local
hooks:
- id: check-exercises
name: Check exercise format
entry: scripts/check-exercises.sh
language: script
files: \.(qmd)$
pass_filenames: true