Fix the issue reported by phpcs

Created on 27 September 2023, about 1 year ago
Updated 13 October 2023, about 1 year ago

Problem/Motivation

Getting following error/warnings:

FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\history_memory_calculator\css\style.css
-------------------------------------------------------------------------------------------
FOUND 100 ERRORS AFFECTING 100 LINES
-------------------------------------------------------------------------------------------
5 | ERROR | Style definitions must end with a semicolon
9 | ERROR | Style definitions must end with a semicolon
12 | ERROR | Style definitions must end with a semicolon
25 | ERROR | Style definitions must end with a semicolon
28 | ERROR | Style definitions must end with a semicolon
41 | ERROR | Style definitions must end with a semicolon
44 | ERROR | Style definitions must end with a semicolon
50 | ERROR | Style definitions must end with a semicolon
56 | ERROR | Style definitions must end with a semicolon
60 | ERROR | Style definitions must end with a semicolon
67 | ERROR | Style definitions must end with a semicolon
70 | ERROR | Style definitions must end with a semicolon
73 | ERROR | Style definitions must end with a semicolon
77 | ERROR | Style definitions must end with a semicolon
80 | ERROR | Style definitions must end with a semicolon
83 | ERROR | Style definitions must end with a semicolon
87 | ERROR | Style definitions must end with a semicolon
91 | ERROR | Style definitions must end with a semicolon
94 | ERROR | Style definitions must end with a semicolon
99 | ERROR | Style definitions must end with a semicolon
105 | ERROR | Style definitions must end with a semicolon
109 | ERROR | Style definitions must end with a semicolon
112 | ERROR | Style definitions must end with a semicolon
115 | ERROR | Style definitions must end with a semicolon
118 | ERROR | Style definitions must end with a semicolon
122 | ERROR | Style definitions must end with a semicolon
125 | ERROR | Style definitions must end with a semicolon
128 | ERROR | Style definitions must end with a semicolon
132 | ERROR | Style definitions must end with a semicolon
136 | ERROR | Style definitions must end with a semicolon
139 | ERROR | Style definitions must end with a semicolon
144 | ERROR | Style definitions must end with a semicolon
150 | ERROR | Style definitions must end with a semicolon
154 | ERROR | Style definitions must end with a semicolon
157 | ERROR | Style definitions must end with a semicolon
160 | ERROR | Style definitions must end with a semicolon
163 | ERROR | Style definitions must end with a semicolon
167 | ERROR | Style definitions must end with a semicolon
174 | ERROR | Style definitions must end with a semicolon
178 | ERROR | Style definitions must end with a semicolon
182 | ERROR | Style definitions must end with a semicolon
185 | ERROR | Style definitions must end with a semicolon
190 | ERROR | Style definitions must end with a semicolon
196 | ERROR | Style definitions must end with a semicolon
203 | ERROR | Style definitions must end with a semicolon
206 | ERROR | Style definitions must end with a semicolon
209 | ERROR | Style definitions must end with a semicolon
213 | ERROR | Style definitions must end with a semicolon
223 | ERROR | Style definitions must end with a semicolon
227 | ERROR | Style definitions must end with a semicolon
231 | ERROR | Style definitions must end with a semicolon
234 | ERROR | Style definitions must end with a semicolon
239 | ERROR | Style definitions must end with a semicolon
245 | ERROR | Style definitions must end with a semicolon
249 | ERROR | Style definitions must end with a semicolon
252 | ERROR | Style definitions must end with a semicolon
255 | ERROR | Style definitions must end with a semicolon
258 | ERROR | Style definitions must end with a semicolon
262 | ERROR | Style definitions must end with a semicolon
269 | ERROR | Style definitions must end with a semicolon
278 | ERROR | Style definitions must end with a semicolon
282 | ERROR | Style definitions must end with a semicolon
285 | ERROR | Style definitions must end with a semicolon
290 | ERROR | Style definitions must end with a semicolon
304 | ERROR | Style definitions must end with a semicolon
307 | ERROR | Style definitions must end with a semicolon
310 | ERROR | Style definitions must end with a semicolon
313 | ERROR | Style definitions must end with a semicolon
317 | ERROR | Style definitions must end with a semicolon
327 | ERROR | Style definitions must end with a semicolon
331 | ERROR | Style definitions must end with a semicolon
335 | ERROR | Style definitions must end with a semicolon
338 | ERROR | Style definitions must end with a semicolon
343 | ERROR | Style definitions must end with a semicolon
363 | ERROR | Style definitions must end with a semicolon
369 | ERROR | Style definitions must end with a semicolon
372 | ERROR | Style definitions must end with a semicolon
376 | ERROR | Style definitions must end with a semicolon
387 | ERROR | Style definitions must end with a semicolon
391 | ERROR | Style definitions must end with a semicolon
411 | ERROR | Style definitions must end with a semicolon
420 | ERROR | Style definitions must end with a semicolon
424 | ERROR | Style definitions must end with a semicolon
435 | ERROR | Style definitions must end with a semicolon
439 | ERROR | Style definitions must end with a semicolon
459 | ERROR | Style definitions must end with a semicolon
462 | ERROR | Style definitions must end with a semicolon
465 | ERROR | Style definitions must end with a semicolon
468 | ERROR | Style definitions must end with a semicolon
472 | ERROR | Style definitions must end with a semicolon
482 | ERROR | Style definitions must end with a semicolon
486 | ERROR | Style definitions must end with a semicolon
490 | ERROR | Style definitions must end with a semicolon
499 | ERROR | Style definitions must end with a semicolon
510 | ERROR | Style definitions must end with a semicolon
520 | ERROR | Style definitions must end with a semicolon
526 | ERROR | Style definitions must end with a semicolon
530 | ERROR | Style definitions must end with a semicolon
549 | ERROR | Style definitions must end with a semicolon
555 | ERROR | Style definitions must end with a semicolon
-------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\history_memory_calculator\history_memory_calculator.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\history_memory_calculator\history_memory_calculator.module
--------------------------------------------------------------------------------------------------------------
FOUND 24 ERRORS AND 1 WARNING AFFECTING 15 LINES
--------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
11 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
11 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
12 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
12 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 2
13 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
13 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 2
14 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
14 | ERROR | [x] Case breaking statement indented incorrectly; expected 4 spaces, found 2
15 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
15 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
16 | ERROR | [x] Expected 1 blank line after function; 0 found
18 | ERROR | [x] Expected 1 space(s) before asterisk; 0 found
19 | ERROR | [x] Expected 1 space(s) before asterisk; 0 found
19 | ERROR | [x] There must be no blank lines after the function comment
22 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
22 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
23 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
24 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
24 | ERROR | [x] Array indentation error, expected 4 spaces but found 3
25 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
25 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
26 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
27 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 25 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\history_memory_calculator\src\Plugin\Block\CalculatorBlock.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 44 ERRORS AND 1 WARNING AFFECTING 39 LINES
------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
7 | WARNING | [x] Unused use statement
19 | 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 4 spaces, found 6
24 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
25 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
27 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
30 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
31 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
32 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
32 | ERROR | [x] Short array syntax must be used to define arrays
33 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
33 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
34 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
36 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
38 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
39 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
44 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
45 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
46 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
48 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
51 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
52 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
53 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
55 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
59 | ERROR | [x] Expected 1 space before "??"; 0 found
59 | ERROR | [x] Expected 1 space after "??"; 0 found
60 | ERROR | [x] Short array syntax must be used to define arrays
65 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
66 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
68 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
71 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
72 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
73 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
75 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
78 | ERROR | [x] Doc comment long description must start with a capital letter
80 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
81 | ERROR | [x] Opening brace should be on the same line as the declaration
82 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
83 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
83 | ERROR | [x] Expected 1 blank line after function; 0 found
84 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
84 | ERROR | [x] The closing brace for the class must have an empty line before it
84 | ERROR | [x] Closing brace indented incorrectly; expected 0 spaces, found 2
------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 45 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------

