Drupal Coding Standards Issues | phpcs

Created on 2 February 2023, almost 2 years ago
Updated 21 May 2024, 6 months ago

Problem/Motivation

Getting Following errors/warnings

$ phpcs --standard=Drupal content_to_group

FILE: ...dmin\Desktop\task\content_to_group\src\Form\ContentToGroupSettingsForm.php
--------------------------------------------------------------------------------
FOUND 7 ERRORS AND 1 WARNING AFFECTING 7 LINES
--------------------------------------------------------------------------------
  1 | ERROR   | [x] End of line character is invalid; expected "\n" but found
    |         |     "\r\n"
  9 | ERROR   | [x] Missing class doc comment
 25 | ERROR   | [x] Missing function doc comment
 45 | WARNING | [ ] Possible useless method overriding detected
 45 | ERROR   | [x] Missing function doc comment
 49 | ERROR   | [x] Missing function doc comment
 56 | ERROR   | [x] Expected 1 blank line after function; 2 found
 59 | 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: ...ers\Admin\Desktop\task\content_to_group\src\Util\ContentToGroupUtility.php
--------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 6 LINES
--------------------------------------------------------------------------------
  1 | ERROR | [x] End of line character is invalid; expected "\n" but found
    |       |     "\r\n"
  7 | ERROR | [x] Missing class doc comment
  9 | ERROR | [ ] Missing member variable doc comment
 11 | ERROR | [x] Missing function doc comment
 18 | ERROR | [ ] Description for the @return value is missing
 19 | ERROR | [x] Separate the @return and @throws sections by a blank line.
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...:\Users\Admin\Desktop\task\content_to_group\tests\src\Unit\HelpersTest.php
--------------------------------------------------------------------------------
FOUND 6 ERRORS AND 1 WARNING AFFECTING 7 LINES
--------------------------------------------------------------------------------
  1 | ERROR   | [x] End of line character is invalid; expected "\n" but found
    |         |     "\r\n"
  9 | ERROR   | [x] Missing class doc comment
 11 | ERROR   | [ ] Missing member variable doc comment
 25 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks,
    |         |     question marks, colons, or closing parentheses
 29 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks,
    |         |     question marks, colons, or closing parentheses
 33 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks,
    |         |     question marks, colons, or closing parentheses
 54 | WARNING | [x] A comma should follow the last multiline array item. Found:
    |         |     1
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 423ms; Memory: 8MB

Proposed resolution

Fix the errors and warnings.

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India Jay Jangid

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Jay Jangid
  • @jay-jangid opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review almost 2 years ago
  • 🇮🇳India Jay Jangid

    Created MR , please review.

    Thank you.

  • Status changed to Needs work about 1 year ago
  • 🇸🇳Senegal diaodiallo

    Thank you Jay, let's see if this is still an issue in alpha3.

  • Assigned to mohd sahzad
  • Issue was unassigned.
  • 🇮🇳India mohd sahzad

    I have updated for this error : Drupal Coding Standards Issues | phpcs, so please review and update status

  • 🇮🇳India sakthi_dev

    Still we have the following issue.

    FILE: /home/administrator/Projects/contrib/drupal/modules/contrib/content_to_group/content_to_group.info.yml
    ------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------
     5 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
    ------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/administrator/Projects/contrib/drupal/modules/contrib/content_to_group/README.md
    --------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------
     37 | WARNING | Line exceeds 80 characters; contains 97 characters
    --------------------------------------------------------------------------------------------
    
    
    FILE: /home/administrator/Projects/contrib/drupal/modules/contrib/content_to_group/src/Form/ContentToGroupSettingsForm.php
    --------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------------------
     34 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    --------------------------------------------------------------------------------------------------------------------------
    
    Time: 68ms; Memory: 10MB
    

    Resolved the issue now. Please review.

  • Status changed to Needs review about 1 year ago
  • 🇮🇳India mrinalini9 New Delhi

    Patch #7 needs review, so moving this to Needs Review.

  • 🇮🇳India mrinalini9 New Delhi

    Reviewed patch #7, looks good to me. It applied cleanly and fixed all the PHPCS issues.
    So, for me, it is RTBC.

    Thanks!

    • cf86e06e committed on 1.0.x
      Issue #3338502 by sakthi_dev, Jay Jangid, Mohd Sahzad, mrinalini9,...
  • Status changed to Fixed 7 months ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024