Fix the issues reported by phpcs

Created on 27 February 2023, over 1 year ago
Updated 8 January 2024, 9 months ago

Problem/Motivation

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/admin_toolbar_tasks/admin_toolbar_tasks.module
--------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------------
19 | ERROR | The array declaration extends to column 102 (the limit is 80). The array content should be split up over multiple lines
--------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/admin_toolbar_tasks/src/AdminToolbarTasksBuilder.php
----------------------------------------------------------------------------------------
FOUND 8 ERRORS AFFECTING 8 LINES
----------------------------------------------------------------------------------------
13 | ERROR | [x] Missing class doc comment
15 | ERROR | [ ] Missing member variable doc comment
17 | ERROR | [ ] Missing member variable doc comment
19 | ERROR | [x] Missing function doc comment
24 | ERROR | [x] Missing function doc comment
31 | ERROR | [x] Missing function doc comment
35 | ERROR | [x] Missing function doc comment
48 | ERROR | [x] Missing function doc comment
----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------

Time: 3.02 secs; Memory: 6MB

Steps to reproduce

Run following command

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

Proposed resolution

Above error/warnings need to be fixed.

šŸ“Œ Task
Status

RTBC

Version

1.0

Component

Code

Created by

šŸ‡®šŸ‡³India samit.310@gmail.com

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

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Issue created by @samit.310@gmail.com
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡³India samit.310@gmail.com

    Above error/warnings are fixed.

  • Assigned to omkar_yewale
  • Issue was unassigned.
  • Status changed to RTBC over 1 year ago
  • šŸ‡®šŸ‡³India omkar_yewale Mumbai

    Thanks for the patch. Cleanly applied and all issues have been resolved.
    Moving RTBC.

  • First commit to issue fork.
  • šŸ‡®šŸ‡³India urvashi_vora Madhya Pradesh, India

    Tested patch provided in #2.

    Steps performed:-
    1. Took clone of the issue
    2. Execute command :- "phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig admin_toolbar_tasks-3344598/"
    3. There were several issues found:-

    urvasi@urvasi-Inspiron-15-3552:/var/www/html/contribution/drupal8/web/modules/contrib$ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig admin_toolbar_tasks-3344598/
    
    FILE: ...dules/contrib/admin_toolbar_tasks-3344598/src/AdminToolbarTasksBuilder.php
    --------------------------------------------------------------------------------
    FOUND 8 ERRORS AFFECTING 8 LINES
    --------------------------------------------------------------------------------
     13 | ERROR | [x] Missing class doc comment
     15 | ERROR | [ ] Missing member variable doc comment
     17 | ERROR | [ ] Missing member variable doc comment
     19 | ERROR | [x] Missing function doc comment
     24 | ERROR | [x] Missing function doc comment
     31 | ERROR | [x] Missing function doc comment
     35 | ERROR | [x] Missing function doc comment
     48 | ERROR | [x] Missing function doc comment
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...web/modules/contrib/admin_toolbar_tasks-3344598/admin_toolbar_tasks.module
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     19 | ERROR | The array declaration extends to column 102 (the limit is 80).
        |       | The array content should be split up over multiple lines
    --------------------------------------------------------------------------------
    
    Time: 525ms; Memory: 10MB
    
    

    4. Applied the patch
    5. Re-executed the command:- "phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig admin_toolbar_tasks-3344598/"
    6. All issues resolved

    urvasi@urvasi-Inspiron-15-3552:/var/www/html/contribution/drupal8/web/modules/contrib$ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig admin_toolbar_tasks-3344598/
    urvasi@urvasi-Inspiron-15-3552:/var/www/html/contribution/drupal8/web/modules/contrib$

    Test Result:- Patch applied successfully. Commiting the changes.

    Thanks for the work.

  • @urvashi_vora opened merge request.
  • Status changed to Needs work over 1 year ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
    +/**
    + * The AdminToolbarTasksBuilder class.
    + */

    A documentation comment should say the purpose of the class not its name, which is already shown in the code.

    +  /**
    +   * Constructs a new AdminToolbarTasksBuilder instance.
    +   *
    +   * @param \Drupal\Core\Menu\LocalTaskManagerInterface $local_task_manager
    +   *   The local task manager service.
    +   * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
    +   *   The route match object to be checked.

    The class name needs to include its namespace.

    +  /**
    +   * The build function.
    +   */

    That is the method name, not its purpose. The return value is not documented.

    +  /**
    +   * The getAdminTasks function.
    +   */
       private function getAdminTasks(CacheableMetadata $cacheability): array {

    Neither the parameters nor the return value are documented.

  • First commit to issue fork.
  • Open on Drupal.org ā†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update 10 months ago
    Waiting for branch to pass
  • Status changed to Needs review 10 months ago
  • šŸ‡®šŸ‡³India nitin_lama India

    No remaining issues left on MR3. Please review.

  • Status changed to RTBC 9 months ago
  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi

    I applied MR !3 and I confirmed that it fixes all the PHPCS issues

    āžœ  admin_toolbar_tasks git:(1.0.x) curl https://git.drupalcode.org/project/admin_toolbar_tasks/-/merge_requests/3.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  3529    0  3529    0     0   7061      0 --:--:-- --:--:-- --:--:--  7172
    patching file admin_toolbar_tasks.module
    patching file 'src/AdminToolbarTasksBuilder.php'
    āžœ  admin_toolbar_tasks git:(1.0.x) āœ— ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml admin_toolbar_tasks
    āžœ  contrib git:(master) āœ— 
    
    
    
Production build 0.71.5 2024