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.
Comments
Comment #3
prachi6824 commentedI have worked on this issue and have created a patch to resolve it.
Please do review it and apply it .
Comment #4
sonam_sharma commentedHello @prachi6824
I have tested your patch #3
It's not working so i'm changing it's status to needs work
Comment #5
arti_parmar commentedi will work on this issue.
Comment #6
arti_parmar commentedI updated patch #3
Kindly review patch.
Comment #7
roberttabigue commentedHi,
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!
Comment #8
bhupendra_raykhere commentedHi @roberttabigue,
I have tested patch #3 , It is not applied successfully on drupal 10.
Moving it to needs work, Check screenshot for your reference.
Comment #9
nitin_lamaComment #11
nitin_lamaComment #12
thakurnishant_06 commentedHello @nitin_lama
Please rebase the MR and then push the changes.
Thank you.
Comment #14
sakthi_dev commentedPlease review.
Comment #15
thakurnishant_06 commentedI 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!!
Comment #17
bhupendra_raykhere commentedHi @everyone,
Thanks for your contribution
Comment #18
bhupendra_raykhere commented