Steps to reproduce

Run following command:

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

Proposed resolution

Above error/warnings need to be fixed.

📌 Task
Status

Fixed

Version

1.0

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 about 1 year ago
  • 🇮🇳India arti_parmar

    kindly review patch.

  • 🇬🇧United Kingdom schillerm

    Hi there, I tested the module (v 1.0.1) on a D10 site (v 10.1.4).
    Was able to see the phpcs errors. Applied #2 patch and rerun phpcs

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

    got the following back..

    FILE: /home/user/Documents/Sites/D10/web/modules/contrib/history_memory_calculator/src/Plugin/Block/CalculatorBlock.php
    -----------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------
    7 | WARNING | [x] Unused use statement
    -----------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------

    FILE: /home/user/Documents/Sites/D10/web/modules/contrib/history_memory_calculator/history_memory_calculator.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: /home/user/Documents/Sites/D10/web/modules/contrib/history_memory_calculator/PATCHES.txt
    ----------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    ----------------------------------------------------------------------------------------------------
    1 | WARNING | [ ] Line exceeds 80 characters; contains 104 characters
    5 | ERROR | [x] Expected 1 newline at end of file; 3 found
    ----------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------

    Time: 64ms; Memory: 12MB

    hope that helps..

  • Assigned to Gautam_105@
  • Issue was unassigned.
  • 🇮🇳India Gautam_105@

    hello schillerm, i have fixed code standard issue and created patch for same . Please test and review.
    Ans see attachment

  • Status changed to Fixed about 1 year ago
  • 🇮🇳India soumya soni indore

    I fixed this issue ,thankyou for your contribution.

  • Status changed to Fixed about 1 year ago
Production build 0.71.5 2024