Fix the issues reported by phpcs

Created on 10 July 2023, over 1 year ago
Updated 31 July 2024, 4 months ago

Problem/Motivation

FILE: /var/www/html/vb/d_cont/accessibility_block/README.md
------------------------------------------------------------------------
FOUND 1 ERROR AND 7 WARNINGS AFFECTING 7 LINES
------------------------------------------------------------------------
3 | WARNING | [ ] Line exceeds 80 characters; contains 150 characters
8 | WARNING | [ ] Line exceeds 80 characters; contains 91 characters
15 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
21 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
22 | WARNING | [ ] Line exceeds 80 characters; contains 124 characters
27 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
33 | WARNING | [ ] Line exceeds 80 characters; contains 185 characters
33 | ERROR | [x] Expected 1 newline at end of file; 3 found
------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/accessibility_block/assets/css/style.css
--------------------------------------------------------------------------------
FOUND 178 ERRORS AFFECTING 162 LINES
--------------------------------------------------------------------------------
2 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
3 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
4 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
5 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
6 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
7 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
8 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
9 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
10 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
11 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
12 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
13 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 1
15 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
16 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
17 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
18 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
19 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
20 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
21 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
22 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
23 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
24 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
25 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
26 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
26 | ERROR | [x] Expected 1 space before opening brace of class definition; 0
| | found
27 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
28 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
29 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
30 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
31 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
32 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
33 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
34 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
35 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
36 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
37 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
38 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
39 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
40 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
41 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
42 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
42 | ERROR | [x] Expected 1 space before opening brace of class definition; 0
| | found
43 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
44 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
44 | ERROR | [ ] Style definitions must end with a semicolon
45 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
47 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
48 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
56 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
57 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
58 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
59 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
60 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
61 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
62 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
63 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
64 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
65 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
66 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 1
66 | ERROR | [x] Expected 1 space before opening brace of class definition; 0
| | found
67 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
68 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
69 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
70 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
71 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
72 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
73 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
74 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
75 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
76 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
76 | ERROR | [x] Expected 1 space before opening brace of class definition; 0
| | found
77 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 0
78 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 0
79 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
80 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
81 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
82 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
83 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
84 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
85 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
86 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
87 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
88 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
89 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
90 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
91 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
92 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
93 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
94 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
95 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
96 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
97 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
98 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
99 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
100 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
101 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
102 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
103 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
103 | ERROR | [x] Multiple selectors should each be on a single line
104 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
106 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
107 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
108 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
109 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
110 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
111 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
112 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
113 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
113 | ERROR | [x] Expected 1 space before opening brace of class definition; 0
| | found
114 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
115 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
116 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
117 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
118 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
119 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
120 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
121 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
122 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
122 | ERROR | [x] Expected 1 space before opening brace of class definition; 0
| | found
123 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
124 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
125 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
126 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
126 | ERROR | [x] Multiple selectors should each be on a single line
127 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
128 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
129 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
130 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
131 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
132 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
133 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
134 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
135 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
136 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
137 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
138 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
139 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
140 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
141 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
142 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
143 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
144 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
145 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
145 | ERROR | [x] Selectors must be on a single line
146 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
146 | ERROR | [x] Blank lines are not allowed between class names
146 | ERROR | [x] Expected 1 space before opening brace of class definition;
| | newline found
147 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
148 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
149 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
151 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
152 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
153 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
154 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
155 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
156 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
159 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
160 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
161 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
162 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
163 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
164 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
165 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
166 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
167 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
168 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
169 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
169 | ERROR | [x] Expected 1 space before opening brace of class definition; 0
| | found
170 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
170 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
170 | ERROR | [x] Expected 0 spaces before semicolon in style definition; 1
| | found
171 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
172 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
173 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
174 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
175 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
176 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
176 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 177 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...html/vb/d_cont/accessibility_block/src/Plugin/Block/AccessibilityTools.php
--------------------------------------------------------------------------------
FOUND 5 ERRORS AND 2 WARNINGS AFFECTING 7 LINES
--------------------------------------------------------------------------------
27 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
40 | WARNING | [x] A comma should follow the last multiline array item. Found:
| | $module_path
42 | ERROR | [x] Functions must not contain multiple empty lines in a row;
| | found 2 empty lines
43 | ERROR | [x] Whitespace found at end of line
44 | ERROR | [x] Expected 1 blank line after function; 2 found
80 | ERROR | [x] Expected 1 blank line after function; 2 found
83 | ERROR | [x] The closing brace for the class must have an empty line
| | before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/accessibility_block/accessibility_block.module
--------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 4 LINES
--------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
3 | ERROR | [x] Missing function doc comment
4 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
14 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
14 | ERROR | [x] Expected 1 newline at end of file; 0 found
14 | ERROR | [x] Closing brace indented incorrectly; expected 0 spaces, found
| | 2
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 66ms; Memory: 10MB

