-
Notifications
You must be signed in to change notification settings - Fork 31
/
.pre-commit-config.yaml
114 lines (109 loc) · 4.19 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
# 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: v4.1.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:
- 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$"