Fix the issues reported by phpcs

Created on 27 November 2023, 7 months ago
Updated 2 December 2023, 7 months ago

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/time_clock/css/custom.css
--------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------
 1 | 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/time_clock/README.md
-----------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
-----------------------------------------------------------------------
 6 | WARNING | [ ] Line exceeds 80 characters; contains 104 characters
 7 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
 8 | 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/time_clock/src/Form/timeClockForm.php
---------------------------------------------------------------------------------------------------------------------------------------
FOUND 67 ERRORS AND 4 WARNINGS AFFECTING 61 LINES
---------------------------------------------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] The PHP open tag must be followed by exactly one blank line
   2 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 2
   2 | ERROR   | [x] There must be one blank line after the namespace declaration
   3 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 2
   4 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 2
   5 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 2
   5 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal/Core/Config/ConfigFactoryInterface.
   6 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 2
   7 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 2
   9 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 2
   9 | ERROR   | [x] Missing class doc comment
   9 | ERROR   | [ ] Class name must begin with a capital letter
  11 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  16 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  18 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  24 | ERROR   | [ ] Parameter tags must be grouped together in a doc comment
  27 | ERROR   | [x] Additional blank lines found at end of doc comment
  28 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  28 | ERROR   | [x] Whitespace found at end of line
  30 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  31 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  32 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  34 | 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 4 spaces, found 6
  42 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  44 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  47 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  48 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  49 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  51 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  54 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  55 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  56 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  58 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  61 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  62 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  63 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  63 | ERROR   | [x] Short array syntax must be used to define arrays
  64 | ERROR   | [x] Whitespace found at end of line
  65 | ERROR   | [x] Whitespace found at end of line
  66 | ERROR   | [x] Whitespace found at end of line
  67 | ERROR   | [x] Whitespace found at end of line
  68 | ERROR   | [x] Whitespace found at end of line
  71 | WARNING | [x] A comma should follow the last multiline array item. Found: )
  73 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  73 | ERROR   | [x] Short array syntax must be used to define arrays
  73 | ERROR   | [x] There must be no space between the "array" keyword and the opening parenthesis
  80 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  88 | WARNING | [x] A comma should follow the last multiline array item. Found: )
  91 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  94 | WARNING | [x] A comma should follow the last multiline array item. Found: )
  96 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  99 | WARNING | [x] A comma should follow the last multiline array item. Found: )
 102 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 103 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 105 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 105 | ERROR   | [x] Whitespace found at end of line
 107 | ERROR   | [x] Whitespace found at end of line
 108 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 109 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 110 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 111 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 112 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 113 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 114 | ERROR   | [x] Whitespace found at end of line
 115 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 115 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 116 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 122 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 124 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 2
---------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 69 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/modules/contrib/time_clock/src/Plugin/Block/timeClockBlock.php
-------------------------------------------------------------------------------------------------------------------------------
FOUND 98 ERRORS AND 1 WARNING AFFECTING 80 LINES
-------------------------------------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] The PHP open tag must be followed by exactly one blank line
   2 | ERROR   | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
   2 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 2
   3 | ERROR   | [x] Doc comment short description must end with a full stop
   5 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 2
   7 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 2
   8 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 2
   9 | WARNING | [x] Unused use statement
   9 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 2
   9 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal/Core/Cache/Cache.
  10 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 2
  11 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 2
  12 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 2
  14 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 2
  23 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 2
  23 | ERROR   | [ ] Class name must begin with a capital letter
  25 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  30 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  32 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  37 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  39 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  45 | ERROR   | [ ] Parameter tags must be grouped together in a doc comment
  48 | ERROR   | [ ] Parameter tags must be grouped together in a doc comment
  51 | ERROR   | [ ] Parameter tags must be grouped together in a doc comment
  54 | ERROR   | [ ] Parameter tags must be grouped together in a doc comment
  57 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  57 | ERROR   | [x] Multi-line function declarations must define one parameter per line
  57 | ERROR   | [x] Multi-line function declarations must define one parameter per line
  57 | ERROR   | [x] Whitespace found at end of line
  58 | ERROR   | [x] Expected 1 space between type hint and argument "$date_formatter"; 2 found
  58 | ERROR   | [x] Multi-line function declarations must define one parameter per line
  59 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  60 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  61 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  62 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  64 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  67 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  68 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  75 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  77 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  80 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  81 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  82 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  83 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  83 | ERROR   | [x] No space found before comment text; expected "// dd($timezone);" but found "//dd($timezone);"
  84 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  85 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  86 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
  87 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  87 | ERROR   | [x] Expected newline after closing brace
  88 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
  89 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  89 | ERROR   | [x] Expected newline after closing brace
  90 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
  91 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  91 | ERROR   | [x] Expected newline after closing brace
  92 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
  93 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  94 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  95 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  96 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
  97 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
  97 | ERROR   | [x] Expected newline after closing brace
  98 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
  99 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 100 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 101 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 102 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
 102 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 103 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
 104 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
 105 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
 106 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 10
 107 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
 107 | ERROR   | [x] Expected newline after closing brace
 108 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 10
 109 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
 110 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
 112 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
 112 | ERROR   | [x] Short array syntax must be used to define arrays
 116 | ERROR   | [x] Whitespace found at end of line
 118 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 119 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 120 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 120 | ERROR   | [x] Short array syntax must be used to define arrays
 121 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 122 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 123 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 124 | ERROR   | [x] Whitespace found at end of line
 125 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 126 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 128 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 128 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 129 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 129 | ERROR   | [x] You must use "/**" style comments for a function comment
 130 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 131 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 132 | ERROR   | [x] Whitespace found at end of line
 133 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 2
