Drupal Coding Standards Issues | phpcs

Created on 1 February 2023, over 1 year ago
Updated 7 February 2023, over 1 year ago

Problem/Motivation

Getting Following errors/warnings

$ phpcs --standard=Drupal stackpath

FILE: ...\Users\Admin\Desktop\task\stackpath\src\Entity\StackPathPurgerSettings.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but found
   |       |     "\r\n"
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: C:\Users\Admin\Desktop\task\stackpath\src\Event\StackPathPurgerEvents.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but found
   |       |     "\r\n"
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...Users\Admin\Desktop\task\stackpath\src\Event\StackPathPurgerItemsAlter.php
--------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
--------------------------------------------------------------------------------
  1 | ERROR | [x] End of line character is invalid; expected "\n" but found
    |       |     "\r\n"
 33 | ERROR | [ ] Missing parameter comment
 34 | ERROR | [ ] Missing parameter comment
 54 | ERROR | [ ] Missing parameter comment
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...\Users\Admin\Desktop\task\stackpath\src\Form\StackPathPurgerConfigForm.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
  1 | ERROR | [x] End of line character is invalid; expected "\n" but found
    |       |     "\r\n"
 10 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be
    |       |     referenced with use statements
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...top\task\stackpath\src\Plugin\Purge\DiagnosticCheck\ConfigurationCheck.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but found
   |       |     "\r\n"
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...s\Admin\Desktop\task\stackpath\src\Plugin\Purge\Purger\StackPathPurger.php
--------------------------------------------------------------------------------
FOUND 6 ERRORS AND 2 WARNINGS AFFECTING 8 LINES
--------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found
     |         |     "\r\n"
  13 | ERROR   | [x] Non-namespaced classes/interfaces/traits should not be
     |         |     referenced with use statements
  14 | ERROR   | [x] Non-namespaced classes/interfaces/traits should not be
     |         |     referenced with use statements
  17 | ERROR   | [x] Non-namespaced classes/interfaces/traits should not be
     |         |     referenced with use statements
 135 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
 149 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
 190 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
 281 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...Desktop\task\stackpath\src\Plugin\Purge\TagsHeader\StackPathTagsHeader.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but found
   |       |     "\r\n"
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: C:\Users\Admin\Desktop\task\stackpath\src\StackPathApi.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
--------------------------------------------------------------------------------
  1 | ERROR   | [x] End of line character is invalid; expected "\n" but found
    |         |     "\r\n"
 10 | ERROR   | [x] Non-namespaced classes/interfaces/traits should not be
    |         |     referenced with use statements
 17 | WARNING | [ ] The class short comment should describe what the class does
    |         |     and not simply repeat the class name
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 580ms; Memory: 10MB

Proposed resolution

Fix the errors and warnings.

🐛 Bug report
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 over 1 year ago
  • 🇮🇳India Jay Jangid

    Created MR , please review.

    Thank you.

  • 🇵🇹Portugal jcnventura

    There were a few extra coding standards after applying the MR:

    FILE: /home/jcv/drupal/git/stackpath/README.md
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------
     16 | WARNING | Line exceeds 80 characters; contains 98 characters
    ----------------------------------------------------------------------
    
    
    FILE: /home/jcv/drupal/git/stackpath/src/StackPathApi.php
    ---------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 2 WARNINGS AFFECTING 2 LINES
    ---------------------------------------------------------------------------------------------------------------------
     10 | WARNING | [x] Unused use statement
     10 | ERROR   | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
     17 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
    ---------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/jcv/drupal/git/stackpath/stackpath.services.yml
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
     4 | ERROR | [x] Expected 1 newline at end of file; 0 found
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
  • Status changed to Needs work over 1 year ago
    • jcnventura authored 91f4fdab on 8.x-1.x
      Issue #3338218 by Jay Jangid, jcnventura: Drupal Coding Standards Issues...
  • Status changed to Fixed over 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024