Module have PHPCS Issues

Created on 18 March 2024, 3 months ago
Updated 16 April 2024, 2 months ago

@saurabhkanva,

When I run the command
phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml
for you module

FILE: /var/www/html/web/modules/contrib/custom_metatag/src/Form/CustomMetatagForm.php
---------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------
8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Url.
---------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/custom_metatag/custom_metatag.module
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 17 ERRORS AFFECTING 9 LINES
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
12 | ERROR | [x] No space found before comment text; expected "// check if current page has any metadata" but found "//check if current page has any metadata"
12 | ERROR | [x] Inline comments must start with a capital letter
12 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
16 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 1 space but found 2 spaces
70 | ERROR | [x] Expected 1 space after FOREACH keyword; 0 found
83 | ERROR | [x] Expected 1 space between "'nofollow'" and double arrow; 0 found
83 | ERROR | [x] Expected 1 space between double arrow and "'nofollow'"; 0 found
83 | ERROR | [x] Expected 1 space before "=>"; 0 found
83 | ERROR | [x] Expected 1 space after "=>"; 0 found
89 | ERROR | [x] There must be exactly one blank line before the tags in a doc comment
89 | ERROR | [ ] Missing parameter comment
90 | ERROR | [ ] Missing parameter comment
92 | ERROR | [ ] Invalid function name, expected get_metag_tag_entity but found getMetagTagEntity
92 | ERROR | [ ] All functions defined in a module file must be prefixed with the module's name, found "getMetagTagEntity" but expected "custom_metatag_getMetagTagEntity"
95 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 13 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/custom_metatag/custom_metatag.info.yml
------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------
7 | ERROR | [x] Expected 1 newline at end of file; 0 found
------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/custom_metatag/custom_metatag.install
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 2 WARNINGS AFFECTING 5 LINES
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3 | ERROR | [ ] Missing short description in doc comment
7 | WARNING | [x] Unused use statement
10 | ERROR | [x] Doc comment short description must end with a full stop
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."
30 | ERROR | [x] Expected 1 newline at end of file; 0 found
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

I created Patch for the above error
Hope you value my time and efforts.
Thank You !!

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India Harpreet_singh_saluja

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024