Fix the issues reported by phpcs

Created on 8 May 2023, over 1 year ago
Updated 12 July 2024, 4 months ago
📌 Task
Status

RTBC

Version

1.0

Component

Code

Created by

🇮🇳India himanshu_jhaloya 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 @himanshu_jhaloya
  • Merge request !1fixed phpcs issue → (Open) created by himanshu_jhaloya
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Status changed to Needs work 4 months ago
  • 🇵🇭Philippines cleavinjosh

    Hi @himanshu_jhaloya,

    I applied MR!1 and it was applied smoothly. However, I still encountered some issues after I ran phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml.

    ➜  gmv git:(1.0.x) curl https://git.drupalcode.org/project/gmv/-/merge_requests/1.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 11829    0 11829    0     0  27115      0 --:--:-- --:--:-- --:--:-- 27130
    patching file README.md
    patching file gmv.info.yml
    patching file gmv.libraries.yml
    patching file gmv.module
    patching file src/Plugin/Field/FieldFormatter/ThreeDeeObjectFieldFormatter.php
    patching file src/Plugin/Field/FieldType/ThreeDeeObject.php
    patching file src/Plugin/Field/FieldWidget/ThreeDeeObjectWidget.php
    ➜  gmv git:(1.0.x) ✗ ..
    ➜  contrib git:(main) ✗ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml gmv
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/gmv/src/Plugin/Field/FieldType/ThreeDeeObject.php
    -----------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------
     8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormStateInterface.
    -----------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/gmv/src/Plugin/Field/FieldFormatter/ThreeDeeObjectFieldFormatter.php
    -----------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------------------
     8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Entity\EntityTypeManagerInterface.
    -----------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 174ms; Memory: 10MB
    
    ➜  contrib git:(main) ✗
    
  • Pipeline finished with Success
    4 months ago
    Total: 129s
    #221842
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    There are still two PHP_CodeSniffer errors to fix.

    FILE: ...b/modules/custom/gmv-3358798/src/Plugin/Field/FieldType/ThreeDeeObject.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     8 | ERROR | [x] Use statements should be sorted alphabetically. The first
       |       |     wrong one is Drupal\Core\Form\FormStateInterface.
       |       |     (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    FILE: ...v-3358798/src/Plugin/Field/FieldFormatter/ThreeDeeObjectFieldFormatter.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     8 | ERROR | [x] Use statements should be sorted alphabetically. The first
       |       |     wrong one is Drupal\Core\Entity\EntityTypeManagerInterface.
       |       |     (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    Time: 166ms; Memory: 6MB
    

     

  • Pipeline finished with Success
    4 months ago
    #221849
  • Status changed to Needs review 4 months ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Pipeline finished with Success
    4 months ago
    Total: 133s
    #221861
  • Pipeline finished with Success
    4 months ago
    #221888
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Assigned to amanbtr72
  • Status changed to Needs work 4 months ago
  • 🇮🇳India amanbtr72

    Reviewed the MR 3 Still found some errors

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

    FILE: D:\wamp64\www\drupal10\modules\custom\doissues\gmv-3358798\gmv.module
    --------------------------------------------------------------------------------
    FOUND 5 ERRORS AFFECTING 3 LINES
    --------------------------------------------------------------------------------
    3 | ERROR | Missing short description in doc comment
    10 | ERROR | Doc comment short description must end with a full stop
    12 | ERROR | The array declaration extends to column 150 (the limit is 120).
    | | The array content should be split up over multiple lines
    12 | ERROR | The array declaration extends to column 149 (the limit is 120).
    | | The array content should be split up over multiple lines
    12 | ERROR | The array declaration extends to column 148 (the limit is 120).
    | | The array content should be split up over multiple lines
    --------------------------------------------------------------------------------

    FILE: D:\wamp64\www\drupal10\modules\custom\doissues\gmv-3358798\README.md
    --------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    --------------------------------------------------------------------------
    3 | WARNING | Line exceeds 80 characters; contains 87 characters
    4 | WARNING | Line exceeds 80 characters; contains 107 characters
    7 | WARNING | Line exceeds 80 characters; contains 132 characters
    --------------------------------------------------------------------------

    FILE: ...v-3358798\src\Plugin\Field\FieldFormatter\ThreeDeeObjectFieldFormatter.php
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
    --------------------------------------------------------------------------------
    62 | WARNING | File::load calls should be avoided in classes, use dependency
    | | injection instead
    67 | WARNING | \Drupal calls should be avoided in classes, use dependency
    | | injection instead
    72 | WARNING | File::load calls should be avoided in classes, use dependency
    | | injection instead
    73 | WARNING | \Drupal calls should be avoided in classes, use dependency
    | | injection instead
    --------------------------------------------------------------------------------

    Time: 852ms; Memory: 12MB

  • Pipeline finished with Failed
    4 months ago
    Total: 136s
    #222452
  • Issue was unassigned.
  • Status changed to Needs review 4 months ago
  • 🇮🇳India amanbtr72

    fixed remaining issues

  • Pipeline finished with Success
    4 months ago
    Total: 208s
    #222508
  • Status changed to Needs work 4 months ago
  • 🇮🇳India bhaveshdas

    I applied MR!3 and I still encountered some issues after I ran vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig modules/custom/gmv-3358798/

    FILE: /var/www/html/drupal-contri-d10/modules/custom/gmv-3358798/gmv.module
    ---------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 3 LINES
    ---------------------------------------------------------------------------
     10 | ERROR | [x] There must be no blank lines after the function comment
     14 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 0
     28 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 0
    ---------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------
    
    Time: 138ms; Memory: 10MB
    
  • Status changed to Needs review 4 months ago
  • 🇮🇳India bhaveshdas

    I have fixed remaining issues on this 9be7c077 ticket could you please review it.

    Thankyou !

  • Pipeline finished with Success
    4 months ago
    Total: 150s
    #222559
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    The MR to review was MR !1, which already fixed all the issues. MR !3 has been used to obtain a list of all the issues that were to be fixed.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    apaderno → changed the visibility of the branch 3358798-gitlab-ci-reports to hidden.

  • Status changed to RTBC 4 months ago
  • 🇵🇭Philippines roberttabigue

    Hi @everyone!

    I have applied the latest fixes to the Google Module Viewer module against 1.0.x-dev on Drupal 10 and confirmed all PHPCS errors have been fixed.

    I ran this command on the module:
    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml gmv/

    Please see the attached file for reference.

    I'm moving this now to ‘RTBC’.

    Thank you!

Production build 0.71.5 2024