Fix the issue reported by phpcs

Created on 26 August 2023, about 1 year ago
Updated 17 October 2023, about 1 year ago

Running phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml show the following errors/warnings, which should be fixed when they are not false positives.

FILE: ./filter_term/css/style.css
----------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 3 LINES
----------------------------------------------------------------------
 1 | ERROR | [x] Multiple selectors should each be on a single line
 1 | ERROR | [x] Expected 1 space before opening brace of class
   |       |     definition; 0 found
 2 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found
   |       |     4
 3 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ./filter_term/filter_term.module
----------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
----------------------------------------------------------------------
  3 | ERROR   | Missing short description in doc comment
 12 | WARNING | Doc comment indicates hook_form_alter() but function
    |         | signature is "filter_term_form_node_form_alter"
    |         | instead of "filter_term_form_alter". Did you mean
    |         | hook_form_FORM_ID_alter()?
----------------------------------------------------------------------


FILE: ./filter_term/src/Form/VocabForm.php
----------------------------------------------------------------------
FOUND 7 ERRORS AND 10 WARNINGS AFFECTING 16 LINES
----------------------------------------------------------------------
   6 | ERROR   | [x] Use statements should be sorted alphabetically.
     |         |     The first wrong one is
     |         |     Drupal\node\Entity\NodeType.
  28 | WARNING | [ ] \Drupal calls should be avoided in classes, use
     |         |     dependency injection instead
  29 | WARNING | [ ] \Drupal calls should be avoided in classes, use
     |         |     dependency injection instead
  30 | WARNING | [ ] \Drupal calls should be avoided in classes, use
     |         |     dependency injection instead
  31 | WARNING | [ ] \Drupal calls should be avoided in classes, use
     |         |     dependency injection instead
  32 | WARNING | [ ] \Drupal calls should be avoided in classes, use
     |         |     dependency injection instead
  34 | WARNING | [ ] Vocabulary::loadMultiple calls should be avoided
     |         |     in classes, use dependency injection instead
  57 | WARNING | [ ] \Drupal calls should be avoided in classes, use
     |         |     dependency injection instead
  65 | WARNING | [ ] \Drupal calls should be avoided in classes, use
     |         |     dependency injection instead
  89 | WARNING | [ ] NodeType::loadMultiple calls should be avoided
     |         |     in classes, use dependency injection instead
 105 | ERROR   | [x] No space found before comment text; expected "//
     |         |     Users list in drop down" but found "//Users list
     |         |     in drop down"
 105 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, question marks, colons, or
     |         |     closing parentheses
 106 | WARNING | [ ] \Drupal calls should be avoided in classes, use
     |         |     dependency injection instead
 110 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected
     |         |     "TRUE" but found "true"
 115 | ERROR   | [x] Expected 1 space after FOREACH keyword; 0 found
 126 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected
     |         |     "TRUE" but found "true"
 159 | ERROR   | [ ] The array declaration extends to column 194 (the
     |         |     limit is 80). The array content should be split
     |         |     up over multiple lines
