Problem/Motivation
PHPCS reports the following:
C:\xampp\htdocs\backendassignment\web\modules\contrib>phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig hook_post_action
FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\hook_post_action\hook_post_action.api.php
-----------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 3 WARNINGS AFFECTING 5 LINES
-----------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
16 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
30 | WARNING | [ ] Only string literals should be passed to t() where possible
130 | WARNING | [ ] Only string literals should be passed to t() where possible
199 | ERROR | [x] Whitespace found at end of line
-----------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------
FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\hook_post_action\hook_post_action.module
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 1 WARNING AFFECTING 4 LINES
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
25 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements
| | hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates."
25 | ERROR | [x] Doc comment short description must end with a full stop
34 | ERROR | [x] Data types in @param tags need to be fully namespaced
55 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\hook_post_action\hook_post_action_example\hook_post_action_example.module
-------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
-------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
112 | ERROR | [x] Case breaking statements must be followed by a single blank line
114 | ERROR | [x] Case breaking statements must be followed by a single blank line
116 | ERROR | [x] Case breaking statements must be followed by a single blank line
-------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------
FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\hook_post_action\README.txt
---------------------------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
---------------------------------------------------------------------------------------
2 | WARNING | [ ] Line exceeds 80 characters; contains 107 characters
4 | WARNING | [ ] Line exceeds 80 characters; contains 121 characters
21 | WARNING | [ ] Line exceeds 80 characters; contains 105 characters
26 | ERROR | [x] Expected 1 newline at end of file; 0 found
---------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------
Time: 1.02 secs; Memory: 6MB
Steps to reproduce
Run the phpcs command on the module.
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #2
sidharth_soman commentedComment #3
kenyoowen commentedHi sidharth_soman
I applied your patch and the remaining issue are the issues line exceeds 80 characters. Please see the screenshots attached.
Thank you.
Comment #4
soham sengupta commentedHi, I have fixed the remaining issues.
Comment #5
paraderojether commentedHi Soham Sengupta,
I reviewed patch #4, applied against Hook Post Action 8.x-1.x-dev, and confirmed it fixes all the issues reported by phpcs.
I added a screenshot for reference.
Thank you.
Comment #9
m4oliveiThanks all! Merged to 8.x-1.x 🎉