-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy path.pre-commit-config.yaml
47 lines (47 loc) · 1.63 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
repos:
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.7
hooks:
- id: remove-crlf
files: \.(groovy|md|yaml)$
- id: remove-tabs
files: \.(groovy|md|yaml)$
- id: insert-license
files: \.groovy$
args:
- --license-filepath
- src/LICENSE-short.txt
- --comment-style
- //
- repo: local
hooks:
- id: forbid-abstract-classes-and-traits
name: Ensure neither abstract classes nor traits are used
language: pygrep
entry: "^(abstract|trait) "
files: ^src/.*\.groovy$
- id: force-JsonSlurperClassic
name: Ensure JsonSlurperClassic is used instead of non-serializable JsonSlurper
language: pygrep
entry: JsonSlurper[^C]
files: \.groovy$
- id: forbid-instanceof-string
name: Use "instanceof CharSequence" to also support GString
language: pygrep
entry: " instanceof G?String"
files: \.groovy$
- id: forbid-elvis-operator-followed-by-true
name: Forbidding Elvis operator followed by true as it won't work as you expect
language: pygrep
entry: "\\?:\\s*true"
files: \.groovy$
- id: forbid-use-of-dot-empty
name: Use .isEmpty instead of .empty, cf. https://issues.jenkins-ci.org/browse/JENKINS-50863
language: pygrep
entry: \.empty
files: \.groovy$
- id: forbid-use-of-list-sort-with-closure
name: Never pass a closure to list.sort(), cf. https://issues.jenkins-ci.org/browse/JENKINS-44924
language: pygrep
entry: sort[^)]+\{
files: \.groovy$