Fix the issues reported by phpcs

Created on 12 May 2023, over 1 year ago
Updated 14 August 2024, 3 months ago
šŸ“Œ Task
Status

RTBC

Version

1.0

Component

Code

Created by

šŸ‡®šŸ‡³India Shanu Chouhan

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.

  • Needs reroll

    The patch will have to be re-rolled with new suggestions/changes described in the comments in the issue.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @Shanu Chouhan
  • Issue was unassigned.
  • šŸ‡®šŸ‡³India Shanu Chouhan

    Fixed some PHPCS issues.

  • Status changed to Needs work over 1 year ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    The issue summary should always describe what the issue is trying to fix and, in the case, of coding standards issues, show which command has been used, which arguments have been used, and which report that command shown.

    The command shown in the issue summary does not use the correct value for --standard.

  • Status changed to Active over 1 year ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    Why is only the Drupal ruleset used? There are two rulesets for Drupal coding standards: Drupal and DrupalPractice.

  • Assigned to PrabuEla
  • šŸ‡®šŸ‡³India PrabuEla chennai
  • šŸ‡®šŸ‡³India PrabuEla chennai
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡³India PrabuEla chennai
  • Status changed to Needs work 5 months ago
  • Hi @everyone,

    Applied patch #2 and patch #5, both applied successfully patch #2 has lesser errors than patch #5

    Patch #2

    eventarc git:(1.0.x) curl https://www.drupal.org/files/issues/2023-05-12/3359957-2.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  2049  100  2049    0     0   4869      0 --:--:-- --:--:-- --:--:--  5034
    patching file src/Controller/EventarcController.php
    patching file src/Event/CloudStorageEvents.php
    patching file src/Event/EventarcEvent.php
    patching file src/Form/ConfigForm.php
    āžœ  eventarc git:(1.0.x) āœ— cd ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig eventarc
    
    FILE: ...9/web/modules/contrib/eventarc/tests/Controller/EventarcControllerTest.php
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     26 | WARNING | Possible useless method overriding detected
    --------------------------------------------------------------------------------
    
    
    FILE: ...-site/drupal-orgissue-v9/web/modules/contrib/eventarc/eventarc.routing.yml
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     14 | WARNING | The administration page callback should probably use
        |         | "administer site configuration" - which implies the user can
        |         | change something - rather than "access administration pages"
        |         | which is about viewing but not changing configurations.
    --------------------------------------------------------------------------------
    
    
    FILE: ...te/drupal-orgissue-v9/web/modules/contrib/eventarc/src/Form/ConfigForm.php
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     43 | WARNING | Unused variable $name_field.
    --------------------------------------------------------------------------------
    
    
    FILE: ...ssue-v9/web/modules/contrib/eventarc/src/Controller/EventarcController.php
    --------------------------------------------------------------------------------
    FOUND 4 ERRORS AND 2 WARNINGS AFFECTING 5 LINES
    --------------------------------------------------------------------------------
       7 | ERROR   | [x] Use statements should be sorted alphabetically. The first
         |         |     wrong one is Drupal\Core\Access\AccessResult.
      99 | ERROR   | [x] Multi-line function declarations must have a trailing
         |         |     comma after the last parameter
      99 | ERROR   | [x] The closing parenthesis of a multi-line function
         |         |     declaration must be on a new line
     166 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
         |         |     injection instead
     188 | WARNING | [ ] t() calls should be avoided in classes, use
         |         |     \Drupal\Core\StringTranslation\StringTranslationTrait and
         |         |     $this->t() instead
     202 | ERROR   | [ ] Public method name "EventarcController::getGoogleJWKs" is
         |         |     not in lowerCamel format
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...-orgissue-v9/web/modules/contrib/eventarc/src/Event/CloudStorageEvents.php
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
    --------------------------------------------------------------------------------
     11 | WARNING | Line exceeds 80 characters; contains 92 characters
     13 | WARNING | Line exceeds 80 characters; contains 89 characters
     25 | WARNING | Line exceeds 80 characters; contains 91 characters
     27 | WARNING | Line exceeds 80 characters; contains 88 characters
    --------------------------------------------------------------------------------
    
    Time: 220ms; Memory: 10MB

    Patch #5

    eventarc git:(1.0.x) curl https://www.drupal.org/files/issues/2023-05-26/best_practice_issue_fixed_3073778_6_0.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  3741  100  3741    0     0  10690      0 --:--:-- --:--:-- --:--:-- 11133
    patching file eventarc.routing.yml
    patching file src/Controller/EventarcController.php
    patching file src/Form/ConfigForm.php
    āžœ  eventarc git:(1.0.x) āœ— cd ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig eventarc
    
    FILE: ...9/web/modules/contrib/eventarc/tests/Controller/EventarcControllerTest.php
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     26 | WARNING | Possible useless method overriding detected
    --------------------------------------------------------------------------------
    
    
    FILE: ...te/drupal-orgissue-v9/web/modules/contrib/eventarc/src/Form/ConfigForm.php
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     10 | WARNING | The class short comment should describe what the class does and
        |         | not simply repeat the class name
    --------------------------------------------------------------------------------
    
    
    FILE: ...ssue-v9/web/modules/contrib/eventarc/src/Controller/EventarcController.php
    --------------------------------------------------------------------------------
    FOUND 8 ERRORS AND 2 WARNINGS AFFECTING 10 LINES
    --------------------------------------------------------------------------------
       7 | ERROR   | [x] Use statements should be sorted alphabetically. The first
         |         |     wrong one is Drupal\Core\Access\AccessResult.
      26 | WARNING | [ ] The class short comment should describe what the class
         |         |     does and not simply repeat the class name
      31 | ERROR   | [ ] Missing member variable doc comment
      83 | ERROR   | [ ] Parameter $requestStack is not described in comment
      96 | ERROR   | [ ] Missing parameter name
     105 | ERROR   | [x] Multi-line function declarations must have a trailing
         |         |     comma after the last parameter
     106 | ERROR   | [x] Multi-line function declaration not indented correctly;
         |         |     expected 2 spaces but found 4
     168 | WARNING | [ ] Line exceeds 80 characters; contains 112 characters
     208 | ERROR   | [ ] Doc comment is empty
     211 | ERROR   | [ ] Public method name "EventarcController::getGoogleJWKs" is
         |         |     not in lowerCamel format
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...-orgissue-v9/web/modules/contrib/eventarc/src/Event/CloudStorageEvents.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AND 4 WARNINGS AFFECTING 5 LINES
    --------------------------------------------------------------------------------
      5 | ERROR   | Doc comment is empty
     11 | WARNING | Line exceeds 80 characters; contains 92 characters
     13 | WARNING | Line exceeds 80 characters; contains 89 characters
     25 | WARNING | Line exceeds 80 characters; contains 91 characters
     27 | WARNING | Line exceeds 80 characters; contains 88 characters
    --------------------------------------------------------------------------------
    
    
    FILE: ...rupal-orgissue-v9/web/modules/contrib/eventarc/src/Event/EventarcEvent.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     31 | ERROR | Doc comment is empty
    --------------------------------------------------------------------------------
    
    Time: 231ms; Memory: 10MB

    Kindly check

    Thanks,
    Jake

  • Assigned to priyanka_chauhan31
  • Issue was unassigned.
  • Status changed to Needs review 5 months ago
  • šŸ‡®šŸ‡³India priyanka_chauhan31 Noida

    Please review the patch.

  • Status changed to Needs work 5 months ago
  • Hi @priyanka_chauhan31,

    Applied your patch successfully, however it still threw one error.

    eventarc git:(1.0.x) curl https://www.drupal.org/files/issues/2024-06-21/phpcs_issues_fix-3359957-9.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  9015  100  9015    0     0  27283      0 --:--:-- --:--:-- --:--:-- 27824
    patching file eventarc.routing.yml
    patching file src/Controller/EventarcController.php
    patching file src/Event/CloudStorageEvents.php
    patching file src/Event/EventarcEvent.php
    patching file src/Form/ConfigForm.php
    patching file tests/Controller/EventarcControllerTest.php
    āžœ  eventarc git:(1.0.x) āœ— cd ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig eventarc
    
    FILE: ...ssue-v9/web/modules/contrib/eventarc/src/Controller/EventarcController.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     110 | ERROR | [x] Multi-line function declarations must have a trailing comma
         |       |     after the last parameter
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    Time: 435ms; Memory: 10MB

    Kindly check

    Thanks,
    Jake

  • Assigned to priyanka_chauhan31
  • Issue was unassigned.
  • Status changed to Needs review 3 months ago
  • šŸ‡®šŸ‡³India priyanka_chauhan31 Noida

    Hi @a.aaronjake, please check. It should resolve the above issue.

  • Status changed to Needs work 3 months ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    Let's create a merge request, now that patches are no longer tested.

  • Pipeline finished with Failed
    3 months ago
    Total: 126s
    #244690
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • First commit to issue fork.
  • Pipeline finished with Failed
    3 months ago
    Total: 138s
    #248639
  • Status changed to Needs review 3 months ago
  • šŸ‡®šŸ‡³India bhaveshdas

    Hi, I have reroll the patch to MR as per #15.
    could you please review it.

    Thankyou !!

  • Status changed to RTBC 3 months ago
  • Hi @everyone,

    I applied the MR !1, confirmed all errors reported were resolved.

    eventarc git:(1.0.x) curl https://git.drupalcode.org/project/eventarc/-/merge_requests/1.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 11296    0 11296    0     0  29436      0 --:--:-- --:--:-- --:--:-- 30365
    patching file .gitlab-ci.yml
    patching file eventarc.routing.yml
    patching file src/Controller/EventarcController.php
    patching file src/Event/CloudStorageEvents.php
    patching file src/Event/EventarcEvent.php
    patching file src/Form/ConfigForm.php
    patching file tests/Controller/EventarcControllerTest.php
    āžœ  eventarc git:(1.0.x) āœ— cd ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig eventarc
    āžœ  contrib git:(master) āœ—

    Will now move this to RTBC

    Thanks,
    Jake

  • Pipeline finished with Failed
    3 months ago
    Total: 295s
    #254204
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
Production build 0.71.5 2024