Fix issues reported by phpcs

Created on 25 May 2023, about 2 years ago

Problem/Motivation

Running phpcs returns following results:

FILE: /home/arpitkayare/drupal_9.5/web/modules/contrib/menu_admin_per_menu/src/Routing/RouteSubscriber.php
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 2 WARNINGS AFFECTING 5 LINES
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
24 | WARNING | [x] A comma should follow the last multiline array item. Found: '\Drupal\menu_admin_per_menu\Controller\MenuAdminPerMenuController::menuOverviewPage'
27 | WARNING | [x] A comma should follow the last multiline array item. Found: '\Drupal\menu_admin_per_menu\Access\MenuAdminPerMenuAccess::menusOverviewAccess'
34 | ERROR | [x] Closing parenthesis of array declaration must be on a new line
40 | ERROR | [x] Closing parenthesis of array declaration must be on a new line
50 | ERROR | [x] Closing parenthesis of array declaration must be on a new line
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /home/arpitkayare/drupal_9.5/web/modules/contrib/menu_admin_per_menu/src/Access/MenuAdminPerMenuAccess.php
----------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------
19 | ERROR | [x] Expected 1 space before opening brace; found 2
----------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------

FILE: /home/arpitkayare/drupal_9.5/web/modules/contrib/menu_admin_per_menu/tests/src/Kernel/MenuAdminPerMenuAccessTest.php
--------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------
17 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
--------------------------------------------------------------------------------------------------------------------------

FILE: /home/arpitkayare/drupal_9.5/web/modules/contrib/menu_admin_per_menu/tests/src/Kernel/MenuAdminPerMenuPermissionsTest.php
-------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------
14 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
-------------------------------------------------------------------------------------------------------------------------------

FILE: /home/arpitkayare/drupal_9.5/web/modules/contrib/menu_admin_per_menu/README.md
------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
------------------------------------------------------------------------------------
11 | WARNING | [ ] Line exceeds 80 characters; contains 192 characters
30 | ERROR | [x] Expected 1 newline at end of file; 6 found
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------

Steps to reproduce

Run phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml . inside module folder.

Proposed resolution

work on fixing errors/warnings. Create a patch.

Remaining tasks

User interface changes

NA

API changes

NA

Data model changes

NA

šŸ“Œ Task
Status

Active

Version

1.0

Component

Code

Created by

šŸ‡®šŸ‡³India arpitk Indore

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @arpitk
  • šŸ‡®šŸ‡³India arpitk Indore
  • šŸ‡®šŸ‡³India arpitk Indore
  • Issue was unassigned.
  • Status changed to Needs review about 2 years ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.3 & MySQL 5.7
    last update about 2 years ago
    15 pass
  • šŸ‡®šŸ‡³India arpitk Indore

    Here is the patch please review.

    Thanks!

  • Status changed to Needs work about 2 years ago
  • šŸ‡µšŸ‡­Philippines kenyoOwen

    Hi arpitk

    After I applied your patch and there are still errors.

    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml menu_admin_per_menu

    FILE: /Users/studenttrainees/Project10/drupalorg10/docroot/modules/contrib/menu_admin_per_menu/tests/src/Kernel/MenuAdminPerMenuAccessTest.php
    ----------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------------------------------------
    17 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
    ----------------------------------------------------------------------------------------------------------------------------------------------

    FILE: /Users/studenttrainees/Project10/drupalorg10/docroot/modules/contrib/menu_admin_per_menu/tests/src/Kernel/MenuAdminPerMenuPermissionsTest.php
    ---------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------------------------
    14 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
    ---------------------------------------------------------------------------------------------------------------------------------------------------

    FILE: /Users/studenttrainees/Project10/drupalorg10/docroot/modules/contrib/menu_admin_per_menu/src/Access/MenuAdminPerMenuAccess.php
    ------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------------
    19 | ERROR | [x] Expected 1 space before opening brace; found 2
    ------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------------

    Time: 919ms; Memory: 16MB

  • Assigned to nitin_lama
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.3 & MySQL 5.7
    last update about 2 years ago
    15 pass
  • @nitin_lama opened merge request.
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.3 & MySQL 5.7
    last update about 2 years ago
    15 pass
  • @nitin_lama opened merge request.
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.3 & MySQL 5.7
    last update about 2 years ago
    15 pass
  • Issue was unassigned.
  • šŸ‡®šŸ‡³India nitin_lama India

    MR for the change.

  • Status changed to Needs review about 2 years ago
  • Status changed to Needs work 12 months ago
  • šŸ‡µšŸ‡­Philippines paraderojether

    Hi

    I reviewed MR!6, applied it against Menu Admin per Menu 8.x-1.x-dev and there are still remaining phpcs issue shown below:

    āžœ  menu_admin_per_menu git:(98d34cb) curl https://git.drupalcode.org/project/menu_admin_per_menu/-/merge_requests/16.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  4928    0  4928    0     0   9338      0 --:--:-- --:--:-- --:--:--  9476
    patching file README.md
    patching file 'src/Routing/RouteSubscriber.php'
    patching file 'tests/src/Kernel/MenuAdminPerMenuAccessTest.php'
    patching file 'tests/src/Kernel/MenuAdminPerMenuPermissionsTest.php'
    āžœ  menu_admin_per_menu git:(98d34cb) āœ— cd ..
    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig menu_admin_per_menu
    
    FILE: /Users/jetherparadero/q3do/q3issues/web/modules/contrib/menu_admin_per_menu/src/Access/MenuAdminPerMenuAccess.php
    -----------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    -----------------------------------------------------------------------------------------------------------------------
     26 | WARNING | Menu::loadMultiple calls should be avoided in classes, use dependency injection instead
     35 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    -----------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/jetherparadero/q3do/q3issues/web/modules/contrib/menu_admin_per_menu/src/MenuAdminPerMenuPermissions.php
    ----------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\StringTranslation\StringTranslationTrait.
    ----------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/jetherparadero/q3do/q3issues/web/modules/contrib/menu_admin_per_menu/src/MenuAdminPerMenuAccessInterface.php
    ----------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Menu\MenuLinkInterface.
    ----------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------
    
    Time: 548ms; Memory: 16MB

    Kindly check and advise, please.
    Thank you.

  • First commit to issue fork.
  • šŸ‡®šŸ‡³India akshaydalvi212

    i will remove the remaining errors.

  • Status changed to Needs review 12 months ago
  • šŸ‡®šŸ‡³India akshaydalvi212

    Hi

    I had fixed the remaining phpcs issues and raised the PR as here

    and all the phpcs errors are removed
    kindly test and review.

    Thanks.

  • Status changed to Closed: duplicate about 2 months ago
  • šŸ‡§šŸ‡ŖBelgium JeroenT šŸ‡§šŸ‡Ŗ
Production build 0.71.5 2024