-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy path.pre-commit-config.yaml
129 lines (113 loc) · 3.51 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
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
exclude: |
(?x)(
^server/src/main/java/io/littlehorse/common/proto/|
^sdk-java/src/main/java/io/littlehorse/sdk/common/proto/|
^sdk-java/src/main/java/io/littlehorse/common/proto/|
^sdk-go/lhproto/|
^sdk-python/littlehorse/model/|
^dashboard/apps/web/littlehorse-public-api/|
^docs/images/
)
fail_fast: true
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
name: Trailing Whitespace
- id: end-of-file-fixer
name: Check End of Files
- id: check-added-large-files
name: Check For Any Large Added File
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.6
hooks:
- id: shellcheck
name: List Shell Scripts
args: ['-x', '--severity=error']
- repo: local
hooks:
# Dependencies
- id: install-python
name: Install Python Dependencies
language: system
always_run: true
pass_filenames: false
entry: poetry -C ./sdk-python install
- id: install-sdk-js
name: Install Javascript Dependencies
language: system
always_run: true
pass_filenames: false
entry: bash -c 'cd ./sdk-js && npm install'
# Formatters
- id: format-java
name: Format Java Code
language: system
always_run: true
pass_filenames: false
entry: ./gradlew spotlessApply
- id: format-python
name: Format Python Code
language: system
always_run: true
pass_filenames: false
entry: poetry -C ./sdk-python run black .
- id: format-go
name: Format Go Code
language: system
always_run: true
pass_filenames: false
entry: gofmt -s -w ./sdk-go
- id: format-sdk-js
name: Format Javascript
language: system
always_run: true
pass_filenames: false
entry: bash -c 'cd ./sdk-js && npm run lint:fix'
# Linters
- id: lint-python
name: Lint Python Code
language: system
always_run: true
pass_filenames: false
entry: poetry -C ./sdk-python run ruff check --fix .
- id: mypy
name: Validating Python Types
language: system
always_run: true
pass_filenames: false
entry: poetry -C ./sdk-python run mypy .
# Tests
- id: java-build
name: Tests Java Projects
language: system
always_run: true
pass_filenames: false
entry: ./gradlew build
- id: javadoc
name: Running JavaDoc
language: system
always_run: true
pass_filenames: false
entry: bash -c './gradlew sdk-java:javadoc && ./gradlew test-utils:javadoc && ./gradlew test-utils-container:javadoc'
- id: go-tests
name: Running SDK Go Tests
language: system
always_run: true
pass_filenames: false
entry: bash -c 'cd ./sdk-go && go test ./...'
- id: python-tests
name: Running SDK Python Tests
language: system
always_run: true
pass_filenames: false
entry: poetry -C ./sdk-python run python -m unittest discover -s .
- id: sdk-js-tests
name: Running SDK Javascript tests
language: system
always_run: true
pass_filenames: false
entry: bash -c 'cd ./sdk-js && npm run test'