Fix Drupal coding standards | phpcs

Created on 18 January 2023, about 2 years ago
Updated 12 July 2024, 7 months ago

Problem/Motivation

Getting following Errors and Warnings.

FILE: /var/www/html/web/modules/contrib/lagoon_logs/LICENSE.txt
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 339 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: /var/www/html/web/modules/contrib/lagoon_logs/README.md
------------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 3 LINES
------------------------------------------------------------------------
  3 | WARNING | [ ] Line exceeds 80 characters; contains 123 characters
 19 | WARNING | [ ] Line exceeds 80 characters; contains 159 characters
 24 | WARNING | [ ] Line exceeds 80 characters; contains 183 characters
 24 | ERROR   | [x] Expected 1 newline at end of file; 0 found
------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------


FILE: /var/www/html/web/modules/contrib/lagoon_logs/src/Form/LagoonLogsSettingsForm.php
------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 4 WARNINGS AFFECTING 6 LINES
------------------------------------------------------------------------------------------------------------------------------------------------
  7 | WARNING | [x] Unused use statement
 47 | ERROR   | [ ] Concatenating translatable strings is not allowed, use placeholders instead and only one string literal
 48 | ERROR   | [ ] String concat is not required here; use a single string instead
 49 | WARNING | [ ] Do not concatenate strings to translatable strings, they should be part of the t() argument and you should use placeholders
 50 | WARNING | [ ] Do not concatenate strings to translatable strings, they should be part of the t() argument and you should use placeholders
 51 | WARNING | [ ] Do not concatenate strings to translatable strings, they should be part of the t() argument and you should use placeholders
------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/contrib/lagoon_logs/src/LagoonLogsLogProcessor.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 10 ERRORS AND 1 WARNING AFFECTING 9 LINES
------------------------------------------------------------------------------------------------------------------------------
  5 | WARNING | [x] There must be no blank line following an inline comment
  5 | ERROR   | [x] Inline comments must start with a capital letter
  5 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  7 | ERROR   | [x] You must use "/**" style comments for a class comment
  9 | ERROR   | [ ] Missing member variable doc comment
 11 | ERROR   | [x] Missing function doc comment
 15 | ERROR   | [ ] Missing short description in doc comment
 16 | ERROR   | [ ] Missing parameter comment
 18 | ERROR   | [ ] Description for the @return value is missing
 27 | ERROR   | [x] Expected 1 blank line after function; 0 found
 28 | ERROR   | [x] The closing brace for the class must have an empty line before it
------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/contrib/lagoon_logs/src/Logger/LagoonLogsFormatter.php
--------------------------------------------------------------------------------------
FOUND 7 ERRORS AFFECTING 7 LINES
--------------------------------------------------------------------------------------
  1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
  8 | ERROR | [x] There must be one blank line after the last USE statement; 2 found;
 12 | ERROR | [x] Doc comment short description must end with a full stop
 15 | ERROR | [x] Doc comment long description must end with a full stop
 21 | ERROR | [x] Missing function doc comment
 62 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
 64 | ERROR | [x] Closing brace indented incorrectly; expected 8 spaces, found 6
