Drupal Coding Standards Issues | phpcs

Created on 24 January 2023, almost 2 years ago
Updated 25 January 2023, almost 2 years ago

Problem/Motivation

Getting Following errors/warnings

$ phpcs --standard=Drupal fieldmask

FILE: C:\Users\Admin\Desktop\task\fieldmask\js\fieldmask-admin.js
--------------------------------------------------------------------------------
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\fieldmask\js\fieldmask.js
--------------------------------------------------------------------------------
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\fieldmask\js\jquery.inputmask.js
--------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
--------------------------------------------------------------------------------
    1 | ERROR | [x] End of line character is invalid; expected "\n" but found
      |       |     "\r\n"
 1096 | ERROR | [x] Inline control structures are not allowed
 2227 | ERROR | [x] Inline control structures are not allowed
 2886 | ERROR | [x] Inline control structures are not allowed
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: C:\Users\Admin\Desktop\task\fieldmask\js\jquery.inputmask.min.js
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
 1 | WARNING | File appears to be minified and cannot be processed
----------------------------------------------------------------------


FILE: ...ktop\task\fieldmask\src\Plugin\Field\FieldFormatter\FieldMaskFormatter.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: ...sers\Admin\Desktop\task\fieldmask\src\Plugin\Field\FieldType\FieldMask.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: ...in\Desktop\task\fieldmask\src\Plugin\Field\FieldWidget\FieldMaskWidget.php
--------------------------------------------------------------------------------
FOUND 26 ERRORS AFFECTING 17 LINES
--------------------------------------------------------------------------------
   1 | ERROR | [x] End of line character is invalid; expected "\n" but found
     |       |     "\r\n"
  23 | ERROR | [ ] Missing member variable doc comment
  26 | ERROR | [x] Doc comment short description must end with a full stop
  27 | ERROR | [x] There must be exactly one blank line before the tags in a
     |       |     doc comment
  27 | ERROR | [ ] Description for the @return value is missing
  39 | ERROR | [x] Doc comment short description must end with a full stop
  40 | ERROR | [x] There must be exactly one blank line before the tags in a
     |       |     doc comment
  40 | ERROR | [ ] Missing parameter comment
  41 | ERROR | [ ] Missing parameter comment
  41 | ERROR | [x] Data types in @param tags need to be fully namespaced
  42 | ERROR | [x] Separate the @param and @return sections by a blank line.
  42 | ERROR | [ ] Description for the @return value is missing
  89 | ERROR | [x] Doc comment short description must end with a full stop
  90 | ERROR | [x] There must be exactly one blank line before the tags in a
     |       |     doc comment
  90 | ERROR | [ ] Description for the @return value is missing
 110 | ERROR | [x] Doc comment short description must end with a full stop
 111 | ERROR | [x] There must be exactly one blank line before the tags in a
     |       |     doc comment
 111 | ERROR | [ ] Missing parameter comment
 111 | ERROR | [x] Data types in @param tags need to be fully namespaced
 112 | ERROR | [ ] Missing parameter comment
 113 | ERROR | [ ] Missing parameter comment
 114 | ERROR | [ ] Missing parameter comment
 115 | ERROR | [ ] Missing parameter comment
 115 | ERROR | [x] Data types in @param tags need to be fully namespaced
 116 | ERROR | [x] Separate the @param and @return sections by a blank line.
 116 | ERROR | [ ] Description for the @return value is missing
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 14 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 1.16 secs; Memory: 124MB

Proposed resolution

Fix the errors and warnings.

🐛 Bug report
Status

Fixed

Version

8.0

Component

Code

Created by

🇮🇳India jay jangid Jaipur

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.
  • 🇮🇳India jay jangid Jaipur

    Created MR , please review.

    Thank you.

  • Issue was unassigned.
  • 🇮🇳India Sonal Gyanani

    Thanks @Jay Jangid, but still there were some warnings in the following files

    FILE: ...x-dev\modules\fieldmask\src\Plugin\Field\FieldType\FieldMask.php
    ----------------------------------------------------------------------
    FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
    ----------------------------------------------------------------------
      79 | WARNING | [ ] t() calls should be avoided in classes, use
         |         |     \Drupal\Core\StringTranslation\StringTranslationTrait
         |         |     and $this->t() instead
     108 | WARNING | [ ] t() calls should be avoided in classes, use
         |         |     \Drupal\Core\StringTranslation\StringTranslationTrait
         |         |     and $this->t() instead
     111 | WARNING | [ ] t() calls should be avoided in classes, use
         |         |     \Drupal\Core\StringTranslation\StringTranslationTrait
         |         |     and $this->t() instead
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
    
    FILE: ...dules\fieldmask\src\Plugin\Field\FieldWidget\FieldMaskWidget.php
    ----------------------------------------------------------------------
    FOUND 1 ERROR AND 7 WARNINGS AFFECTING 8 LINES
    ----------------------------------------------------------------------
      63 | WARNING | [ ] t() calls should be avoided in classes, use
         |         |     \Drupal\Core\StringTranslation\StringTranslationTrait
         |         |     and $this->t() instead
      70 | WARNING | [ ] t() calls should be avoided in classes, use
         |         |     \Drupal\Core\StringTranslation\StringTranslationTrait
         |         |     and $this->t() instead
      72 | WARNING | [ ] t() calls should be avoided in classes, use
         |         |     \Drupal\Core\StringTranslation\StringTranslationTrait
         |         |     and $this->t() instead
     109 | WARNING | [ ] t() calls should be avoided in classes, use
         |         |     \Drupal\Core\StringTranslation\StringTranslationTrait
         |         |     and $this->t() instead
     111 | WARNING | [ ] t() calls should be avoided in classes, use
         |         |     \Drupal\Core\StringTranslation\StringTranslationTrait
         |         |     and $this->t() instead
     114 | WARNING | [ ] t() calls should be avoided in classes, use
         |         |     \Drupal\Core\StringTranslation\StringTranslationTrait
         |         |     and $this->t() instead
     117 | WARNING | [ ] t() calls should be avoided in classes, use
         |         |     \Drupal\Core\StringTranslation\StringTranslationTrait
         |         |     and $this->t() instead
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
    

    That I fixed in MR.
    Please review.

  • Assigned to Charchil Khandelwal
  • Issue was unassigned.
  • Status changed to RTBC almost 2 years ago
  • 🇮🇳India Charchil Khandelwal

    All errors and warnings are fixed now.
    So moving to RTBC.

  • 🇮🇳India heni_deepak Jaipur, Rajasthan, India
  • Status changed to Fixed almost 2 years ago
  • 🇮🇳India heni_deepak Jaipur, Rajasthan, India
Production build 0.71.5 2024