Fix the issues reported by phpcs

Created on 6 April 2023, over 1 year ago
Updated 23 July 2024, 4 months ago

Problem/Motivation

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/d8_recaptcha_v3/config/install/d8_recaptcha_v3.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: /var/www/html/modules/contrib/d8_recaptcha_v3/d8_recaptcha_v3.libraries.yml
---------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------
7 | ERROR | [x] Expected 1 newline at end of file; 0 found
---------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/d8_recaptcha_v3/d8_recaptcha_v3.module
----------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
----------------------------------------------------------------------------------
27 | ERROR | [x] Missing function doc comment
33 | WARNING | [x] A comma should follow the last multiline array item. Found: )
----------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/d8_recaptcha_v3/d8_recaptcha_v3.links.menu.yml
----------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------
6 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/d8_recaptcha_v3/d8_recaptcha_v3.routing.yml
-------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------
14 | ERROR | [x] Expected 1 newline at end of file; 0 found
-------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/d8_recaptcha_v3/src/Form/SettingsForm.php
--------------------------------------------------------------------------------------------------------------------------------------------
FOUND 52 ERRORS AND 3 WARNINGS AFFECTING 42 LINES
--------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
1 | ERROR | [x] Whitespace found at end of line
2 | ERROR | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
2 | ERROR | [x] Whitespace found at end of line
3 | ERROR | [x] Whitespace found at end of line
4 | ERROR | [x] Whitespace found at end of line
5 | ERROR | [x] Whitespace found at end of line
6 | ERROR | [x] There must be one blank line after the namespace declaration
6 | ERROR | [x] Whitespace found at end of line
7 | ERROR | [x] Whitespace found at end of line
8 | ERROR | [x] Whitespace found at end of line
10 | ERROR | [x] Missing class doc comment
10 | ERROR | [x] Whitespace found at end of line
11 | ERROR | [x] Whitespace found at end of line
12 | ERROR | [x] Missing function doc comment
12 | ERROR | [x] Whitespace found at end of line
13 | ERROR | [x] Whitespace found at end of line
14 | ERROR | [x] Whitespace found at end of line
15 | ERROR | [x] Whitespace found at end of line
16 | ERROR | [x] Whitespace found at end of line
17 | ERROR | [x] Whitespace found at end of line
18 | ERROR | [x] Missing function doc comment
18 | ERROR | [x] Whitespace found at end of line
19 | ERROR | [x] Whitespace found at end of line
20 | ERROR | [x] Whitespace found at end of line
22 | ERROR | [x] Missing function doc comment
22 | ERROR | [x] Whitespace found at end of line
24 | ERROR | [x] Whitespace found at end of line
25 | ERROR | [x] Whitespace found at end of line
26 | ERROR | [x] Whitespace found at end of line
31 | ERROR | [x] Whitespace found at end of line
32 | ERROR | [x] Whitespace found at end of line
33 | ERROR | [x] Whitespace found at end of line
38 | ERROR | [x] Whitespace found at end of line
39 | ERROR | [x] Whitespace found at end of line
42 | ERROR | [x] Whitespace found at end of line
45 | ERROR | [x] Whitespace found at end of line
49 | WARNING | [ ] Avoid backslash escaping in translatable strings when possible, use "" quotes instead
50 | ERROR | [ ] The array declaration extends to column 104 (the limit is 80). The array content should be split up over multiple lines
50 | WARNING | [ ] #options values usually have to run through t() for translation
50 | ERROR | [x] Expected one space after the comma, 0 found
50 | WARNING | [ ] #options values usually have to run through t() for translation
50 | ERROR | [x] Expected one space after the comma, 0 found
52 | ERROR | [x] Whitespace found at end of line
53 | ERROR | [x] Whitespace found at end of line
54 | ERROR | [x] Whitespace found at end of line
56 | ERROR | [x] Missing function doc comment
56 | ERROR | [x] Whitespace found at end of line
57 | ERROR | [x] Whitespace found at end of line
59 | ERROR | [x] Whitespace found at end of line
60 | ERROR | [x] Whitespace found at end of line
64 | ERROR | [x] Whitespace found at end of line
65 | ERROR | [x] Whitespace found at end of line
66 | ERROR | [x] Expected 1 newline at end of file; 0 found
66 | ERROR | [x] The closing brace for the class must have an empty line before it
--------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 51 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/d8_recaptcha_v3/src/Controller/customRCController.php
-------------------------------------------------------------------------------------------------
FOUND 16 ERRORS AND 2 WARNINGS AFFECTING 13 LINES
-------------------------------------------------------------------------------------------------
5 | WARNING | [x] Unused use statement
10 | ERROR | [ ] Class name must begin with a capital letter
10 | ERROR | [x] Missing class doc comment
12 | ERROR | [x] Missing function doc comment
13 | ERROR | [x] Whitespace found at end of line
15 | ERROR | [x] Whitespace found at end of line
16 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
17 | ERROR | [x] Expected 1 space after "="; 2 found
17 | ERROR | [x] Concat operator must be surrounded by a single space
18 | ERROR | [x] Whitespace found at end of line
20 | ERROR | [x] Whitespace found at end of line
21 | ERROR | [x] Expected one space after the comma, 0 found
21 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
22 | ERROR | [x] Whitespace found at end of line
25 | ERROR | [x] There should be no white space after an opening "("
25 | ERROR | [x] There should be no white space before a closing ")"
27 | ERROR | [x] Expected 1 newline at end of file; 0 found
27 | ERROR | [x] The closing brace for the class must have an empty line before it
-------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 16 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------

Time: 1.16 secs; Memory: 6MB

Steps to reproduce

Run following command

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/d8_recaptcha_v3/

Proposed resolution

Above error/warnings need to be fixed.

šŸ“Œ Task
Status

RTBC

Version

3.0

Component

Code

Created by

šŸ‡®šŸ‡³India samit.310@gmail.com

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Issue created by @samit.310@gmail.com
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡³India samit.310@gmail.com

    Above errors/warnings has been fixed.

  • šŸ‡®šŸ‡³India Mahima_Mathur23

    Unable to apply patch in Drupal 10. Attaching the error screenshot.

  • šŸ‡®šŸ‡³India Mahima_Mathur23

    @akshaydalvi212,
    Please also attach the interdiff file.

  • šŸ‡®šŸ‡³India akshaydalvi212

    hey @Mahima_Mathur23 ,
    sorry for the inconvenience,
    I forgot to add the interdiff file.
    providing the same.

  • Status changed to RTBC 4 months ago
  • Hi @akshaydalvi212,

    The patch you provided was applied cleanly and confirmed fixed all reported issues.

    d8_recaptcha_v3 git:(3.0.x) curl https://www.drupal.org/files/issues/2023-04-17/3352575-8.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  7907  100  7907    0     0  33770      0 --:--:-- --:--:-- --:--:-- 35617
    patching file config/install/d8_recaptcha_v3.settings.yml
    patching file d8_recaptcha_v3.libraries.yml
    patching file d8_recaptcha_v3.links.menu.yml
    patching file d8_recaptcha_v3.module
    patching file d8_recaptcha_v3.routing.yml
    patching file src/Controller/customRCController.php
    patching file src/Form/SettingsForm.php
    āžœ  d8_recaptcha_v3 git:(3.0.x) āœ— cd ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig d8_recaptcha_v3
    āžœ  contrib git:(master) āœ—

    Will now move this to RTBC

    Thanks,
    Jake

Production build 0.71.5 2024