Module have some PHPCS issues

Created on 11 March 2024, 4 months ago
Updated 27 March 2024, 3 months ago

Hi @cmdgo

when I run the command
phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml
for you module

I found this

FILE: /Users/mac/contribution/my_site_name/web/modules/contrib/zencaptcha/config/install/zencaptcha.settings.yml
----------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------
4 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------

FILE: /Users/mac/contribution/my_site_name/web/modules/contrib/zencaptcha/zencaptcha.module
-----------------------------------------------------------------------------------------------------------------
FOUND 168 ERRORS AND 16 WARNINGS AFFECTING 137 LINES
-----------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
3 | WARNING | [x] Unused use statement
4 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is
| | Drupal\Core\Render\Markup.
9 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for
| | xyz_bar().",, "* Implements hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements
| | hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for
| | block templates."
26 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
29 | ERROR | [x] Whitespace found at end of line
31 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
33 | ERROR | [x] Short array syntax must be used to define arrays
38 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
44 | WARNING | [x] A comma should follow the last multiline array item. Found: $verification_method
48 | ERROR | [x] Short array syntax must be used to define arrays
56 | ERROR | [x] Array closing indentation error, expected 10 spaces but found 12
57 | ERROR | [x] Expected newline after closing brace
67 | ERROR | [ ] All functions defined in a module file must be prefixed with the module's name, found
| | "tzen" but expected "zencaptcha_tzen"
67 | ERROR | [x] Missing function doc comment
68 | ERROR | [x] Opening brace should be on the same line as the declaration
68 | ERROR | [x] Opening brace indented incorrectly; expected 0 spaces, found 4
69 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
70 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 8
101 | WARNING | [x] A comma should follow the last multiline array item. Found:
| | '使用有效的电子邮件地址.'
133 | WARNING | [x] A comma should follow the last multiline array item. Found: '确认您是人类。'
138 | WARNING | [x] A comma should follow the last multiline array item. Found: 'À propos de'
140 | ERROR | [x] Line indented incorrectly; expected at least 10 spaces, found 8
143 | WARNING | [x] A comma should follow the last multiline array item. Found: 'Configuration'
145 | ERROR | [x] Line indented incorrectly; expected at least 10 spaces, found 8
148 | WARNING | [x] A comma should follow the last multiline array item. Found: ' protège les formulaires de
| | votre site Web contre le spam des robots et des utilisateurs fictifs, et bloque les
| | adresses e-mail invalides et jetables. Tout en offrant une expérience utilisateur
| | exceptionnelle. Aucun cookie et totalement conforme au RGPD.'
150 | ERROR | [x] Line indented incorrectly; expected at least 10 spaces, found 8
153 | WARNING | [x] A comma should follow the last multiline array item. Found: 'Vous devez activer à la fois
| | les modules ZENCAPTCHA et CAPTCHA dans Gérer > Extension'
155 | ERROR | [x] Line indented incorrectly; expected at least 10 spaces, found 8
158 | WARNING | [x] A comma should follow the last multiline array item. Found: 'L\'onglet ZENCAPTCHA est alors
| | disponible dans la page d\'administration CAPTCHA : Gérer > Configuration > Personnes >
| | Paramètres du CAPTCHA > ZENCAPTCHA'
160 | ERROR | [x] Line indented incorrectly; expected at least 10 spaces, found 8
163 | WARNING | [x] A comma should follow the last multiline array item. Found: 'Créez un compte et
| | enregistrez votre site Web sur Zencaptcha pour obtenir la clé de site et la clé secrète
| | :'
165 | ERROR | [x] Line indented incorrectly; expected at least 10 spaces, found 8
168 | WARNING | [x] A comma should follow the last multiline array item. Found: 'Revenez et entrez les clés de
| | site et secrètes dans l\'onglet des paramètres ZENCAPTCHA.'
170 | ERROR | [x] Line indented incorrectly; expected at least 10 spaces, found 8
173 | WARNING | [x] A comma should follow the last multiline array item. Found: 'Visitez la page
| | d\'administration CAPTCHA et définissez où vous voulez que ZENCAPTCHA protège vos
| | formulaires : Gérer > Configuration > Personnes > Paramètres du CAPTCHA. IMPORTANT:
| | Choisissez dans Type de défi par défaut: zencaptcha du module zencaptcha.'
174 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
177 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 8
178 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 12
179 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 12
180 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 16
181 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 12
181 | ERROR | [x] Expected newline after closing brace
182 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 16
183 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 12
184 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 8
184 | ERROR | [x] Expected newline after closing brace
185 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 12
186 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 8
187 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 4
187 | ERROR | [x] Closing brace indented incorrectly; expected 0 spaces, found 4
190 | WARNING | [ ] Line exceeds 80 characters; contains 83 characters
190 | ERROR | [x] Doc comment short description must end with a full stop
194 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
196 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
197 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
198 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
199 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
200 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
200 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
201 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
202 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
203 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
204 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
206 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
207 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 10
208 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 10
208 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
209 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
211 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
211 | ERROR | [x] Expected 1 space after "="; 0 found
212 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
212 | ERROR | [x] Expected 1 space after IF keyword; 0 found
212 | ERROR | [x] Expected 1 space before "=="; 0 found
212 | ERROR | [x] Expected 1 space after "=="; 0 found
212 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
213 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
214 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 10
215 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
216 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
216 | ERROR | [x] Expected 1 space after ELSE keyword; 0 found
217 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
218 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 10
219 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 14
220 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 14
221 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 10
221 | ERROR | [x] Expected newline after closing brace
222 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 14
223 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 18
224 | ERROR | [x] Line indented incorrectly; expected 14 spaces, found 22
225 | ERROR | [x] Line indented incorrectly; expected 14 spaces, found 22
226 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 18
227 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 14
228 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 10
229 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
230 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
231 | ERROR | [x] Whitespace found at end of line
232 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
234 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
235 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
236 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
237 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
239 | ERROR | [x] Array closing indentation error, expected 4 spaces but found 5
240 | ERROR | [x] Whitespace found at end of line
241 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 5
242 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 7
243 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 5
244 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
246 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
247 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
248 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
249 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
251 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
252 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
252 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
253 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
255 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
255 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
257 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
258 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
258 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
258 | ERROR | [x] No space found before comment text; expected "// in case of network issues or failed
| | request, pass. (temporary solution)" but found "//in case of network issues or failed
| | request, pass. (temporary solution)"
258 | ERROR | [x] Inline comments must start with a capital letter
259 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
259 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
260 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
262 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
262 | ERROR | [x] There should be no white space after an opening "("
262 | ERROR | [x] There should be no white space before a closing ")"
263 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
263 | ERROR | [x] Use null coalesce operator instead of ternary operator.
264 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
266 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
266 | ERROR | [x] There should be no white space after an opening "("
266 | ERROR | [x] There should be no white space before a closing ")"
267 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
267 | ERROR | [x] Use null coalesce operator instead of ternary operator.
269 | ERROR | [x] Whitespace found at end of line
270 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
270 | ERROR | [x] There should be no white space after an opening "("
270 | ERROR | [x] There should be no white space before a closing ")"
271 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
271 | ERROR | [x] Use null coalesce operator instead of ternary operator.
274 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
274 | ERROR | [x] There should be no white space after an opening "("
274 | ERROR | [x] There should be no white space before a closing ")"
275 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
275 | ERROR | [x] Use null coalesce operator instead of ternary operator.
278 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
278 | ERROR | [x] There should be no white space after an opening "("
278 | ERROR | [x] There should be no white space before a closing ")"
279 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
279 | ERROR | [x] Use null coalesce operator instead of ternary operator.
282 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
283 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
283 | ERROR | [ ] The array declaration extends to column 120 (the limit is 80). The array content should be
| | split up over multiple lines
284 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
285 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
285 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
286 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
288 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
288 | ERROR | [x] Expected 1 space after IF keyword; 0 found
288 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
289 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
289 | ERROR | [ ] The array declaration extends to column 120 (the limit is 80). The array content should be
| | split up over multiple lines
290 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
291 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
291 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
292 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
293 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
295 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
296 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
296 | ERROR | [x] No space found before comment text; expected "// only works for LITE etc.. users!" but
| | found "//only works for LITE etc.. users!"
296 | ERROR | [x] Inline comments must start with a capital letter
297 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
297 | ERROR | [ ] The array declaration extends to column 120 (the limit is 80). The array content should be
| | split up over multiple lines
298 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
299 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
299 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
300 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
302 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
302 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
303 | ERROR | [x] Whitespace found at end of line
319 | ERROR | [x] Concat operator must be surrounded by a single space
-----------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 177 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------

