-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy path.pre-commit-config.yaml
64 lines (62 loc) · 2.8 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
repos:
- repo: https://github.com/Gaspi/pre-commit-hooks
rev: v0.5
hooks:
# Validate schemas using the jsonschema.validators package
- id: validate-json-schemas
exclude: "charts/(?!(library-chart|(jupyter-py(spark|thon)/.*)|(rstudio(-sparkr)?/.*)|(vscode-py(thon|spark)/.*)))"
args:
# Forbid legacy https://json-schema.org/draft/2020-12/schema schema validator and suggest Draft 7 instead
- --forbid-legacy
# Ensure technically facultative attribute (such as `type`) are systematically specified
- id: missing-attributes-schemas
exclude: "charts/(?!(library-chart|(jupyter-py(spark|thon)/.*)|(rstudio(-sparkr)?/.*)|(vscode-py(thon|spark)/.*)))"
args:
# Also require `items` to be systematically specified for arrays
- --check-items
# Also require `properties` to be systematically specified for object
- --check-properties
# Also require `properties` to be systematically specified for object
- --check-defaults
# Just fail if any modification occurs to files in the charts/ folder
# other than jupyter-py{spark,thon}, rstudio[-sparkr] or vscode-py{thon,spark}
- id: check-match
args:
- --regex
- "^charts/(?!(library-chart|jupyter-python|jupyter-pyspark|rstudio|rstudio-sparkr|vscode-python|vscode-pyspark)/).*$"
pass_filenames: false
always_run: true
# Ensure that the Chart.yaml version is bumped in all charts with staged modifications *in the `main` branch only*
- id: version-bump
exclude: "charts/(?!(library-chart|(jupyter-py(spark|thon)/.*)|(rstudio(-sparkr)?/.*)|(vscode-py(thon|spark)/.*)))"
args:
- --branch
- main
# Run `helm dependency update` then `helm lint` on all (modified) charts
- id: helmlint
exclude: "charts/(?!(library-chart|(jupyter-py(spark|thon)/.*)|(rstudio(-sparkr)?/.*)|(vscode-py(thon|spark)/.*)))"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
# Check yaml files except for Helm templates
- id: check-yaml
exclude: "/templates/"
# Check empty new line before EOF (ignore generated charts)
- id: end-of-file-fixer
exclude: "charts/(?!(library-chart|(jupyter-py(spark|thon)/.*)|(rstudio(-sparkr)?/.*)|(vscode-py(thon|spark)/.*)))"
# Check trailing whitespaces (ignore generated charts)
- id: trailing-whitespace
exclude: "charts/(?!(library-chart|(jupyter-py(spark|thon)/.*)|(rstudio(-sparkr)?/.*)|(vscode-py(thon|spark)/.*)))"
# Warn the user if `library-chart` is updated and its new version simulatenously reused in other charts
- repo: local
hooks:
- id: check_library_chart
name: check library-chart update and reuse
language: system
entry: python3 -m utils.check_library_chart
# Add -s flag to raise warning only if the library-chart updated version is reused
pass_filenames: false
always_run: true
args:
- --branch
- main