Fix the issue reported by phpcs.

Created on 28 June 2023, over 1 year ago
Updated 20 August 2024, 4 months ago

Problem/Motivation

Getting following error/warnings:
FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\all_in_one_accessibility\all_in_one_accessibility.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: D:\xampp\htdocs\drupal_10\web\modules\contrib\all_in_one_accessibility\all_in_one_accessibility.module
--------------------------------------------------------------------------------------------------------------------------
FOUND 28 ERRORS AND 5 WARNINGS AFFECTING 21 LINES
--------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
8 | WARNING | [x] Unused use statement
9 | WARNING | [x] Unused use statement
10 | WARNING | [x] Unused use statement
11 | WARNING | [x] Unused use statement
11 | ERROR | [x] There must be one blank line after the last USE statement; 0 found;
15 | ERROR | [x] Expected 1 blank line before function; 0 found
19 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
27 | ERROR | [x] Additional blank lines found at end of doc comment
27 | ERROR | [x] There must be no blank lines after the function comment
46 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
47 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
48 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
52 | ERROR | [x] Expected 1 space after IF keyword; 0 found
52 | ERROR | [x] Expected 1 space after closing parenthesis; found 6
56 | ERROR | [x] Concat operator must be surrounded by a single space
58 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
59 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 10
60 | ERROR | [x] Array indentation error, expected 12 spaces but found 8
60 | ERROR | [x] There should be no white space after an opening "["
60 | ERROR | [x] The first index in a multi-value array must be on a new line
60 | ERROR | [x] Concat operator must be surrounded by a single space
60 | ERROR | [x] Concat operator must be surrounded by a single space
60 | ERROR | [x] Concat operator must be surrounded by a single space
60 | ERROR | [x] Concat operator must be surrounded by a single space
60 | ERROR | [x] Concat operator must be surrounded by a single space
60 | ERROR | [x] Concat operator must be surrounded by a single space
61 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
62 | ERROR | [x] Array closing indentation error, expected 8 spaces but found 10
64 | ERROR | [x] Array closing indentation error, expected 10 spaces but found 6
71 | ERROR | [x] Missing function doc comment
74 | ERROR | [x] Expected 1 newline at end of file; 3 found
--------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 32 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\all_in_one_accessibility\README.txt
---------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
---------------------------------------------------------------------------------------
6 | WARNING | Line exceeds 80 characters; contains 119 characters
17 | WARNING | Line exceeds 80 characters; contains 99 characters
28 | WARNING | Line exceeds 80 characters; contains 375 characters
30 | WARNING | Line exceeds 80 characters; contains 468 characters
---------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\all_in_one_accessibility\src\Form\UseridForm.php
----------------------------------------------------------------------------------------------------
FOUND 18 ERRORS AND 1 WARNING AFFECTING 17 LINES
----------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
33 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
38 | ERROR | [x] Use null coalesce operator instead of ternary operator.
46 | ERROR | [x] Use null coalesce operator instead of ternary operator.
50 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
52 | ERROR | [x] Short array syntax must be used to define arrays
60 | WARNING | [x] A comma should follow the last multiline array item. Found: )
67 | ERROR | [x] Use null coalesce operator instead of ternary operator.
69 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
88 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
88 | ERROR | [x] Object operator not indented correctly; expected 6 spaces but found 4
89 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
90 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
93 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
93 | ERROR | [x] Object operator not indented correctly; expected 6 spaces but found 4
94 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
95 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
96 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
99 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
----------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 19 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------

Steps to reproduce

Run the command:
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,css,js,yml all_in_one_accessibility/

Proposed resolution

Above error/warnings need to be fixed

Remaining tasks

User interface changes

API changes

Data model changes

šŸ“Œ Task
Status

Needs work

Version

1.5

Component

Code

Created by

šŸ‡®šŸ‡³India arti_parmar

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

