Fix issues reported by phpcs

Created on 25 May 2023, about 1 year ago
Updated 29 May 2023, about 1 year 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 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------------
22 | ERROR | The array declaration extends to column 176 (the limit is 80). The array content should be split up over multiple lines
--------------------------------------------------------------------------------------------------------------------------------------

FILE: /home/arpitkayare/drupal_9.5/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: /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.
Some issue have been taken care here https://www.drupal.org/project/menu_admin_per_menu/issues/3362741 📌 Drupal calls should be avoided in classes, use dependency injection instead Needs review

Remaining tasks

User interface changes

NA

API changes

NA

Data model changes

NA

📌 Task
Status

Needs review

Version

1.0

Component

Code

Created by

🇮🇳India arpitk

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

Comments & Activities

  • Issue created by @arpitk
  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.3 & MySQL 5.7
    last update about 1 year ago
    15 pass
  • 🇮🇳India arpitk

    Here is the patch please review.

    Thanks!

  • Status changed to Needs work about 1 year 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 1 year 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 1 year 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 1 year ago
    15 pass
  • Issue was unassigned.
  • 🇮🇳India nitin_lama

    MR for the change.

  • Status changed to Needs review about 1 year ago
Production build 0.69.0 2024