----------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ./filter_term/src/Controller/DefaultController.php
----------------------------------------------------------------------
FOUND 61 ERRORS AND 12 WARNINGS AFFECTING 44 LINES
----------------------------------------------------------------------
   7 | ERROR   | [x] Use statements should be sorted alphabetically.
     |         |     The first wrong one is
     |         |     Drupal\Component\Render\FormattableMarkup.
  20 | WARNING | [ ] \Drupal calls should be avoided in classes, use
     |         |     dependency injection instead
  21 | ERROR   | [x] Whitespace found at end of line
  22 | WARNING | [ ] \Drupal calls should be avoided in classes, use
     |         |     dependency injection instead
  23 | WARNING | [ ] \Drupal calls should be avoided in classes, use
     |         |     dependency injection instead
  24 | WARNING | [ ] \Drupal calls should be avoided in classes, use
     |         |     dependency injection instead
  25 | WARNING | [ ] \Drupal calls should be avoided in classes, use
     |         |     dependency injection instead
  26 | WARNING | [ ] \Drupal calls should be avoided in classes, use
     |         |     dependency injection instead
  27 | WARNING | [ ] \Drupal calls should be avoided in classes, use
     |         |     dependency injection instead
  28 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
  29 | WARNING | [ ] User::load calls should be avoided in classes,
     |         |     use dependency injection instead
  38 | ERROR   | [x] Whitespace found at end of line
  42 | WARNING | [ ] \Drupal calls should be avoided in classes, use
     |         |     dependency injection instead
  46 | ERROR   | [x] Expected 1 space between comma and "'type'"; 0
     |         |     found
  46 | ERROR   | [x] Expected one space after the comma, 0 found
  46 | ERROR   | [x] Expected 1 space between comma and "'title'"; 0
     |         |     found
  46 | ERROR   | [x] Expected one space after the comma, 0 found
  46 | ERROR   | [x] Expected 1 space between comma and "'status'"; 0
     |         |     found
  46 | ERROR   | [x] Expected one space after the comma, 0 found
  52 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
  55 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
  60 | ERROR   | [x] Line indented incorrectly; expected 8 spaces,
     |         |     found 6
  60 | ERROR   | [x] Object operator not indented correctly; expected
     |         |     8 spaces but found 6
  63 | ERROR   | [x] Line indented incorrectly; expected 8 spaces,
     |         |     found 6
  63 | ERROR   | [x] Object operator not indented correctly; expected
     |         |     8 spaces but found 6
  64 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 7
  69 | ERROR   | [x] Expected 1 space after ELSEIF keyword; 0 found
  70 | WARNING | [ ] \Drupal calls should be avoided in classes, use
     |         |     dependency injection instead
  73 | ERROR   | [x] Expected 1 space between comma and "'type'"; 0
     |         |     found
  73 | ERROR   | [x] Expected one space after the comma, 0 found
  73 | ERROR   | [x] Expected 1 space between comma and "'title'"; 0
     |         |     found
  73 | ERROR   | [x] Expected one space after the comma, 0 found
  73 | ERROR   | [x] Expected 1 space between comma and "'status'"; 0
     |         |     found
  73 | ERROR   | [x] Expected one space after the comma, 0 found
  80 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
  83 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
  84 | ERROR   | [x] Line indented incorrectly; expected 8 spaces,
     |         |     found 10
  87 | ERROR   | [x] Line indented incorrectly; expected 8 spaces,
     |         |     found 6
  87 | ERROR   | [x] Object operator not indented correctly; expected
     |         |     8 spaces but found 6
  90 | ERROR   | [x] Object operator not indented correctly; expected
     |         |     8 spaces but found 12
  91 | ERROR   | [x] Whitespace found at end of line
  93 | ERROR   | [x] Expected 1 space after ELSE keyword; 0 found
  94 | WARNING | [ ] \Drupal calls should be avoided in classes, use
     |         |     dependency injection instead
  96 | ERROR   | [x] Expected 1 space between comma and "'type'"; 0
     |         |     found
  96 | ERROR   | [x] Expected one space after the comma, 0 found
  96 | ERROR   | [x] Expected 1 space between comma and "'title'"; 0
     |         |     found
  96 | ERROR   | [x] Expected one space after the comma, 0 found
  96 | ERROR   | [x] Expected 1 space between comma and "'status'"; 0
     |         |     found
  96 | ERROR   | [x] Expected one space after the comma, 0 found
 101 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 104 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 108 | ERROR   | [x] Line indented incorrectly; expected 8 spaces,
     |         |     found 6
 108 | ERROR   | [x] Object operator not indented correctly; expected
     |         |     8 spaces but found 6
 111 | ERROR   | [x] Line indented incorrectly; expected 8 spaces,
     |         |     found 6
 111 | ERROR   | [x] Object operator not indented correctly; expected
     |         |     8 spaces but found 6
 112 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 7
 115 | ERROR   | [x] Expected 1 space after closing parenthesis;
     |         |     found 0
 124 | ERROR   | [ ] The array declaration extends to column 122 (the
     |         |     limit is 80). The array content should be split
     |         |     up over multiple lines
 126 | ERROR   | [x] Concat operator must be surrounded by a single
     |         |     space
 126 | ERROR   | [x] Concat operator must be surrounded by a single
     |         |     space
 126 | ERROR   | [x] Concat operator must be surrounded by a single
     |         |     space
 126 | ERROR   | [x] Concat operator must be surrounded by a single
     |         |     space
 126 | ERROR   | [x] Concat operator must be surrounded by a single
     |         |     space
 126 | ERROR   | [x] Concat operator must be surrounded by a single
     |         |     space
 128 | ERROR   | [x] Concat operator must be surrounded by a single
     |         |     space
 128 | ERROR   | [x] Concat operator must be surrounded by a single
     |         |     space
 128 | ERROR   | [x] Concat operator must be surrounded by a single
     |         |     space
 128 | ERROR   | [x] Concat operator must be surrounded by a single
     |         |     space
 129 | ERROR   | [x] Expected 1 space before ":"; 0 found
 132 | ERROR   | [x] Whitespace found at end of line
 144 | WARNING | [x] A comma should follow the last multiline array
     |         |     item. Found: 'pager'
 148 | ERROR   | [x] Expected 1 newline at end of file; 0 found
 148 | ERROR   | [x] The closing brace for the class must have an
     |         |     empty line before it
----------------------------------------------------------------------
PHPCBF CAN FIX THE 61 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ./filter_term/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
----------------------------------------------------------------------
  3 | WARNING | Line exceeds 80 characters; contains 85 characters
  5 | WARNING | Line exceeds 80 characters; contains 86 characters
 27 | WARNING | Line exceeds 80 characters; contains 107 characters
----------------------------------------------------------------------


FILE: ./filter_term/filter_term.routing.yml
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 14 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

Time: 77ms; Memory: 10MB
📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India VijaySharma_89

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

Comments & Activities

Production build 0.71.5 2024