Fix the issues reported by phpcs

Created on 31 January 2023, over 1 year ago
Updated 19 July 2024, about 2 months ago

Command and arguments used for this issue is:-
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,css,js,txt,md,yml web/modules/custom/image_slideshow_demo

FILE: C:\xampp\htdocs\contribution\web\modules\contrib\image_slideshow_demo\new_custom_pdp\css\bootstrap.min.css
----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------
1 | WARNING | File appears to be minified and cannot be processed
----------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\contribution\web\modules\contrib\image_slideshow_demo\new_custom_pdp\css\owl.carousel.min.css
-------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------
1 | WARNING | File appears to be minified and cannot be processed
-------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\contribution\web\modules\contrib\image_slideshow_demo\new_custom_pdp\css\owl.theme.default.min.css
------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------
1 | WARNING | File appears to be minified and cannot be processed
------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\contribution\web\modules\contrib\image_slideshow_demo\new_custom_pdp\css\new.css
------------------------------------------------------------------------------------------------------
FOUND 40 ERRORS AFFECTING 22 LINES
------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
1 | ERROR | [x] Expected 1 space before opening brace of class definition; 0 found
2 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
2 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
3 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
4 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
4 | ERROR | [x] Expected 1 space before opening brace of class definition; 0 found
4 | ERROR | [x] Opening brace should be the last content on the line
4 | ERROR | [ ] Class definition is empty
4 | ERROR | [x] Closing brace of class definition must be on new line
5 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
5 | ERROR | [x] Expected 1 space before opening brace of class definition; 0 found
6 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
6 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
7 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
8 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
8 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
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 2
13 | ERROR | [x] Expected 1 space before opening brace of class definition; 0 found
14 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
14 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
15 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
15 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
16 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
17 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
17 | ERROR | [x] Expected 1 space before opening brace of class definition; 0 found
18 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
18 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
19 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
19 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
20 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
20 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
21 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
21 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
22 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
22 | ERROR | [x] Expected 1 newline at end of file; 0 found
------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 39 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\contribution\web\modules\contrib\image_slideshow_demo\new_custom_pdp\new_custom_pdp.install
-----------------------------------------------------------------------------------------------------------------
FOUND 28 ERRORS AFFECTING 18 LINES
-----------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
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"
3 | ERROR | [x] Whitespace found at end of line
5 | ERROR | [x] Expected 1 blank line before function; 0 found
7 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
8 | 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
11 | ERROR | [x] Expected 1 space after IF keyword; 0 found
11 | ERROR | [ ] sizeof() is a function name alias, use count() instead
11 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
12 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
13 | ERROR | [x] Whitespace found at end of line
14 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
15 | ERROR | [x] Whitespace found at end of line
16 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
17 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
20 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
20 | ERROR | [x] Expected 1 space after IF keyword; 0 found
20 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
20 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
21 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 10
22 | ERROR | [x] Whitespace found at end of line
23 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
24 | ERROR | [x] Expected 1 newline at end of file; 0 found
24 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
24 | ERROR | [x] Closing brace indented incorrectly; expected 0 spaces, found 2
-----------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 27 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\contribution\web\modules\contrib\image_slideshow_demo\new_custom_pdp\new_custom_pdp.module
----------------------------------------------------------------------------------------------------------------
FOUND 12 ERRORS AFFECTING 8 LINES
----------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
3 | ERROR | [x] Missing function doc comment
5 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
7 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
7 | ERROR | [x] Expected 1 space after IF keyword; 0 found
7 | ERROR | [x] Expected 1 space after closing parenthesis; found 6
10 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
11 | ERROR | [x] Whitespace found at end of line
11 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
12 | ERROR | [x] Whitespace found at end of line
13 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 12 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------

šŸ“Œ Task
Status

Closed: duplicate

Component

Code

Created by

šŸ‡®šŸ‡³India akshay.kelotra Indore

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.

  • Needs reroll

    The patch will have to be re-rolled with new suggestions/changes described in the comments in the issue.

Sign in to follow issues

