Drupal Coding Standards Issues | phpcs

Created on 20 January 2023, almost 2 years ago

Problem/Motivation

Getting Following errors/warnings

$ phpcs --standard=Drupal condition_field

FILE: ...:\Users\Admin\Desktop\task\condition_field\src\ConditionAccessResolver.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
--------------------------------------------------------------------------------
  1 | ERROR   | [x] End of line character is invalid; expected "\n" but found
    |         |     "\r\n"
 14 | WARNING | [x] 'TODO: do more conditions related work.' should match the
    |         |     format '@todo Fix problem X here.'
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...Users\Admin\Desktop\task\condition_field\src\Plugin\ConditionFieldData.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"
 11 | WARNING | [ ] The class short comment should describe what the class does
    |         |     and not simply repeat the class name
 14 | ERROR   | [ ] Missing member variable doc comment
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...ondition_field\src\Plugin\Field\FieldFormatter\ConditionFieldFormatter.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"
  94 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
 105 | WARNING | [x] A comma should follow the last multiline array item.
     |         |     Found: $summaries
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...top\task\condition_field\src\Plugin\Field\FieldType\ConditionFieldItem.php
--------------------------------------------------------------------------------
FOUND 4 ERRORS AND 9 WARNINGS AFFECTING 8 LINES
--------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found
     |         |     "\r\n"
  51 | WARNING | [x] 'TODO:' should match the format '@todo Fix problem X
     |         |     here.'
  52 | WARNING | [x] There must be no blank line following an inline comment
  52 | ERROR   | [x] No space found before comment text; expected "//
     |         |     ->setClass('\Drupal\ino_pt_vgroup\VisibilityCondition');"
     |         |     but found
     |         |     "//->setClass('\Drupal\ino_pt_vgroup\VisibilityCondition');"
  52 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks,
     |         |     question marks, colons, or closing parentheses
  62 | WARNING | [x] There must be no blank line following an inline comment
  62 | WARNING | [x] 'TODO: set up proper storage.' should match the format
     |         |     '@todo Fix problem X here.'
  96 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
 130 | WARNING | [ ] Line exceeds 80 characters; contains 90 characters
 130 | ERROR   | [x] No space found before comment text; expected "//
     |         |     $constraint_manager =
     |         |     \Drupal::typedDataManager()->getValidationConstraintManager();"
     |         |     but found "//$constraint_manager =
     |         |     \Drupal::typedDataManager()->getValidationConstraintManager();"
 133 | WARNING | [x] There must be no blank line following an inline comment
 133 | WARNING | [x] 'TODO: add validation constraints.' should match the
     |         |     format '@todo Fix problem X here.'
 143 | WARNING | [x] 'TODO: set some random values.' should match the format
     |         |     '@todo Fix problem X here.'
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 12 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...ndition_field\src\Plugin\Field\FieldWidget\ConditionFieldDefaultWidget.php
--------------------------------------------------------------------------------
FOUND 8 ERRORS AND 11 WARNINGS AFFECTING 15 LINES
--------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found
     |         |     "\r\n"
  14 | WARNING | [x] Unused use statement
  81 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  82 | WARNING | [x] 'TODO: condition plugins.' should match the format '@todo
     |         |     Fix problem X here.'
  82 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  83 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  92 | WARNING | [x] There must be no blank line following an inline comment
  92 | WARNING | [x] 'TODO: condition plugin checkboxes.' should match the
     |         |     format '@todo Fix problem X here.'
 103 | WARNING | [x] There must be no blank line following an inline comment
 103 | WARNING | [x] 'TODO: show selected condition plugins.' should match the
     |         |     format '@todo Fix problem X here.'
 117 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
 119 | WARNING | [x] 'TODO' should match the format '@todo Fix problem X here.'
 119 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks,
     |         |     question marks, colons, or closing parentheses
 121 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 145 | WARNING | [x] 'TODO: use something nicer here for unique field names.'
     |         |     should match the format '@todo Fix problem X here.'
 147 | WARNING | [x] 'TODO: Show "Not restricted" and other info on vertical
     |         |     tabs.' should match the format '@todo Fix problem X here.'
 158 | WARNING | [x] 'TODO: use field settings.' should match the format '@todo
     |         |     Fix problem X here.'
 169 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
 201 | WARNING | [x] 'TODO see Drupal\block\BlockForm::validateForm()' should
     |         |     match the format '@todo Fix problem X here.'
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 19 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...Users\Admin\Desktop\task\condition_field\tests\src\Functional\LoadTest.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
--------------------------------------------------------------------------------

Time: 511ms; Memory: 8MB

Proposed resolution

Fix the errors and warnings.

🐛 Bug report
Status

Fixed

Version

2.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

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 almost 2 years ago
  • Status changed to Needs work almost 2 years ago
  • Assigned to Sonal Gyanani
  • Status changed to Needs review almost 2 years ago
  • Issue was unassigned.
  • Status changed to RTBC almost 2 years ago
  • Status changed to Needs work almost 2 years ago
  • Status changed to Needs review almost 2 years ago
  • Status changed to Fixed almost 2 years ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024