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.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

prachi6824 created an issue. See original summary.

prachi6824’s picture

Status: Active » Needs review
StatusFileSize
new6.53 KB

I have worked on this issue and have created a patch to resolve it.

Please do review it and apply it .

sonam_sharma’s picture

Status: Needs review » Needs work

Hello @prachi6824
I have tested your patch #3
It's not working so i'm changing it's status to needs work

arti_parmar’s picture

Assigned: Unassigned » arti_parmar

i will work on this issue.

arti_parmar’s picture

Assigned: arti_parmar » Unassigned
Status: Needs work » Needs review
StatusFileSize
new21.62 KB

I updated patch #3
Kindly review patch.

roberttabigue’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new69.98 KB

Hi,

I have reviewed the changes and confirmed Patch #3 was applied cleanly to the Node By Term module against 1.0.x-dev on Drupal 9.5.10.

For that Patch, confirmed all PHPCS errors have been fixed.

I re-ran this command on the module:
phpcs --standard=DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml node_by_term/

Please see the attached file for reference.

I'm moving this now to RTBC.

Thank you!

bhupendra_raykhere’s picture

Status: Reviewed & tested by the community » Needs work
StatusFileSize
new50.14 KB

Hi @roberttabigue,
I have tested patch #3 , It is not applied successfully on drupal 10.
Moving it to needs work, Check screenshot for your reference.

nitin_lama’s picture

Assigned: Unassigned » nitin_lama

nitin_lama’s picture

Assigned: nitin_lama » Unassigned
Status: Needs work » Needs review
thakurnishant_06’s picture

Status: Needs review » Needs work

Hello @nitin_lama
Please rebase the MR and then push the changes.
Thank you.

sakthi_dev made their first commit to this issue’s fork.

sakthi_dev’s picture

Status: Needs work » Needs review

Please review.

thakurnishant_06’s picture

Status: Needs review » Reviewed & tested by the community

I applied and tested MR5, ensuring that all changes in MR5 fixed all the errors reported by the code sniffer in version 1.0.x.
Thank you for your support.
Moving to RTBC!!

bhupendra_raykhere’s picture

Status: Reviewed & tested by the community » Fixed

Hi @everyone,
Thanks for your contribution

bhupendra_raykhere’s picture

Status: Fixed » Closed (fixed)