Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
178 lines (163 loc) · 5.61 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
178 lines (163 loc) · 5.61 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
default_stages: [pre-commit]
default_install_hook_types: [pre-commit, commit-msg]
exclude: (dimos/models/.*)|(deprecated)
repos:
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.5
hooks:
- id: insert-license
files: \.py$
exclude: (__init__\.py$)|(dimos/rxpy_backpressure/)
args:
# use if you want to remove licences from all files
# (for globally changing wording or something)
#- --remove-header
- --license-filepath
- assets/license_file_header.txt
- --use-current-year
- id: insert-license
name: insert-license (rust)
files: \.rs$
exclude: /vendor/
types: [rust]
args:
- --license-filepath
- assets/license_file_header.txt
- --comment-style
- "//"
- --use-current-year
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.3
hooks:
- id: ruff-format
stages: [pre-commit]
- id: ruff-check
args: [--fix, --unsafe-fixes]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-case-conflict
- id: trailing-whitespace
language: python
types: [text]
exclude: \.patch$ # patch files contain intentional trailing whitespace
- id: end-of-file-fixer
exclude: \.patch$ # keep patch files byte-identical to upstream diffs
- id: mixed-line-ending
args: [--fix=lf]
exclude: \.patch$ # keep patch files byte-identical to upstream diffs
- id: check-json
exclude: ^misc/DimSim/public/sims/ # LFS-tracked
- id: check-toml
- id: check-yaml
# mkdocs-material configures extensions with !!python/name: tags,
# which pyyaml's safe loader refuses to construct.
exclude: ^mkdocs\.yml$
- id: pretty-format-json
name: format json
args: [ --autofix, --no-sort-keys ]
# misc/DimSim/public/sims/ is LFS-tracked; web/ JSON is owned by `deno fmt`
exclude: ^(misc/DimSim/public/sims/|web/)
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 3.4.1
hooks:
- id: editorconfig-checker
alias: ec
args: [-disable-max-line-length, -disable-indentation]
# - repo: local
# hooks:
# - id: mypy
# name: Type check
# # possible to also run within the dev image
# #entry: "./bin/dev mypy"
# entry: "./bin/mypy"
# language: python
# additional_dependencies: ["mypy==1.15.0", "numpy>=1.26.4,<2.0.0"]
# types: [python]
- repo: local
hooks:
- id: uv-lock-check
name: Check uv.lock is up-to-date
entry: uv lock --check
language: system
files: ^pyproject\.toml$
pass_filenames: false
- id: lfs_check
name: LFS data
always_run: true
pass_filenames: false
entry: bin/hooks/lfs_check
language: script
- id: largefiles-check
name: Large files check
always_run: true
pass_filenames: false
entry: python bin/hooks/largefiles_check
args: [--all]
language: python
additional_dependencies: ['tomli']
- id: branch-name
name: Branch name
always_run: true
pass_filenames: false
entry: bin/hooks/branch_name_check
language: script
- id: emdash-check
name: No em dashes in docs
entry: bin/hooks/emdash_check
language: script
files: ^docs/.*\.mdx?$
exclude: ^docs/node_modules/
- id: doclinks
name: Doclinks
always_run: true
pass_filenames: false
entry: python -m dimos.cli.doclinks docs/
language: system
files: ^docs/.*\.md$
exclude: ^docs/node_modules/
- id: filter-commit-message
name: Filter generated signatures from commit message
entry: python -m dimos.utils.commit_message
language: python
stages: [commit-msg]
- id: cargo-fmt
name: cargo fmt
entry: |
bash -c '
set -euo pipefail
git ls-files "*Cargo.toml" | while read -r m; do
cargo locate-project --manifest-path "$m" --workspace --message-format plain
done | sort -u | while read -r root; do
cargo fmt --manifest-path "$root" --all
done
'
language: system
types: [rust]
pass_filenames: false
# Off: minutes per rust commit, and it breaks on toolchain skew (E0514); CI clippies the root workspace.
# - id: cargo-clippy
# name: cargo clippy
# entry: |
# bash -c '
# set -euo pipefail
# git ls-files "*Cargo.toml" | while read -r m; do
# cargo locate-project --manifest-path "$m" --workspace --message-format plain
# done | sort -u | while read -r root; do
# # A crate with its own flake carries system deps the root shell lacks.
# if [ -f "$(dirname "$root")/flake.nix" ]; then
# nix develop "$(dirname "$root")" -c cargo clippy --manifest-path "$root" --workspace --all-targets -- -D warnings
# else
# cargo clippy --manifest-path "$root" --workspace --all-targets -- -D warnings
# fi
# done
# '
# language: system
# types: [rust]
# pass_filenames: false
- id: deno-fmt
name: deno fmt (web/)
entry: bash -c 'cd web && deno fmt'
language: system
files: ^web/
pass_filenames: false