Drupal Coding Standards Issues | phpcs

Created on 23 January 2023, over 1 year ago
Updated 4 October 2023, 12 months ago

Problem/Motivation

Getting Following errors/warnings

$ phpcs --standard=Drupal headroomjs

FILE: C:\Users\Admin\Desktop\task\headroomjs\js\headroomjs.drupal.js
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
  1 | ERROR | [x] End of line character is invalid; expected "\n" but found
    |       |     "\r\n"
 27 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: C:\Users\Admin\Desktop\task\headroomjs\src\Form\HeadroomSettingsForm.php
--------------------------------------------------------------------------------
FOUND 21 ERRORS AND 8 WARNINGS AFFECTING 22 LINES
--------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found
     |         |     "\r\n"
   8 | ERROR   | [x] Missing class doc comment
  41 | ERROR   | [x] Short array syntax must be used to define arrays
  44 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE"
     |         |     but found "true"
  45 | WARNING | [x] A comma should follow the last multiline array item.
     |         |     Found: )
  48 | ERROR   | [x] Short array syntax must be used to define arrays
  55 | ERROR   | [x] Short array syntax must be used to define arrays
  60 | WARNING | [x] A comma should follow the last multiline array item.
     |         |     Found: true
  60 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE"
     |         |     but found "true"
  63 | ERROR   | [x] Short array syntax must be used to define arrays
  68 | WARNING | [x] A comma should follow the last multiline array item.
     |         |     Found: true
  68 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE"
     |         |     but found "true"
  71 | ERROR   | [x] Short array syntax must be used to define arrays
  76 | WARNING | [x] A comma should follow the last multiline array item.
     |         |     Found: true
  76 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE"
     |         |     but found "true"
  79 | ERROR   | [x] Short array syntax must be used to define arrays
  84 | WARNING | [x] A comma should follow the last multiline array item.
     |         |     Found: true
  84 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE"
     |         |     but found "true"
  87 | ERROR   | [x] Short array syntax must be used to define arrays
  92 | WARNING | [x] A comma should follow the last multiline array item.
     |         |     Found: true
  92 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE"
     |         |     but found "true"
  95 | ERROR   | [x] Short array syntax must be used to define arrays
 100 | WARNING | [x] A comma should follow the last multiline array item.
     |         |     Found: true
 100 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE"
     |         |     but found "true"
 103 | ERROR   | [x] Short array syntax must be used to define arrays
 108 | WARNING | [x] A comma should follow the last multiline array item.
     |         |     Found: true
 108 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE"
     |         |     but found "true"
 111 | ERROR   | [x] Short array syntax must be used to define arrays
 147 | ERROR   | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 29 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 465ms; Memory: 8MB

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

Production build 0.71.5 2024