Fix the issue reported by phpcs

Created on 8 August 2023, over 1 year ago
Updated 5 October 2023, about 1 year ago

Problem/Motivation

There are following errors and warnings which are reported by PHP code sniffer within the module :

FILE: D:\xampp\htdocs\know-how\modules\custom\node_by_term\node_by_term.info.yml
----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------------------------------
 7 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
 8 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
----------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\know-how\modules\custom\node_by_term\node_by_term.routing.yml
------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------
 16 | WARNING | Open page callback found, please add a comment before the line why there is no access restriction
------------------------------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\know-how\modules\custom\node_by_term\src\Controller\NodeListController.php
---------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 14 WARNINGS AFFECTING 14 LINES
---------------------------------------------------------------------------------------------------------
  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 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  34 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  41 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  55 | WARNING | Node::loadMultiple calls should be avoided in classes, use dependency injection instead
  58 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  74 | WARNING | Node::loadMultiple calls should be avoided in classes, use dependency injection instead
  77 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  91 | WARNING | Node::loadMultiple calls should be avoided in classes, use dependency injection instead
  95 | WARNING | There must be no blank line following an inline comment
 112 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 113 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\know-how\modules\custom\node_by_term\src\Form\NodeByTermForm.php
--------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 8 WARNINGS AFFECTING 8 LINES
--------------------------------------------------------------------------------------------------------------
 26 | WARNING | There must be no blank line following an inline comment
 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
 33 | WARNING | Vocabulary::loadMultiple calls should be avoided in classes, use dependency injection instead
 58 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 68 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 91 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
--------------------------------------------------------------------------------------------------------------

Steps to reproduce

1) Install and enable this module .

2) Run following command using git in the correct directory :

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

Proposed resolution

Above error/warnings need to be fixed as per the coding standard.

๐Ÿ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia Prachi6824

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

Comments & Activities

Production build 0.71.5 2024