--------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/contrib/lagoon_logs/src/Logger/LagoonLogsLogger.php
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 36 ERRORS AND 5 WARNINGS AFFECTING 28 LINES
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
   5 | WARNING | [x] Unused use statement
   9 | WARNING | [x] Unused use statement
  15 | WARNING | [x] Unused use statement
  16 | ERROR   | [x] There must be one blank line after the last USE statement; 2 found;
  19 | ERROR   | [x] Missing class doc comment
  25 | WARNING | [ ] Line exceeds 80 characters; contains 109 characters
  25 | ERROR   | [x] No space found before comment text; expected "// will be used when new release of monolog is available" but found "//will be used when new
     |         |     release of monolog is available"
  25 | ERROR   | [x] Inline comments must start with a capital letter
  25 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  25 | ERROR   | [x] Comments may not appear after statements
  29 | ERROR   | [x] No space found before comment text; expected "// The following is used to log Lagoon Logs issues if logging target" but found "//The following
     |         |     is used to log Lagoon Logs issues if logging target"
  30 | ERROR   | [x] No space found before comment text; expected "// cannot be reached." but found "//cannot be reached."
  33 | WARNING | [x] There must be no blank line following an inline comment
  33 | ERROR   | [x] Inline comments must start with a capital letter
  33 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  35 | ERROR   | [x] You must use "/**" style comments for a member variable comment
  37 | ERROR   | [ ] Missing member variable doc comment
  39 | ERROR   | [ ] Missing member variable doc comment
  41 | ERROR   | [ ] Missing member variable doc comment
  46 | ERROR   | [ ] Doc comment short description must end with a full stop
  46 | ERROR   | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
  62 | ERROR   | [x] Missing function doc comment
  62 | ERROR   | [x] Expected 1 blank line before function; 2 found
  72 | ERROR   | [x] Expected 1 blank line after function; 2 found
  75 | ERROR   | [ ] Missing short description in doc comment
  76 | ERROR   | [ ] Missing parameter comment
  76 | ERROR   | [ ] Missing parameter type
  77 | ERROR   | [ ] Missing parameter comment
  77 | ERROR   | [ ] Missing parameter type
  78 | ERROR   | [ ] Missing parameter comment
  79 | ERROR   | [ ] Missing parameter comment
  79 | ERROR   | [ ] Missing parameter type
  81 | ERROR   | [ ] Description for the @return value is missing
  99 | ERROR   | [x] Expected 1 blank line after function; 2 found
 102 | ERROR   | [x] Missing function doc comment
 102 | ERROR   | [ ] Protected method name "LagoonLogsLogger::mapRFCtoMonologLevels" is not in lowerCamel format
 106 | ERROR   | [x] Missing function doc comment
 106 | ERROR   | [ ] Protected method name "LagoonLogsLogger::getRFCLevelName" is not in lowerCamel format
 133 | ERROR   | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
 138 | ERROR   | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
 164 | ERROR   | [x] Expected newline after closing brace
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 24 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/contrib/lagoon_logs/src/Logger/LagoonLogsLoggerFactory.php
------------------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 5 LINES
------------------------------------------------------------------------------------------
  8 | ERROR | [x] Missing class doc comment
 15 | ERROR | [x] Missing function doc comment
 15 | ERROR | [x] Expected 1 blank line before function; 2 found
 24 | ERROR | [x] Missing function doc comment
 32 | ERROR | [x] Expected 1 blank line after function; 0 found
 33 | ERROR | [x] The closing brace for the class must have an empty line before it
------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------

Time: 739ms; Memory: 4MB

Steps to reproduce

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

🐛 Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

🇮🇳India irfan.gul

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.

  • Issue was unassigned.
  • Status changed to Needs review about 2 years ago
  • 🇮🇳India riddhi.addweb

    I applied the patch and it had been applied cleanly, but after applying the patch there were some errors displayed. Please review it once and let me know if this needs to be resolved or not.

    FILE: /var/www/html/web/drupal10/web/modules/contrib/lagoon_logs/src/Logger/LagoonLogsLoggerFactory.php
    -------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------
     22 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
    -------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/web/drupal10/web/modules/contrib/lagoon_logs/src/Logger/LagoonLogsLogger.php
    ---------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------
     7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Logger\RfcLoggerTrait.
    ---------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/web/drupal10/web/modules/contrib/lagoon_logs/src/Form/LagoonLogsSettingsForm.php
    --------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AND 3 WARNINGS AFFECTING 5 LINES
    --------------------------------------------------------------------------------------------------------------------------------------------
     46 | ERROR   | Concatenating translatable strings is not allowed, use placeholders instead and only one string literal
     47 | ERROR   | String concat is not required here; use a single string instead
     48 | WARNING | Do not concatenate strings to translatable strings, they should be part of the t() argument and you should use placeholders
     49 | WARNING | Do not concatenate strings to translatable strings, they should be part of the t() argument and you should use placeholders
     50 | WARNING | Do not concatenate strings to translatable strings, they should be part of the t() argument and you should use placeholders
    --------------------------------------------------------------------------------------------------------------------------------------------
    
  • Status changed to Needs work 7 months ago
Production build 0.71.5 2024