Comments & Activities

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

    I have fixed this issue and providing a patch.

  • Assigned to Charchil Khandelwal
  • @charchil-khandelwal opened merge request.
  • Issue was unassigned.
  • šŸ‡®šŸ‡³India Charchil Khandelwal

    Created MR for this issue.
    Please review.

  • Status changed to Needs work about 1 year ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    The issue summary should always describe what the issue is trying to fix and, in the case of coding standards issues, show which command and arguments have been used and which report that command shown. In this way, project maintainers can verify the patch/MR fixes all the warnings/errors.

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

    Hi,
    I have added the command and arguments has been used for this issue.
    Please review.

    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,css,js,txt,md,yml web/modules/custom/image_slideshow_demo

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Status changed to RTBC about 2 months ago
  • Hi @akshay.kelotra,

    I applied the patch you provided, it was applied successfully but there are still errors reported. Please see below:

    image_slideshow_demo git:(main) curl https://www.drupal.org/files/issues/2023-01-31/drupal-coding-standard-issue-3337843-1.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  342k  100  342k    0     0   397k      0 --:--:-- --:--:-- --:--:--  404k
    patching file new_custom_pdp/css/bootstrap.min.css
    patching file new_custom_pdp/css/new.css
    patching file new_custom_pdp/css/owl.carousel.min.css
    patching file new_custom_pdp/css/owl.theme.default.min.css
    patching file new_custom_pdp/new_custom_pdp.install
    patching file new_custom_pdp/new_custom_pdp.module
    āžœ  image_slideshow_demo git:(main) āœ— cd ..
    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig image_slideshow_demo
    
    FILE: /Users/PrometInterns/Demo-site/drupal-orgissue/web/modules/contrib/image_slideshow_demo/new_custom_pdp/config/install/field.storage.node.field_zoom.yml
    -------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------------------------------------
     30 | ERROR | [x] Expected 1 newline at end of file; 0 found
    -------------------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/PrometInterns/Demo-site/drupal-orgissue/web/modules/contrib/image_slideshow_demo/new_custom_pdp/new_custom_pdp.libraries.yml
    -----------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------------------
     19 | ERROR | [x] Expected 1 newline at end of file; 0 found
    -----------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/PrometInterns/Demo-site/drupal-orgissue/web/modules/contrib/image_slideshow_demo/new_custom_pdp/new_custom_pdp.info.yml
    ------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------------
     8 | ERROR | [x] Expected 1 newline at end of file; 0 found
    ------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 126ms; Memory: 10MB

    On the other hand, I applied the changes @Charchil Khandelwal's made on MR!1, it was also applied successfully and it did fix all reported errors.

    image_slideshow_demo git:(main) curl https://git.drupalcode.org/project/image_slideshow_demo/-/merge_requests/1.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  344k    0  344k    0     0   657k      0 --:--:-- --:--:-- --:--:--  675k
    patching file new_custom_pdp/config/install/field.storage.node.field_zoom.yml
    patching file new_custom_pdp/css/bootstrap.min.css
    patching file new_custom_pdp/css/new.css
    patching file new_custom_pdp/css/owl.carousel.min.css
    patching file new_custom_pdp/css/owl.theme.default.min.css
    patching file new_custom_pdp/new_custom_pdp.info.yml
    patching file new_custom_pdp/new_custom_pdp.install
    patching file new_custom_pdp/new_custom_pdp.libraries.yml
    patching file new_custom_pdp/new_custom_pdp.module
    āžœ  image_slideshow_demo git:(main) āœ— cd ..
    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig image_slideshow_demo
    āžœ  contrib git:(main) āœ—

    Will now move this to RTBC

    Thanks,
    Jake

  • Status changed to Needs work about 2 months ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    Let's create a merge request, now that patches are no longer tested.

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    The bad news is that, since the existing merge request changed the main branch, its changes are kept on any new branch created on this issue, which is bad, since that merge request changed files that should not have been changed, like the new_custom_pdp/css/bootstrap.min.css file.

    The only way to create a correct merge request is to create a new issue.

  • Status changed to Closed: duplicate about 2 months ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
Production build 0.71.5 2024