Drupal Coding Standards Issues | phpcs

Created on 24 January 2023, about 2 years ago

Problem/Motivation

Getting Following errors/warnings

$ phpcs --standard=Drupal roles_nested

FILE: C:\Users\Admin\Desktop\task\roles_nested\src\Form\RolesNestedTable.php
--------------------------------------------------------------------------------
FOUND 40 ERRORS AND 2 WARNINGS AFFECTING 37 LINES
--------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found
     |         |     "\r\n"
   8 | WARNING | [x] Unused use statement
   9 | WARNING | [x] Unused use statement
  11 | ERROR   | [ ] Missing short description in doc comment
  14 | ERROR   | [x] Missing class doc comment
  16 | ERROR   | [x] Missing function doc comment
  20 | ERROR   | [x] Missing function doc comment
  21 | ERROR   | [x] Whitespace found at end of line
  28 | ERROR   | [x] Whitespace found at end of line
  29 | ERROR   | [x] Equals sign not aligned with surrounding assignments;
     |         |     expected 4 spaces but found 3 spaces
  34 | ERROR   | [x] Whitespace found at end of line
  45 | ERROR   | [x] Whitespace found at end of line
  46 | ERROR   | [x] The first index in a multi-value array must be on a new
     |         |     line
  47 | ERROR   | [x] Array indentation error, expected 6 spaces but found 4
  49 | ERROR   | [x] Array closing indentation error, expected 4 spaces but
     |         |     found 6
  71 | ERROR   | [x] Inline comments must start with a capital letter
  71 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks,
     |         |     question marks, colons, or closing parentheses
  71 | ERROR   | [x] Comments may not appear after statements
  80 | ERROR   | [x] Functions must not contain multiple empty lines in a row;
     |         |     found 2 empty lines
 105 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks,
     |         |     question marks, colons, or closing parentheses
 106 | ERROR   | [x] Equals sign not aligned correctly; expected 1 space but
     |         |     found 2 spaces
 106 | ERROR   | [x] Concat operator must be surrounded by a single space
 107 | ERROR   | [ ] The array declaration extends to column 85 (the limit is
     |         |     80). The array content should be split up over multiple
     |         |     lines
 107 | ERROR   | [x] Comma not allowed after last value in single-line array
     |         |     declaration
 107 | ERROR   | [x] Expected one space after the comma, 0 found
 108 | ERROR   | [x] Short array syntax must be used to define arrays
 110 | ERROR   | [x] Short array syntax must be used to define arrays
 111 | ERROR   | [x] Short array syntax must be used to define arrays
 116 | ERROR   | [x] Short array syntax must be used to define arrays
 119 | ERROR   | [x] Concat operator must be surrounded by a single space
 173 | ERROR   | [x] Expected 1 blank line after function; 2 found
 176 | ERROR   | [x] Missing function doc comment
 180 | ERROR   | [x] Missing function doc comment
 193 | ERROR   | [x] Expected 1 blank line after function; 2 found
 195 | ERROR   | [x] Whitespace found at end of line
 196 | ERROR   | [x] Missing function doc comment
 197 | ERROR   | [x] Whitespace found at end of line
 202 | ERROR   | [x] No space found before comment text; expected "//
     |         |     ->condition('id', 11, '<')" but found "//->condition('id',
     |         |     11, '<')"
 220 | ERROR   | [x] Expected 1 blank line after function; 2 found
 222 | ERROR   | [x] Whitespace found at end of line
 223 | ERROR   | [x] Missing function doc comment
 238 | ERROR   | [x] No space found before comment text; expected "//
     |         |     ->condition('id', 11, '<')" but found "//->condition('id',
     |         |     11, '<')"
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 40 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 434ms; Memory: 8MB

Proposed resolution

Fix the errors and warnings.

🐛 Bug report
Status

Needs review

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

Production build 0.71.5 2024