Drupal Coding Standards Issues | phpcs

Created on 2 February 2023, over 1 year ago
Updated 6 February 2023, over 1 year ago

Problem/Motivation

Getting following error/warnings.

FILE: C:\xampp\htdocs\abc\drupal\modules\mix\mix.module
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but
| | found "\r\n"
11 | ERROR | [x] Namespaced classes/interfaces/traits should be
| | referenced with use statements
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: C:\xampp\htdocs\abc\drupal\modules\mix\README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
----------------------------------------------------------------------
3 | WARNING | Line exceeds 80 characters; contains 112 characters
6 | WARNING | Line exceeds 80 characters; contains 121 characters
7 | WARNING | Line exceeds 80 characters; contains 99 characters
8 | WARNING | Line exceeds 80 characters; contains 101 characters
----------------------------------------------------------------------

FILE: C:\xampp\htdocs\abc\drupal\modules\mix\src\Form\SettingsForm.php
----------------------------------------------------------------------
FOUND 1 ERROR AND 4 WARNINGS AFFECTING 5 LINES
----------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n"
| | but found "\r\n"
51 | WARNING | [ ] \Drupal calls should be avoided in classes, use
| | dependency injection instead
60 | WARNING | [ ] Possible useless method overriding detected
76 | WARNING | [ ] \Drupal calls should be avoided in classes, use
| | dependency injection instead
77 | WARNING | [ ] \Drupal calls should be avoided in classes, use
| | dependency injection instead
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...p\htdocs\abc\drupal\modules\mix\tests\src\Functional\MixTest.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"
60 | WARNING | [ ] Line exceeds 80 characters; contains 87
| | characters
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

Steps to reproduce

Run following command

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/mix/

Proposed resolution

Above error/warnings need to be fixed.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India Charchil Khandelwal

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

Comments & Activities

Production build 0.69.0 2024