-------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 94 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/modules/contrib/time_clock/time_clock.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: /var/www/html/modules/contrib/time_clock/time_clock.libraries.yml
------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------
 13 | 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/time_clock/time_clock.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/time_clock/time_clock.module
----------------------------------------------------------------------------------
FOUND 4 ERRORS AND 2 WARNINGS AFFECTING 6 LINES
----------------------------------------------------------------------------------
  1 | ERROR   | [x] Missing file doc comment
 29 | ERROR   | [x] Short array syntax must be used to define arrays
 30 | ERROR   | [x] Short array syntax must be used to define arrays
 31 | ERROR   | [x] Short array syntax must be used to define arrays
 33 | WARNING | [x] A comma should follow the last multiline array item. Found: )
 34 | WARNING | [x] A comma should follow the last multiline array item. Found: )
----------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 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 modules/contrib/time_clock/

Proposed resolution
Above error/warnings need to be fixed.

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India adityarawat_ln

Live updates comments and jobs are added and updated live.
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.

  • 🇮🇳India hemant-gupta New Delhi

    Issues fixed as suggested by PHPCS.

  • Status changed to Needs review 7 months ago
  • 🇮🇳India hemant-gupta New Delhi
  • 🇮🇳India adityarawat_ln

    Still Getting following error/warnings.

    /var/www/html/modules/contrib/time_clock/src/Form/TimeClockForm.php
    -------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------
     31 | ERROR | [x] Whitespace found at end of line
    -------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------
    
    
    /var/www/html/modules/contrib/time_clock/src/Plugin/Block/TimeClockBlock.php
    ----------------------------------------------------------------------------------------------------
    FOUND 5 ERRORS AFFECTING 5 LINES
    ----------------------------------------------------------------------------------------------------
       2 | ERROR | [x] Whitespace found at end of line
     107 | ERROR | [x] Whitespace found at end of line
     120 | ERROR | [x] Short array syntax must be used to define arrays
     132 | ERROR | [x] Expected 1 blank line after function; 0 found
     133 | ERROR | [x] The closing brace for the class must have an empty line before it
    ----------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------
    
    
    /var/www/html/modules/contrib/time_clock/time_clock.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
    -------------------------------------------------------------------------------------------------------------
    
    
    /var/www/html/modules/contrib/time_clock/time_clock.module
    ----------------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 3 LINES
    ----------------------------------------------------------------------------------
      6 | ERROR | [x] There must be exactly one blank line after the file comment
     34 | ERROR | [x] Short array syntax must be used to define arrays
     35 | ERROR | [x] Short array syntax must be used to define arrays
    ----------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 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 modules/contrib/time_clock/

  • Status changed to Needs work 7 months ago
  • Status changed to Needs review 7 months ago
  • 🇮🇳India hemant-gupta New Delhi

    It's fixed now and no "project", "datestamp" or "version" key is present in the info.yml as the log shows. May be You tried to check the downloaded version on your disk, this doesn't check the code in the repository so you can close it.

  • Status changed to Fixed 7 months ago
  • 🇮🇳India hemant-gupta New Delhi

    Thanks for feedback!

  • Status changed to Fixed 7 months ago
  • 🇮🇳India hemant-gupta New Delhi
Production build 0.69.0 2024