\Drupal calls should be avoided in classes, use dependency injection instead and Fix the issues reported by phpcs

Created on 15 March 2024, 8 months ago
Updated 1 April 2024, 8 months ago

Steps to reproduce

When I run the reported command, I get more errors/warnings.

This is the command

phpcs --standard=DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml /path/to/drupal/example_module

phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml /path/to/drupal/example_module

FILE: web\modules\contrib\content_dashboard\assets\css\dashboard.css
----------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------
102 | ERROR | [x] Blank lines are not allowed in class definitions
----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------

FILE:web\modules\contrib\content_dashboard\content_dashboard.info.yml
-------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------
1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
-------------------------------------------------------------------------------------------------------------

FILE: web\modules\contrib\content_dashboard\README.md
-------------------------------------------------------------------------------
FOUND 0 ERRORS AND 10 WARNINGS AFFECTING 10 LINES
-------------------------------------------------------------------------------
5 | WARNING | Line exceeds 80 characters; contains 239 characters
10 | WARNING | Line exceeds 80 characters; contains 110 characters
11 | WARNING | Line exceeds 80 characters; contains 84 characters
25 | WARNING | Line exceeds 80 characters; contains 121 characters
26 | WARNING | Line exceeds 80 characters; contains 110 characters
29 | WARNING | Line exceeds 80 characters; contains 147 characters
34 | WARNING | Line exceeds 80 characters; contains 255 characters
37 | WARNING | Line exceeds 80 characters; contains 199 characters
40 | WARNING | Line exceeds 80 characters; contains 99 characters
46 | WARNING | Line exceeds 80 characters; contains 222 characters
-------------------------------------------------------------------------------

FILE: web\modules\contrib\content_dashboard\src\Controller\DashboardController.php
------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------
116 | WARNING | Only string literals should be passed to t() where possible
------------------------------------------------------------------------------------------------------------

FILE: web\modules\contrib\content_dashboard\src\Controller\DashboardController.php
-------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 6 WARNINGS AFFECTING 6 LINES
-------------------------------------------------------------------------------------------------------------
64 | WARNING | NodeType::loadMultiple calls should be avoided in classes, use dependency injection instead
73 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
101 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
106 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
144 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
152 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
-------------------------------------------------------------------------------------------------------------

๐Ÿ’ฌ Support request
Status

Fixed

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia jayprakash.kushwah India

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024