Fix the issues reported by phpcs

Created on 4 July 2023, over 1 year ago
Updated 28 September 2023, about 1 year ago

Problem/Motivation

FILE: /var/www/html/vb/d_cont/seb/README.md
------------------------------------------------------------------------
FOUND 1 ERROR AND 7 WARNINGS AFFECTING 8 LINES
------------------------------------------------------------------------
3 | WARNING | [ ] Line exceeds 80 characters; contains 151 characters
5 | WARNING | [ ] Line exceeds 80 characters; contains 89 characters
7 | WARNING | [ ] Line exceeds 80 characters; contains 96 characters
12 | WARNING | [ ] Line exceeds 80 characters; contains 112 characters
14 | WARNING | [ ] Line exceeds 80 characters; contains 133 characters
18 | WARNING | [ ] Line exceeds 80 characters; contains 142 characters
22 | WARNING | [ ] Line exceeds 80 characters; contains 120 characters
28 | ERROR | [x] Expected 1 newline at end of file; 0 found
------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/seb/src/Plugin/Derivative/EntityBlock.php
----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------
83 | WARNING | [x] 'TODO: Add proper config dependencies.' should match the format '@todo Fix problem X here.'
----------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/seb/seb.info.yml
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
4 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

Time: 148ms; Memory: 12MB

Steps to reproduce

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig seb/

Remaining tasks

Patch review

šŸ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

šŸ‡®šŸ‡³India urvashi_vora Madhya Pradesh, India

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 @urvashi_vora
  • Hii, @urvashi_vora

    These are the steps I followed:

    1. Took clone from git version 1.0.x in drupal 10.1.x

    2. Ran this command:

    ./vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig modules/contrib/seb/

    3. Applied your patch and, again ran phpcs command

    found errors.

    4. Fixed the errors and provide the patch.

    Please Review.

  • Status changed to Needs work about 1 year ago
  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi Satish_kumar,

    I tried to apply your patch using git apply -v but the patch skips and fails to apply, please look at the result in my terminal below:

     seb git:(master) āœ— curl https://www.drupal.org/files/issues/2023-09-21/coding-standard-fixed-3372227-2.patch | git apply -v
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  4056  100  4056    0     0  15392      0 --:--:-- --:--:-- --:--:-- 15905
    Skipped patch 'README.md'.
    Skipped patch 'seb.info.yml'.
    Skipped patch 'src/Plugin/Block/EntityBlock.php'.
    Skipped patch 'src/Plugin/Derivative/EntityBlock.php'.
    

    I then used the patch -p1 approach and the patch was applied except for seb.info.yml because it's been rejected

    āžœ  seb git:(master) āœ— curl https://www.drupal.org/files/issues/2023-09-21/coding-standard-fixed-3372227-2.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  4056  100  4056    0     0  11585      0 --:--:-- --:--:-- --:--:-- 11825
    patching file README.md
    patching file seb.info.yml
    1 out of 1 hunks failed--saving rejects to seb.info.yml.rej
    patching file 'src/Plugin/Block/EntityBlock.php'
    patching file 'src/Plugin/Derivative/EntityBlock.php'
    

    I then tried to execute the PHPCS command but there are still many PHPCS issues being flagged, for your reference, below are the issues being flagged:

    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml seb
    
    FILE: /Users/clarksubing-subing/Projects/d9/d9-local/web/modules/contrib/seb/README.md
    --------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 7 WARNINGS AFFECTING 8 LINES
    --------------------------------------------------------------------------------------
      3 | WARNING | [ ] Line exceeds 80 characters; contains 151 characters
      5 | WARNING | [ ] Line exceeds 80 characters; contains 89 characters
      7 | WARNING | [ ] Line exceeds 80 characters; contains 96 characters
     12 | WARNING | [ ] Line exceeds 80 characters; contains 112 characters
     14 | WARNING | [ ] Line exceeds 80 characters; contains 133 characters
     18 | WARNING | [ ] Line exceeds 80 characters; contains 142 characters
     22 | WARNING | [ ] Line exceeds 80 characters; contains 120 characters
     28 | ERROR   | [x] Expected 1 newline at end of file; 0 found
    --------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------
    
    
    FILE: /Users/clarksubing-subing/Projects/d9/d9-local/web/modules/contrib/seb/seb.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/seb/src/Plugin/Derivative/EntityBlock.php
    ------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------
     83 | WARNING | [x] 'TODO: Add proper config dependencies.' should match the format '@todo Fix problem X here.'
    ------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/clarksubing-subing/Projects/d9/d9-local/web/modules/contrib/seb/src/Plugin/Block/EntityBlock.php
    ------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------
     12 | 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
    ------------------------------------------------------------------------------------------------------------------------------
    
    Time: 324ms; Memory: 14MB
    
    āžœ  contrib git:(master) āœ— 
    
  • šŸ‡®šŸ‡³India sakthi_dev

    Hi @clarkssquared, I tried to apply the #2 patch and it applied successfully and no issues lists for phpcs. After one more review we can move to RTBC, Attaching the screenshot.

  • Status changed to Needs review about 1 year ago
  • Status changed to RTBC about 1 year ago
  • šŸ‡®šŸ‡³India aayushDrupal

    Hi,
    The #2 patch was successfully applied with no remaining issues listed for phpcs. Please refer to the attached screenshot for your reference and verification.

    Moving to RTBC .
    Thanks.

  • First commit to issue fork.
  • @syammohanmp opened merge request.
    • 9d2e4bf2 committed on 1.0.x
      #3372227: Drupal standard fixes.
      
  • Status changed to Fixed about 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024