-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.pre-commit-config.yaml
66 lines (60 loc) · 2.24 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
minimum_pre_commit_version: 4.0.0
define: &generated_doc_files "^docs/(cc_info_mapping|dwyu_aspect).md"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
# Repository hygiene
- id: check-added-large-files
# Sane files
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: check-toml
- id: check-json
# Code style
- id: end-of-file-fixer
exclude: *generated_doc_files
- id: trailing-whitespace
# Python code quality
- id: debug-statements
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.21
hooks:
- id: mdformat
exclude: *generated_doc_files
additional_dependencies:
- mdformat-gfm
# Ground truth for available checks: https://github.com/bazelbuild/buildtools/blob/main/warn/warn.go
# Documentation for checks: https://github.com/bazelbuild/buildtools/blob/main/WARNINGS.md?plain=1
# An example config file can be generated with command 'buildifier --config=example'
# We use all checks, even non default ones with those exceptions:
# - function-docstring: Not all functions require a docstring. If a docstring exists other checks ensure its sanity.
# - function-docstring-header: A dedicated docstring header often provides no added value.
# - module-docstring: Too noisy, not all modules require a docstring
# - naive-<some_language>: The auto fix uses the deprecated defs.bzl approach
- repo: https://github.com/keith/pre-commit-buildifier
rev: 7.3.1
hooks:
- id: buildifier
args: [ "--config=.buildifier.json" ]
- id: buildifier-lint
args: [
"--diff_command='diff'",
"--config=.buildifier.json",
]
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.8.4
hooks:
- id: ruff-format
# Linting
- id: ruff
args: [ --fix ]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.1
hooks:
# We require separate instances due to several files being named the same which mypy cannot handle
- id: mypy
name: "mypy"
# We overwrite the args as we configure mypy via our mypy.ini
args: [ ]