Comments & Activities

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

    Kindly review patch.

  • Status changed to Needs work 4 months ago
  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi @arti_parmar,

    I applied patch #2, it was not applied smoothly but fixed some of the phpcs issues.

    These are the remaining issues after I ran phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,css,js,yml:

    āžœ  all_in_one_accessibility git:(1.5.x) curl https://www.drupal.org/files/issues/2023-06-28/3370852-2.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 11231  100 11231    0     0  37394      0 --:--:-- --:--:-- --:--:-- 37436
    patching file README.txt
    Hunk #1 FAILED at 3.
    Hunk #2 FAILED at 15.
    Hunk #3 FAILED at 27.
    3 out of 3 hunks FAILED -- saving rejects to file README.txt.rej
    patching file all_in_one_accessibility.info.yml
    Hunk #1 FAILED at 5.
    1 out of 1 hunk FAILED -- saving rejects to file all_in_one_accessibility.info.yml.rej
    patching file all_in_one_accessibility.install
    patching file all_in_one_accessibility.links.task.yml
    patching file all_in_one_accessibility.module
    Hunk #1 FAILED at 1.
    Hunk #2 succeeded at 16 with fuzz 1 (offset 2 lines).
    Hunk #3 FAILED at 41.
    Hunk #4 succeeded at 64 with fuzz 1.
    2 out of 4 hunks FAILED -- saving rejects to file all_in_one_accessibility.module.rej
    patching file src/Form/UseridForm.php
    Hunk #1 FAILED at 31.
    Hunk #2 FAILED at 42.
    Hunk #3 FAILED at 55.
    Hunk #4 FAILED at 82.
    4 out of 4 hunks FAILED -- saving rejects to file src/Form/UseridForm.php.rej
    āžœ  all_in_one_accessibility git:(1.5.x) āœ— ..
    āžœ  contrib phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,css,js,yml all_in_one_accessibility
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/all_in_one_accessibility/all_in_one_accessibility.info.yml
    -------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 3 WARNINGS AFFECTING 2 LINES
    -------------------------------------------------------------------------------------------------------------------------------
      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
     10 | ERROR   | [x] Expected 1 newline at end of file; 0 found
    -------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/all_in_one_accessibility/README.txt
    --------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------
     43 | ERROR | [x] Expected 1 newline at end of file; 0 found
    --------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/all_in_one_accessibility/all_in_one_accessibility.module
    -----------------------------------------------------------------------------------------------------------------------------
    FOUND 28 ERRORS AND 6 WARNINGS AFFECTING 17 LINES
    -----------------------------------------------------------------------------------------------------------------------------
      1 | ERROR   | [x] The PHP open tag must be followed by exactly one blank line
      8 | WARNING | [x] Unused use statement
      8 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Render\Markup.
      9 | WARNING | [x] Unused use statement
     10 | WARNING | [x] Unused use statement
     11 | WARNING | [x] Unused use statement
     12 | WARNING | [x] Unused use statement
     30 | ERROR   | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
     36 | WARNING | [ ] Unused variable $url.
     38 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
     38 | ERROR   | [x] Expected 1 space after closing parenthesis; found 5
     42 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
     42 | ERROR   | [x] Expected 1 space after closing parenthesis; found 5
     46 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
     46 | ERROR   | [x] Expected 1 space after closing parenthesis; found 5
     57 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
     58 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 10
     59 | ERROR   | [x] Array indentation error, expected 12 spaces but found 8
     59 | ERROR   | [x] There should be no white space after an opening "["
     59 | ERROR   | [x] The first index in a multi-value array must be on a new line
     59 | ERROR   | [x] Concat operator must be surrounded by a single space
     59 | ERROR   | [x] Concat operator must be surrounded by a single space
     59 | ERROR   | [x] Concat operator must be surrounded by a single space
     59 | ERROR   | [x] Concat operator must be surrounded by a single space
     59 | ERROR   | [x] Concat operator must be surrounded by a single space
     59 | ERROR   | [x] Concat operator must be surrounded by a single space
     59 | ERROR   | [x] Expected one space after the comma, 0 found
     59 | ERROR   | [x] Concat operator must be surrounded by a single space
     59 | ERROR   | [x] Concat operator must be surrounded by a single space
     59 | ERROR   | [x] Concat operator must be surrounded by a single space
     59 | ERROR   | [x] Concat operator must be surrounded by a single space
     60 | ERROR   | [x] Array indentation error, expected 10 spaces but found 12
     61 | ERROR   | [x] Array closing indentation error, expected 8 spaces but found 10
     63 | ERROR   | [x] Array closing indentation error, expected 10 spaces but found 6
    -----------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 33 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/all_in_one_accessibility/src/Form/UseridForm.php
    ---------------------------------------------------------------------------------------------------------------------------------
    FOUND 59 ERRORS AND 7 WARNINGS AFFECTING 56 LINES
    ---------------------------------------------------------------------------------------------------------------------------------
       3 | ERROR   | [x] There must be one blank line after the namespace declaration
       6 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormStateInterface.
       7 | WARNING | [x] Unused use statement
      34 | ERROR   | [x] Expected 1 space after "="; 2 found
      34 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
      38 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
      38 | ERROR   | [x] Expected 1 space after closing parenthesis; found 0
      43 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
      44 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
      45 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
      48 | ERROR   | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
      50 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 5
      51 | ERROR   | [x] Array indentation error, expected 7 spaces but found 8
      52 | ERROR   | [x] Array indentation error, expected 7 spaces but found 8
      53 | ERROR   | [x] Array indentation error, expected 7 spaces but found 8
      60 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
      61 | ERROR   | [ ] Concatenating translatable strings is not allowed, use placeholders instead and only one string literal
      61 | ERROR   | [x] Concat operator must be surrounded by a single space
      66 | WARNING | [x] A comma should follow the last multiline array item. Found: 1
      72 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
      76 | ERROR   | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
      78 | ERROR   | [x] Short array syntax must be used to define arrays
      86 | WARNING | [x] A comma should follow the last multiline array item. Found: )
      93 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
      96 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
      96 | ERROR   | [x] Expected 1 space after closing parenthesis; found 0
      98 | ERROR   | [x] Short array syntax must be used to define arrays
     102 | ERROR   | [x] Array closing indentation error, expected 6 spaces but found 7
     104 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
     104 | ERROR   | [x] Expected 1 space after closing parenthesis; found 7
     112 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
     118 | ERROR   | [x] Short array syntax must be used to define arrays
     119 | ERROR   | [ ] Concatenating translatable strings is not allowed, use placeholders instead and only one string literal
     119 | ERROR   | [x] Concat operator must be surrounded by a single space
     119 | ERROR   | [x] Concat operator must be surrounded by a single space
     120 | ERROR   | [ ] Concatenating translatable strings is not allowed, use placeholders instead and only one string literal
     121 | ERROR   | [ ] Concatenating translatable strings is not allowed, use placeholders instead and only one string literal
     122 | ERROR   | [ ] Concatenating translatable strings is not allowed, use placeholders instead and only one string literal
     123 | ERROR   | [ ] Concatenating translatable strings is not allowed, use placeholders instead and only one string literal
     130 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
     216 | WARNING | [x] A comma should follow the last multiline array item. Found: )
     236 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
     237 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
     238 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
     241 | ERROR   | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
     246 | ERROR   | [x] Expected 1 space after "="; 2 found
     248 | ERROR   | [x] Expected newline after closing brace
     252 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
     252 | ERROR   | [x] Expected 1 space after closing parenthesis; found 0
     253 | ERROR   | [x] Expected 1 space after "="; 2 found
     255 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
     255 | ERROR   | [x] Expected 1 space after closing parenthesis; found 0
     256 | ERROR   | [x] Expected 1 space after "="; 2 found
     257 | ERROR   | [x] Whitespace found at end of line
     285 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 4
     285 | ERROR   | [x] Object operator not indented correctly; expected 6 spaces but found 4
     286 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 4
     287 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 4
     290 | ERROR   | [x] Short array syntax must be used to define arrays
     292 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
     296 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
     299 | ERROR   | [x] Short array syntax must be used to define arrays
     304 | WARNING | [x] A comma should follow the last multiline array item. Found: )
     307 | WARNING | [ ] Unused variable $response.
     310 | ERROR   | [x] Expected 1 blank line after function; 0 found
     311 | ERROR   | [x] The closing brace for the class must have an empty line before it
    ---------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 58 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------
    
    Time: 165ms; Memory: 12MB
    
    āžœ  contrib

    Thank you.

Production build 0.71.5 2024