Fix issues reported by phpcs.

Created on 27 December 2023, 6 months ago
Updated 4 June 2024, 24 days ago

Problem/Motivation

Steps to reproduce

Running phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig shows the following warnings/errors, which should be fixed.

Result:

FILE: ...toolbar/admin_toolbar_tools/src/Plugin/Derivative/ExtraLinks.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is
   |       |     Drupal\Core\Config\ConfigFactoryInterface.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...toolbar/admin_toolbar_tools/src/Controller/ToolbarController.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 17 | ERROR | [x] Use statements should be sorted alphabetically. The
    |       |     first wrong one is
    |       |     Drupal\Core\Template\TwigEnvironment.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...m/admin_toolbar/admin_toolbar_search/admin_toolbar_search.module
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 9 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is
   |       |     Drupal\Core\Routing\RouteMatchInterface.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: /app/web/modules/custom/admin_toolbar/admin_toolbar.module
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
 11 | ERROR | [x] Use statements should be sorted alphabetically. The
    |       |     first wrong one is Drupal\Component\Utility\Html.
 60 | ERROR | [ ] All functions defined in a module file must be
    |       |     prefixed with the module's name, found
    |       |     "toolbar_tools_menu_navigation_links" but expected
    |       |     "admin_toolbar_toolbar_tools_menu_navigation_links"
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...bar_links_access_filter/admin_toolbar_links_access_filter.module
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 11 | ERROR | [x] Use statements should be sorted alphabetically. The
    |       |     first wrong one is
    |       |     Drupal\Core\Routing\RouteMatchInterface.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

šŸ› Bug report
Status

RTBC

Version

3.4

Component

Code

Created by

šŸ‡®šŸ‡³India Tirupati_Singh

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

Merge Requests

Comments & Activities

  • Issue created by @Tirupati_Singh
  • Open on Drupal.org ā†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update 6 months ago
    Waiting for branch to pass
  • Issue was unassigned.
  • Status changed to Needs review 6 months ago
  • šŸ‡®šŸ‡³India Tirupati_Singh

    I've fixed phpcs issues please review.

  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi

    I confirmed that your MR !66 fixes most of the issues but I will retain the status to needs review because there is still a PHPCS warnings flagged in the module so that others can review and give feedback if the warnings needs to be fixed or can be ignored.

    āžœ  admin_toolbar git:(master) āœ— curl https://git.drupalcode.org/project/admin_toolbar/-/merge_requests/66.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  5437    0  5437    0     0  10558      0 --:--:-- --:--:-- --:--:-- 10681
    patching file admin_toolbar.module
    patching file 'admin_toolbar_links_access_filter/admin_toolbar_links_access_filter.module'
    patching file 'admin_toolbar_search/admin_toolbar_search.module'
    patching file 'admin_toolbar_tools/src/Controller/ToolbarController.php'
    patching file 'admin_toolbar_tools/src/Plugin/Derivative/ExtraLinks.php'
    patching file 'src/Render/Element/AdminToolbar.php'
    āžœ  admin_toolbar git:(master) āœ— ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml admin_toolbar 
    
    FILE: ...bing-subing/Projects/d9/d9-local/web/modules/contrib/admin_toolbar/admin_toolbar_links_access_filter/admin_toolbar_links_access_filter.info.yml
    -----------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------------------------------
     1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
     1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
     1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
    -----------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/clarksubing-subing/Projects/d9/d9-local/web/modules/contrib/admin_toolbar/admin_toolbar_search/admin_toolbar_search.info.yml
    -----------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------------------
     1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
     1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
     1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
    -----------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/clarksubing-subing/Projects/d9/d9-local/web/modules/contrib/admin_toolbar/admin_toolbar_tools/admin_toolbar_tools.info.yml
    ---------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------------
     1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
     1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
     1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
    ---------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/clarksubing-subing/Projects/d9/d9-local/web/modules/contrib/admin_toolbar/admin_toolbar.info.yml
    -------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------
     1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
     1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
     1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
    -------------------------------------------------------------------------------------------------------------
    
    Time: 937ms; Memory: 16MB
    
    āžœ  contrib git:(master) āœ— 
    
    
  • šŸ‡®šŸ‡³India Tirupati_Singh

    Hi @clarkssquared, I've run the phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig command but didn't get any mentioned warnings. Attaching the screenshot for your reference.

  • šŸ‡®šŸ‡³India dev16.addweb

    After applying patch, I'm still receiving several phpcs problems.

    FILE: /home/addweb/Drupal8-vagrant/web/web/drupal_10_2_6/web/modules/contrib/admin_toolbar/admin_toolbar_search/admin_toolbar_search.info.yml
    ---------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------------------
     1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
     1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
     1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
    ---------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/addweb/Drupal8-vagrant/web/web/drupal_10_2_6/web/modules/contrib/admin_toolbar/admin_toolbar.info.yml
    -----------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------
     1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
     1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
     1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
    -----------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/addweb/Drupal8-vagrant/web/web/drupal_10_2_6/web/modules/contrib/admin_toolbar/PATCHES.txt
    ------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    ------------------------------------------------------------------------------------------------------
     1 | WARNING | [ ] Line exceeds 80 characters; contains 104 characters
     5 | ERROR   | [x] Expected 1 newline at end of file; 3 found
    ------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/addweb/Drupal8-vagrant/web/web/drupal_10_2_6/web/modules/contrib/admin_toolbar/admin_toolbar_tools/admin_toolbar_tools.info.yml
    -------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------------------
     1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
     1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
     1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
    -------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/addweb/Drupal8-vagrant/web/web/drupal_10_2_6/web/modules/contrib/admin_toolbar/admin_toolbar_links_access_filter/admin_toolbar_links_access_filter.info.yml
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
     1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
     1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
     1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
  • Open on Drupal.org ā†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update about 1 month ago
    Waiting for branch to pass
  • šŸ‡®šŸ‡³India Tirupati_Singh

    @silvi.addweb, I've fixed the phpcs issues. Please apply the patch again and verify the changes.

  • Status changed to RTBC 24 days ago
  • šŸ‡®šŸ‡³India dev16.addweb

    Hii,
    Yes, I've checked and all phpcs issues are resolved now.

Production build 0.69.0 2024