Steps to reproduce

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

Remaining tasks

Patch review

šŸ“Œ Task
Status

Needs work

Version

1.0

Component

Code

Created by

šŸ‡®šŸ‡³India urvashi_vora Madhya Pradesh, India

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

  • Issue created by @urvashi_vora
  • Status changed to Needs work about 1 year ago
  • šŸ‡®šŸ‡³India Ashutosh Ahirwal India

    Unable to apply provided patch throwing error during patch apply.

  • Status changed to Needs review about 1 year ago
  • šŸ‡®šŸ‡³India Ashutosh Ahirwal India

    Providing updated patch.

  • Hi, reviewed the patch #3, applied cleanly and fixes all the phpcs errors.

  • Status changed to Needs work 4 months ago
  • Hi @Ashutosh Ahirwal,

    I applied the patch you provided, some files failed to patch, may be the reason errors on 2 files were reported. Please see below:

    accessibility_block git:(master) āœ— curl https://www.drupal.org/files/issues/2023-10-25/Fixes-phpcs-issue.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 13388  100 13388    0     0  25683      0 --:--:-- --:--:-- --:--:-- 26354
    patching file README.md
    patching file accessibility_block.module
    Hunk #1 FAILED at 1.
    1 out of 1 hunk FAILED -- saving rejects to file accessibility_block.module.rej
    patching file assets/css/style.css
    patching file assets/js/main.js
    patching file src/Plugin/Block/AccessibilityTools.php
    Hunk #1 FAILED at 22.
    Hunk #2 succeeded at 40 with fuzz 1 (offset 1 line).
    Hunk #3 FAILED at 50.
    Hunk #4 succeeded at 76 (offset -1 lines).
    2 out of 4 hunks FAILED -- saving rejects to file src/Plugin/Block/AccessibilityTools.php.rej
    āžœ  accessibility_block git:(master) āœ— cd ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig accessibility_block/
    
    FILE: ...ssue-v9/web/modules/contrib/accessibility_block/accessibility_block.module
    --------------------------------------------------------------------------------
    FOUND 6 ERRORS AFFECTING 4 LINES
    --------------------------------------------------------------------------------
      1 | ERROR | [x] Missing file doc comment
      3 | ERROR | [x] Missing function doc comment
      4 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
     14 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
     14 | ERROR | [x] Expected 1 newline at end of file; 0 found
     14 | ERROR | [x] Closing brace indented incorrectly; expected 0 spaces, found
        |       |     2
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...odules/contrib/accessibility_block/src/Plugin/Block/AccessibilityTools.php
    --------------------------------------------------------------------------------
    FOUND 4 ERRORS AND 2 WARNINGS AFFECTING 6 LINES
    --------------------------------------------------------------------------------
     25 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
     26 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
     27 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
        |         |     injection instead
     40 | WARNING | [x] A comma should follow the last multiline array item. Found:
        |         |     $module_path
     55 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
     61 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    Time: 166ms; Memory: 10MB

    Kindly check

    Thanks,
    Jake

Production build 0.71.5 2024