-
Notifications
You must be signed in to change notification settings - Fork 1
/
.pre-commit-config.yaml
164 lines (142 loc) · 5.49 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
154
155
156
157
158
159
160
161
162
163
164
---
minimum_pre_commit_version: "2.17"
default_stages: [pre-commit]
repos:
# ----------------------------------------------
# Meta hooks
# ----------------------------------------------
- repo: meta
hooks:
- id: identity
stages: [pre-commit, manual]
- id: check-hooks-apply
stages: [manual]
- id: check-useless-excludes
stages: [manual]
# ----------------------------------------------
# File hooks
# ----------------------------------------------
# file checking out-of-the-box hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
hooks:
- id: check-case-conflict
- id: check-shebang-scripts-are-executable
exclude: '^.*\.rs$'
- id: check-symlinks
- id: destroyed-symlinks
- id: forbid-new-submodules
# ####################################################################################
#
# FORMATTING
#
# ####################################################################################
# ----------------------------------------------
# JS / TS / HTML / CSS / MD / JSON / YAML
# ----------------------------------------------
# prettier - multi formatter
- repo: https://github.com/pre-commit/mirrors-prettier
# https://github.com/prettier/prettier
rev: f12edd9c7be1c20cfa42420fd0e6df71e42b51ea # frozen: v4.0.0-alpha.8
hooks:
- id: prettier
additional_dependencies:
- "prettier@^2.5.1"
- "@trivago/prettier-plugin-sort-imports@^3.2.0"
# ----------------------------------------------
# Spelling dict
# ----------------------------------------------
# Custom hook as python command
- repo: local
hooks:
- id: sort-spelling-dicts
name: Sort spelling_dict.txt files
description: Sort spelling_dict.txt files
language: python
entry: python
args:
- "-c"
- |
import pathlib;
import sys;
p = pathlib.Path(sys.argv[1]);
p.write_text("\n".join(sorted(set(p.read_text("utf-8").splitlines()))) + "\n", "utf-8")
files: "spelling_dict.txt"
# ----------------------------------------------
# General (code unspecific)
# ----------------------------------------------
# code unspecific out-of-the-box hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
hooks:
- id: end-of-file-fixer
stages: [pre-commit]
- id: trailing-whitespace
stages: [pre-commit]
# ####################################################################################
#
# LINTING
#
# ####################################################################################
# ----------------------------------------------
# General (code unspecific)
# ----------------------------------------------
- repo: local
hooks:
# Find TODO:|FIXME:|BUG: comments in all files
# Inline skip: `#i#` directly after the colon after the tag-word
- id: find-todos
name: "Find TODO:|FIXME:|BUG: comments"
description: "Check for TODO:|FIXME:|BUG: comments in all files"
language: pygrep
entry: '(^|//!?|#|<!--|;|/\*(\*|!)?|\.\.)\s*(TODO:|FIXME:|BUG:)(?!#i#)'
exclude: TODO
# code unspecific out-of-the-box hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
hooks:
- id: check-merge-conflict
- id: detect-private-key
# ----------------------------------------------
# Shell script
# ----------------------------------------------
# shellscript (via PyPI package)
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: a23f6b85d0fdd5bb9d564e2579e678033debbdff # frozen: v0.10.0.1
hooks:
- id: shellcheck
# ----------------------------------------------
# Markdown
# ----------------------------------------------
# markdownlint - md file checker
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: 1d349044b9624661f5a0a7e13e0ca9801752022a # frozen: v0.16.0
# Inline config:
# Disable all rules: <!-- markdownlint-disable -->
# Enable all rules: <!-- markdownlint-enable -->
# Disable all rules for the next line only: <!-- markdownlint-disable-next-line -->
# Disable rules by name: <!-- markdownlint-disable MD001 MD005 -->
# Enable rules by name: <!-- markdownlint-enable MD001 MD005 -->
# Disable rules by name for next line only: <!-- markdownlint-disable-next-line MD001 MD005 -->
# Capture the current rule configuration: <!-- markdownlint-capture -->
# Restore the captured rule configuration: <!-- markdownlint-restore -->
hooks:
- id: markdownlint-cli2
# ----------------------------------------------
# JSON / TOML / YAML
# ----------------------------------------------
# JSON specific out-of-the-box hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
hooks:
- id: check-json
- id: check-toml
- id: check-yaml
# yamllint - yaml linter
- repo: https://github.com/adrienverge/yamllint
rev: 81e9f98ffd059efe8aa9c1b1a42e5cce61b640c6 # frozen: v1.35.1
hooks:
# Inline skip: `# yamllint disable-line[ rule:<RULE>]`
# Block skip: `# yamllint disable[ rule:<RULE>]`
# Block skip end: `# yamllint enable`
- id: yamllint