-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy path.pre-commit-config.yaml
140 lines (133 loc) · 4.89 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
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: "https://github.com/pre-commit/pre-commit-hooks"
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
exclude: "[.](svg|drawio.xml)$"
- id: check-yaml
# Helm templates are not reaaaally YAML.
exclude: "[/]templates[/]"
args:
# Needed by mkdocs.yaml
# Implies --allow-multiple-documents
- "--unsafe"
- id: check-added-large-files
- id: check-merge-conflict
- id: no-commit-to-branch
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell
name: check spelling
args:
- -I
- .codespellignore
exclude: ^(site/.*|.*\.dot|.*\.svg|.*\.xml|.*\.min\.js|package-lock.json)$
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.56.0
hooks:
- id: eslint
exclude: ^(user-demo/|docs/customer-quotes/|docs/tech-radar/)
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.12.1
hooks:
- id: markdownlint-cli2
name: lint markdown files
exclude: ^.github/
args:
- --fix
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier
exclude: /templates/|\.min\.|\.css$|\.html$|\.js$|\.md$|\.scss$|docs/img/|user-demo/|user-demo-dotnet/
- repo: local
hooks:
# must be before vale-run to install vale without conflict
- id: vale
name: lint prose in markdown files with vale - sync
alias: vale-sync
types: [markdown]
language: python
pass_filenames: false
require_serial: true
additional_dependencies:
- vale==3.9.1.0
entry: vale
args:
- sync
# must be after vale-sync to install vale without conflict
- id: vale
name: lint prose in markdown files with vale - run
alias: vale-run
types: [markdown]
language: python
additional_dependencies:
- vale==3.9.1.0
entry: vale
args:
- --output=line
- id: svg-must-embed
name: SVGs must embed all images
entry: 'image[^>]* xlink:href="https'
language: pygrep
files: ".*[.]svg$"
- id: svg-must-not-embed-PNG
name: SVGs must NOT embed PNGs
entry: 'image[^>]* xlink:href="data:image/png'
language: pygrep
files: ".*[.]svg$"
# We'll deal with these later.
exclude: '(\.drawio|ideal-dx|ideal-promotion)\.svg$'
- id: use-relative-urls
name: Use relative URLs for internal links
# Why? Mkdocs wants you to: https://www.mkdocs.org/user-guide/writing-your-docs/#linking-to-pages
entry: '\[[^\]]*\][(][/].*[)]'
language: pygrep
files: ".*[.]md$"
- id: use-relative-urls-to-files
# Why? This ensures the docs are readable from GitHub and allows mkdocs
# to do some internal link checking.
name: Internal links should point to files
# NOTE: I'm unsure the rule above can be precisely implemented using a
# regex. What I'm essentially ask here is:
# - link should not start with anchor `#`;
# - ignore leading `../..` from relative links;
# - there should be `:` (as in `https://`) or `.` (as in `index.md`)
# somewhere in the link.
entry: '\[[^\]]*\][(][^#][.\/]*[^.:]*[)]'
language: pygrep
files: ".*[.]md$"
- id: capitalize-common-names
name: Please capitalize common names
entry: "^[^`]{0,100} (git[Hh]ub|kubernetes|trivy|starboard|welkin)( |, |[.] )"
language: pygrep
files: ".*[.]md$"
- id: avoid-absolute-urls-for-internal-links
name: Avoid absolute URLs (https://elastisys.io) for internal links
entry: '\/\/(elastisys.io)\/'
language: pygrep
files: ".*[.]md$"
- id: avoid-old-website-url
name: Avoid old URLs (https://elastisys.io/compliantkubernetes)
entry: "elastisys.io/compliantkubernetes"
language: pygrep
files: ".*[.]md$"
- id: avoid-old-github-urls
name: Avoid old URLs (https://github.com/elastisys/compliantkubernetes)
entry: "github.com/elastisys/compliantkubernetes[^-]"
language: pygrep
files: ".*[.]md$"
- id: avoid-non-descriptive-link-text
name: Avoid non-descriptive link text (see https://developers.google.com/search/docs/crawling-indexing/links-crawlable#write-good-anchor-text)
entry: "(?i)<a[^>]*>(read more|click here|learn more)</a>"
language: pygrep
files: ".*[.]md$"
- id: avoid-old-names
name: Use Welkin consistently
entry: "(Compliant[ ]Kubernetes|C[kK]8[sS][^_]|Complaint)"
language: pygrep
files: ".*[.]md$"