-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy path.pre-commit-config.yaml
153 lines (136 loc) · 4.22 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
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
exclude: '(trailbase-core/bindings|bindings)/.*'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-byte-order-marker
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
# Self-validation for pre-commit manifest.
- repo: https://github.com/pre-commit/pre-commit
rev: v3.8.0
hooks:
- id: validate_manifest
- repo: local
hooks:
### Rust ###
- id: cargofmt
name: Cargo Format
entry: cargo fmt -- --check
pass_filenames: false
# NOTE: language refers to the language in which the hook is implemented
# in, rather than the inputs. In this case we rely on cargo being
# installed on the system
language: system
# NOTE: types/files/exclude narrow the inputs the hook should run on.
types: [rust]
exclude: '^vendor/'
- id: cargoclippy
name: Cargo Clippy
# Be verbose to at least still see warnings scroll by.
verbose: true
entry: cargo clippy --workspace --no-deps
language: system
types: [rust]
exclude: '^vendor/'
pass_filenames: false
- id: cargotest
name: Cargo Test
entry: cargo test --workspace -- --show-output
language: system
types: [rust]
exclude: '^(vendor|bindings)/'
pass_filenames: false
### Auth, Admin, Docs UI ###
- id: prettier
name: Prettier
entry: pnpm -r format --check
language: system
types: [file]
files: .*\.(js|mjs|cjs|ts|jsx|tsx|astro|md|mdx)$
pass_filenames: false
- id: typescript_check
name: Typescript Check
entry: pnpm -r check
language: system
types: [file]
files: .*\.(js|mjs|cjs|ts|jsx|tsx|astro|mdx)$
pass_filenames: false
- id: javascript_test
name: JavaScript Test
entry: pnpm -r test
language: system
types: [file]
files: .*\.(js|mjs|cjs|ts|jsx|tsx|astro)$
pass_filenames: false
- id: build_website
name: Build Website
entry: sh -c 'cd docs && pnpm build'
language: system
types: [file]
files: .*\.(js|mjs|cjs|ts|jsx|tsx|astro)$
pass_filenames: false
### Dart client and example
- id: dart_format
name: Dart format
entry: dart format -o none --set-exit-if-changed client/trailbase-dart examples/blog/flutter
language: system
types: [file]
files: .*\.dart$
pass_filenames: false
- id: dart_analyze
name: Dart analyze
entry: sh -c 'dart pub -C client/trailbase-dart get && dart pub -C examples/blog/flutter get && dart analyze -- client/trailbase-dart examples/blog/flutter'
language: system
types: [file]
files: .*\.dart$
pass_filenames: false
- id: dart_test
name: Dart test
entry: sh -c 'cd client/trailbase-dart && dart pub get && dart test'
language: system
types: [file]
files: .*\.dart$
pass_filenames: false
### Dotnet client
- id: dotnet_format
name: Dotnet format
entry: sh -c 'dotnet format client/trailbase-dotnet/src --verify-no-changes && dotnet format client/trailbase-dotnet/test --verify-no-changes'
language: system
types: [file]
files: .*\.(cs|csproj)$
pass_filenames: false
- id: dotnet_test
name: Dotnet test
entry: dotnet test client/trailbase-dotnet/test
language: system
types: [file]
files: .*\.(cs|csproj)$
pass_filenames: false
### Python client
- id: python_format
name: Python format
entry: poetry -C client/trailbase-py run black --config pyproject.toml --check .
language: system
types: [file]
files: .*\.(py)$
pass_filenames: false
- id: python_check
name: Python check
entry: poetry -C client/trailbase-py run pyright --outputjson
language: system
types: [file]
files: .*\.(py)$
pass_filenames: false
- id: python_test
name: Python test
entry: poetry -C client/trailbase-py run pytest
language: system
types: [file]
files: .*\.(py)$
pass_filenames: false