FILE: /Users/mac/contribution/my_site_name/web/modules/contrib/zencaptcha/README.md
-----------------------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
-----------------------------------------------------------------------------------
15 | WARNING | Line exceeds 80 characters; contains 147 characters
37 | WARNING | Line exceeds 80 characters; contains 91 characters
44 | WARNING | Line exceeds 80 characters; contains 86 characters
46 | WARNING | Line exceeds 80 characters; contains 137 characters
49 | WARNING | Line exceeds 80 characters; contains 145 characters
-----------------------------------------------------------------------------------

FILE: /Users/mac/contribution/my_site_name/web/modules/contrib/zencaptcha/zencaptcha.info.yml
-------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------
1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
-------------------------------------------------------------------------------------------------------------

FILE: ...Users/mac/contribution/my_site_name/web/modules/contrib/zencaptcha/src/Form/ZenCaptchaAdminSettingsForm.php
-----------------------------------------------------------------------------------------------------------------
FOUND 31 ERRORS AND 10 WARNINGS AFFECTING 35 LINES
-----------------------------------------------------------------------------------------------------------------
7 | WARNING | [x] Unused use statement
28 | ERROR | [x] Missing function doc comment
29 | ERROR | [x] Opening brace should be on the same line as the declaration
29 | ERROR | [x] Opening brace indented incorrectly; expected 2 spaces, found 4
30 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
31 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
35 | WARNING | [x] A comma should follow the last multiline array item. Found: 'Comment démarrer la
| | vérification'
40 | WARNING | [x] A comma should follow the last multiline array item. Found: 'Quand l\'utilisateur clique
| | sur un champ du formulaire'
45 | WARNING | [x] A comma should follow the last multiline array item. Found: 'Lorsque l\'utilisateur clique
| | sur le widget Zencaptcha (recommandé)'
50 | WARNING | [x] A comma should follow the last multiline array item. Found: 'Vérifier les adresses e-mail
| | automatiquement (Bloquer les adresses e-mail invalides et jetables pour une base
| | d\'utilisateurs plus propre)'
55 | WARNING | [x] A comma should follow the last multiline array item. Found: 'Les e-mails doivent-ils être
| | vérifiés (fonction premium de ZENCAPTCHA)'
60 | WARNING | [x] A comma should follow the last multiline array item. Found: 'La clé de site pour votre
| | site Web qui est générée lors de votre inscription'
65 | WARNING | [x] A comma should follow the last multiline array item. Found: 'La clé secrète pour votre
| | site Web qui est générée lors de votre inscription'
66 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
68 | ERROR | [x] Whitespace found at end of line
68 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
70 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
71 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
72 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
73 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 16
74 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
74 | ERROR | [x] Expected newline after closing brace
75 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 16
76 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
77 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
77 | ERROR | [x] Expected newline after closing brace
78 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
79 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
80 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
80 | ERROR | [x] Closing brace indented incorrectly; expected 2 spaces, found 4
91 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
96 | ERROR | [x] Concat operator must be surrounded by a single space
98 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
99 | ERROR | [x] Concat operator must be surrounded by a single space
99 | WARNING | [ ] Do not concatenate strings to translatable strings, they should be part of the t() argument
| | and you should use placeholders
105 | ERROR | [x] Concat operator must be surrounded by a single space
107 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
116 | ERROR | [x] Array indentation error, expected 8 spaces but found 10
117 | ERROR | [x] Array indentation error, expected 8 spaces but found 10
127 | ERROR | [x] Array indentation error, expected 8 spaces but found 10
128 | ERROR | [x] Array indentation error, expected 8 spaces but found 10
-----------------------------------------------------------------------------------------------------------------

📌 Task
Status

Fixed

Version

1.0

Component

Code

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024