Fix the issues reported by phpcs on fullmenu module

Created on 4 August 2023, 11 months ago

Problem/Motivation

After execution of PHPCS getting below warnings

./vendor/bin/phpcs   --standard="Drupal,DrupalPractice"   --extensions="php,module,inc,install,test,profile,theme" web/modules/contrib/fullmenu/

FILE: /home/shivsharma/project/my-drupal10-site/web/modules/contrib/fullmenu/src/Plugin/Block/FullMenuBlock.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AND 2 WARNINGS AFFECTING 5 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
  97 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
 126 | WARNING | [ ] Line exceeds 80 characters; contains 83 characters
 126 | ERROR   | [x] No space found before comment text; expected "// $parameters =
     |         |     $this->menuTree->getCurrentRouteMenuTreeParameters($menu_name);" but found "//$parameters =
     |         |     $this->menuTree->getCurrentRouteMenuTreeParameters($menu_name);"
 127 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
 127 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 1
 130 | ERROR   | [x] No space found before comment text; expected "// $level = $this->configuration['level'];" but found "//$level =
     |         |     $this->configuration['level'];"
 130 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 132 | ERROR   | [x] No space found before comment text; expected "// $parameters->setMinDepth($level);" but found
     |         |     "//$parameters->setMinDepth($level);"
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/shivsharma/project/my-drupal10-site/web/modules/contrib/fullmenu/fullmenu.module
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 61 ERRORS AND 3 WARNINGS AFFECTING 30 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] The PHP open tag must be followed by exactly one blank line
  7 | ERROR   | [x] There must be exactly one blank line after the file comment
  8 | WARNING | [x] Unused use statement
  8 | ERROR   | [x] There must be one blank line after the last USE statement; 2 found;
  8 | ERROR   | [x] Whitespace found at end of line
  9 | ERROR   | [x] Whitespace found at end of line
 10 | ERROR   | [x] Whitespace found at end of line
 11 | ERROR   | [x] Missing function doc comment
 11 | ERROR   | [x] Expected 1 blank line before function; 2 found
 12 | ERROR   | [x] No space found before comment text; expected "// drupal_set_message('fullmenu_preprocess_block:success');" but found
    |         |     "//drupal_set_message('fullmenu_preprocess_block:success');"
 13 | ERROR   | [x] No space found before comment text; expected "// $plugin_id = $variables['plugin_id'];" but found "//$plugin_id =
    |         |     $variables['plugin_id'];"
 14 | ERROR   | [x] No space found before comment text; expected "// drupal_set_message('plugin_id:' . $plugin_id);" but found
    |         |     "//drupal_set_message('plugin_id:' . $plugin_id);"
 14 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 16 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 16 | ERROR   | [x] There should be no white space before a closing ")"
 16 | ERROR   | [x] Expected 1 space after closing parenthesis; found 0
 17 | ERROR   | [x] No space found before comment text; expected "// $label =  $variables['label'];" but found "//$label = 
    |         |     $variables['label'];"
 18 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
 18 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 1
 18 | ERROR   | [x] No space found before comment text; expected "// drupal_set_message('label:'.var_export($label, true));" but found
    |         |     "//drupal_set_message('label:'.var_export($label, true));"
 19 | ERROR   | [x] No space found before comment text; expected "// $base_plugin_id = $variables['base_plugin_id'];" but found
    |         |     "//$base_plugin_id = $variables['base_plugin_id'];"
 20 | ERROR   | [x] No space found before comment text; expected "// $derivative_plugin_id = $variables['derivative_plugin_id'];" but found
    |         |     "//$derivative_plugin_id = $variables['derivative_plugin_id'];"
 21 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
 21 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 2
 21 | ERROR   | [x] No space found before comment text; expected "// drupal_set_message('base_plugin_id:' . $base_plugin_id);" but found
    |         |     "//drupal_set_message('base_plugin_id:' . $base_plugin_id);"
 22 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
 22 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 2
 22 | ERROR   | [x] No space found before comment text; expected "// drupal_set_message('derivative_plugin_id:' . $derivative_plugin_id);"
    |         |     but found "//drupal_set_message('derivative_plugin_id:' . $derivative_plugin_id);"
 23 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
 23 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 2
 24 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
 24 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 2
 24 | ERROR   | [x] No space found before comment text; expected "// $active_trail = MenuActiveTrail->getActiveTrailIds($menu_name);" but
    |         |     found "//$active_trail = MenuActiveTrail->getActiveTrailIds($menu_name);"
 25 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
 25 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 2
 25 | ERROR   | [x] Expected 1 space after "="; 2 found
 26 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
 26 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 2
 27 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
 27 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 2
 28 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
 28 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 2
 29 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
 29 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 2
 29 | ERROR   | [x] Expected one space after the comma, 0 found
 30 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
 30 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 2
 31 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
 31 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 2
 31 | ERROR   | [x] No space found before comment text; expected "// $menu_link_name = $menu_link_content->title->value;" but found
    |         |     "//$menu_link_name = $menu_link_content->title->value;"
 32 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
 32 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 2
 32 | ERROR   | [x] No space found before comment text; expected "// $variables['label'] = $menu_link_name;" but found "//$variables['label']
    |         |     = $menu_link_name;"
 33 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
 33 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 2
 33 | ERROR   | [x] Expected 1 space after "="; 2 found
 34 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
 34 | WARNING | [x] There must be no blank line following an inline comment
 34 | WARNING | [ ] There must be no blank line following an inline comment
 34 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 2
 34 | ERROR   | [x] No space found before comment text; expected "// drupal_set_message('123:'.var_export($menu_link_name, true));" but found
    |         |     "//drupal_set_message('123:'.var_export($menu_link_name, true));"
 34 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 35 | ERROR   | [x] Whitespace found at end of line
 37 | ERROR   | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 63 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------

Time: 124ms; Memory: 10MB

Steps to reproduce

execute phpcs

Proposed resolution

resolve the issue by phpcbs and if required manually.

Remaining tasks

Review and merge

๐Ÿ“Œ Task
Status

Fixed

Version

1.0

Component

Miscellaneous

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia Shiv_Sharma

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

Comments & Activities

Production build 0.69.0 2024