-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
161 lines (156 loc) · 4.56 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
161 lines (156 loc) · 4.56 KB
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
# pre-commit automatically excludes submodules
# exclude: |
# (?x)^(
# test/.*|
# )$
repos:
# auto formatters (no work required) #############################################################
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
# https://github.com/prettier/plugin-php/issues/2430
exclude: workers/.*
- repo: local
hooks:
- id: phpcbf-pure
name: PHP Code Beautifier and Fixer (pure PHP files)
entry: ./vendor/bin/phpcbf
args: [--standard=./.phpcs-ruleset-pure.xml, --colors]
language: system
files: \.php$
exclude: |
(?x)^(
test/.*|
workers/.*|
node_modules/.*|
resources/lib/phpopenldaper/.*|
vendor/.*|
resources/templates/.*|
webroot/.*|
)$
- id: phpcbf-impure
name: PHP Code Beautifier and Fixer (mixed PHP/HTML files)
entry: ./vendor/bin/phpcbf
args: [--standard=./.phpcs-ruleset-impure.xml, --colors]
language: system
files: |
(?x)^(
resources/templates/.*\.php|
webroot/.*\.php|
)$
- id: php-cs-fixer
name: PHP CS Fixer
entry: ./vendor/bin/php-cs-fixer fix
language: system
files: \.php$
pass_filenames: false
- id: twig-cs-fixer
name: Twig CS Fixer
entry: ./vendor/bin/twig-cs-fixer fix
language: system
files: \.twig$
pass_filenames: true
# linters (work required) ########################################################################
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-yaml
- id: check-json
- id: check-xml
- id: check-added-large-files
- id: check-executables-have-shebangs
- repo: https://github.com/gitleaks/gitleaks
rev: v8.29.1
hooks:
- id: gitleaks
- repo: local
hooks:
- id: prettier
name: prettier
entry: ./node_modules/.bin/prettier
language: system
args: [-w]
files: |
(?x)(
\.php
\.html
\.js
\.css
\.json
)$
# exclude is done with .prettierignore
- id: phpcs-pure
name: PHP Code Sniffer (pure PHP files)
entry: ./vendor/bin/phpcs
args: [--standard=./.phpcs-ruleset-pure.xml, --colors, -s]
language: system
files: \.php$
exclude: |
(?x)^(
test/.*|
workers/.*|
node_modules/.*|
resources/lib/phpopenldaper/.*|
vendor/.*|
resources/templates/.*|
webroot/.*|
)$
- id: phpcs-impure
name: PHP Code Sniffer (mixed PHP/HTML files)
entry: ./vendor/bin/phpcs
args: [--standard=./.phpcs-ruleset-impure.xml, --colors, -s]
language: system
files: |
(?x)^(
resources/templates/.*\.php|
webroot/.*\.php|
)$
- id: twig-cs-fixer
name: Twig CS Fixer
entry: ./vendor/bin/twig-cs-fixer lint
language: system
files: \.twig$
pass_filenames: true
- id: php-l
name: php -l
entry: php
language: system
files: \.php$
args: [-l]
- id: assert-UnityHTTPD-used
name: Assert UnityHTTPD functions are used
entry: bash ./test/assert-UnityHTTPD-used.bash
language: system
files: \.php$
exclude: |
(?x)^(
resources/lib/UnityHTTPD\.php|
workers/.*|
)$
- id: assert-utils-used
name: Assert utils are used
entry: bash ./test/assert-utils-used.bash
language: system
files: \.php$
exclude: |
(?x)^(
^resources/lib/utils\.php$|
^test/.*\.php$|
)$
- id: assert-exceptions-used
name: Assert exceptions are used
entry: bash ./test/assert-exceptions-used.bash
language: system
files: ^resources/.*\.php$
exclude: |
(?x)^(
^resources/lib/UnityHTTPD\.php$|
^resources/templates/header\.php$|
)$
- id: assert-forbidden-used
name: Assert forbidden() is used
entry: bash ./test/assert-forbidden-used.bash
language: system
files: ^webroot/admin/.*\.php$