-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
110 lines (99 loc) · 2.85 KB
/
.pre-commit-config.yaml
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
---
ci:
autoupdate_schedule: quarterly
skip: [poetry-lock, sourcery, pylint, pytest, coverage-badge]
repos:
- repo: meta
hooks:
- id: identity
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: no-commit-to-branch
name: Don't allow commits to the main branch
args: ["--branch", "main"]
- id: trailing-whitespace
name: Remove trailing whitespace
- id: end-of-file-fixer
name: Ensure files end with a newline character
- id: mixed-line-ending
name: Align mixed line ending
- id: check-added-large-files
name: Check for large files
- id: check-json
name: Check JSON files are valid and parseable
- id: check-yaml
name: Check YAML files are valid and parseable
- id: check-toml
name: Check TOML files are valid and parseable
- id: check-ast
name: Validate Python
- repo: https://github.com/python-poetry/poetry
rev: 1.8.0
hooks:
- id: poetry-check
name: Check that the Poetry configuration is valid
- id: poetry-lock
name: Check that the lock file is up-to-date
# Formatting
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
name: Make code pretty
- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
hooks:
- id: pyupgrade
args: [--py38-plus]
name: Align Python code to latest syntax
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
name: Check Python formatting
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: Sort Python import statements
args: ["--filter-files"]
- repo: https://github.com/hadialqattan/pycln
rev: v2.4.0
hooks:
- id: pycln
name: Remove unused imports and variables
args: [--config=pyproject.toml]
# Sourcery (refactoring)
- repo: https://github.com/sourcery-ai/sourcery
rev: v1.23.0
hooks:
- id: sourcery
name: Check for refactoring opportunities
args: [--diff=git diff HEAD, --no-summary]
files: drawings
exclude: \.*/__init__\.py
# Final linting
- repo: local
hooks:
- id: pylint
name: Lint Python code with pylint
entry: pylint
language: system
types: [python]
args: ["-rn", "--rcfile=pyproject.toml"]
# Testing and coverage
- repo: local
hooks:
- id: pytest
name: Run unit tests
entry: pytest tests --quiet
language: system
pass_filenames: false
always_run: true
- id: coverage-badge
name: Generate coverage badge
entry: coverage-badge -o coverage.svg -f
language: system
pass_filenames: false
always_run: true