-
Notifications
You must be signed in to change notification settings - Fork 1
/
.pre-commit-config.yaml
125 lines (114 loc) · 4.74 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
default_language_version:
python: python3
repos:
#############################################################################
# Misc
#############################################################################
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-merge-conflict # Searches for merge conflict markers within files.
- id: check-added-large-files # Blocks commits that add large files. Default limit is 500kB.
# Can be configured with args, e.g., '--maxkb=1000' to change the limit.
# exclude: 'your_dir/.*'
# args: ['--maxkb=5000']
- id: check-case-conflict # Identifies potential case-insensitive file name conflicts.
- id: check-ast # Validates the syntax of Python files.
- id: check-symlinks # Detects broken symlinks.
- id: trailing-whitespace # Removes any trailing whitespace at the end of lines.
- id: end-of-file-fixer # Ensures files end with a single newline or are empty.
exclude: templates/
#############################################################################
# JSON, TOML
#############################################################################
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-json # Validates JSON files to ensure they are properly formatted and syntactically correct.
types: [json]
- id: check-toml # Checks TOML files for errors and format issues to ensure valid syntax.
types: [toml]
#############################################################################
# Shell
#############################################################################
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0
hooks:
- id: shfmt # Formats shell scripts to a standard convention using shfmt.
- id: shellcheck # Lints shell scripts to identify syntax and usage errors, with a specified severity of 'warning'.
args:
- --severity=warning
#############################################################################
# Python
#############################################################################
- repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
hooks:
- id: autoflake # Removes unused imports and unused variables from Python code.
args:
- --in-place
- --remove-all-unused-imports
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort # Sorts Python imports into sections and by alphabetical order.
args:
- --settings-path
- pyproject.toml
types:
- python
- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
- id: black # Formats Python code to conform to the Black code style.
args:
- --config
- pyproject.toml
types:
- python
exclude: templates/
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8 # Lints Python code for errors and code style issues based on PEP8.
args:
- --config=.ci/flake8.cfg
types:
- python
exclude: templates/
# - repo: https://github.com/astral-sh/ruff-pre-commit
# rev: v0.1.4
# hooks:
# - id: ruff
# - repo: https://github.com/python-poetry/poetry
# rev: '1.7.0'
# hooks:
# - id: poetry-check # Makes sure the poetry configuration does not get committed in a broken state.
# - id: poetry-lock # Ensures the poetry.lock file is up-to-date with the pyproject.toml changes.
#############################################################################
# CSS, Markdown, JavaScript, TypeScript, YAML style formatter
#############################################################################
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier # An opinionated code formatter supporting multiple languages.
name: prettier
args: [--config, .ci/prettier.json, --write]
types_or:
- css
- scss
- ts
- tsx
- javascript
- yaml
- markdown
exclude: templates/.pre-commit-config.yaml|templates/.github/workflows/ci.yaml|templates/base/ci.yaml
#############################################################################
# Rust
#############################################################################
- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
hooks:
- id: fmt # Formats Rust code using rustfmt
- id: cargo-check # Checks Rust code for compilation errors and warnings
- id: clippy # Lints Rust code with clippy for common mistakes and style issues