-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
114 lines (107 loc) · 3.09 KB
/
.pre-commit-config.yaml
File metadata and controls
114 lines (107 loc) · 3.09 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
# prek (Rust version of the Python based pre-commit) is a tool to perform a
# predefined set of tasks manually and/or automatically before git commits are
# made.
#
# We require prek specifically, since we want support for rust based hooks.
#
# pre-commit reference: https://pre-commit.com/#pre-commit-configyaml---top-level
# prek reference: https://prek.j178.dev/configuration/
#
# Common tasks
#
# - Run once on all files: prek run -a
# - Register git hooks: prek install
#
# FIXME: transition to a prek official config as we now require prek
# FIXME: ensure hooks gets updated over time automatically
#
repos:
# Autoformat: markdown, yaml, json, js
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.8.1
hooks:
- id: prettier
exclude: |-
(?x)(
stdlib_assets/|
\.lock
)
# Autoformat: Ensure SPDX license and copyright headers
- repo: local
hooks:
- id: reuse-annotate
name: reuse annotate
language: system
entry: uv tool run reuse annotate
args:
- --license=MIT OR Apache-2.0
- --copyright=Sysand contributors <opensource@sensmetry.com>
- --copyright-prefix=spdx-symbol
- --template=compact
- --skip-existing
types_or: [rust, python, java, groovy, shell, xml, javascript]
# Autoformat: rust
- repo: local
hooks:
- id: cargo-fmt
name: cargo fmt
entry: cargo fmt
description: Formats all bin and lib files of the current workspace using rustfmt.
language: rust
types: [rust]
args: ["--"]
- id: cargo-clippy
name: cargo clippy
entry: cargo clippy
description: Checks all packages in the workspace to catch common mistakes and improve your Rust code.
language: rust
types: [rust]
args:
- --workspace
- --all-targets
- --all-features
- --allow-dirty
- --fix
- --
- --deny
- warnings
pass_filenames: false
# Autoformat: python
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.4
hooks:
- id: ruff-check
args: [--fix]
- id: ruff-format
# Lint: python type checking
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.20.0
hooks:
- id: mypy
args:
- --strict
# lint only what is known to use typings
files: |-
(?x)^(
bindings/py/python/|
bindings/java/scripts/
)
# Lint: javascript
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v10.1.0
hooks:
- id: eslint
files: ^bindings/js/
types: [javascript]
additional_dependencies:
- eslint@^10.1.0
- "@eslint/js@^10.0.1"
- globals@^17.4.0
# Security: github actions security checks
- repo: https://github.com/zizmorcore/zizmor-pre-commit
rev: v1.23.1
hooks:
- id: zizmor
args:
- --fix=safe
# - --fix=all # fix more things with a manual review