forked from pls-rs/pls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
99 lines (87 loc) · 2.14 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
# This repository contains three projects in three languages!
#
# - the main `pls` codebase (Rust) in the root
# - the example generation codebase (Python) in `examples/`
# - the documentation (JavaScript) in `docs/`
default_install_hook_types:
- pre-commit
- pre-push
repos:
# Generic
# =======
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-json
- id: check-shebang-scripts-are-executable
- id: check-symlinks
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: fix-encoding-pragma
args:
- --remove
- id: forbid-submodules
- id: mixed-line-ending
args:
- --fix=auto
- id: trailing-whitespace
args:
- --markdown-linebreak-ext=md
# Rust
# ====
- repo: local
hooks:
- id: fmt
name: fmt
language: system
types:
- file
- rust
entry: cargo fmt
pass_filenames: false
- id: clippy
name: clippy
language: system
types:
- file
- rust
# `-D warnings` ensures that the job fails when encountering warnings.
entry: cargo clippy --all-targets --all-features -- -D warnings
pass_filenames: false
- repo: local
hooks:
- id: unit
name: unit
language: system
types:
- file
- rust
entry: cargo test
pass_filenames: false
stages:
- pre-push
# Python
# ======
# Runs before Black because fixed code might need to be formatted.
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.5
hooks:
# Replaces flake8, isort and pyupgrade
- id: ruff
args:
- --fix
- --exit-non-zero-on-fix
- repo: https://github.com/psf/black
rev: 24.8.0
hooks:
- id: black
# JavaScript
# ==========
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0
hooks:
- id: prettier