Fix the errors/warnings reported by PHP_CodeSniffer

Created on 9 July 2022, almost 2 years ago
Updated 1 January 2024, 6 months ago

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

FILE: ./video_embed_twitter.info.yml
-------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------------------------
 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
 7 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
-------------------------------------------------------------------------------------------------------------------


FILE: ./tests/src/Unit/ProviderUrlParseTest.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------
 15 | ERROR | Missing short description in doc comment
------------------------------------------------------------------------------------------------------------------------------


FILE: ./src/Plugin/video_embed_field/Provider/Twitter.php
----------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------------
 7 | ERROR | Missing short description in doc comment
----------------------------------------------------------------------------------------------------------------------------------------+
šŸ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

šŸ‡®šŸ‡³India Harsh panchal

Live updates comments and jobs are added and updated live.
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.

  • Before applying the patch, I get this output:

    FILE: /var/www/html/repos/video_embed_twitter/src/Plugin/video_embed_field/Provider/Twitter.php
    -----------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------
    7 | ERROR | Missing short description in doc comment
    -----------------------------------------------------------------------------------------------


    FILE: /var/www/html/repos/video_embed_twitter/tests/src/Unit/ProviderUrlParseTest.php
    -------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------
    15 | ERROR | Missing short description in doc comment
    -------------------------------------------------------------------------------------

    FILE: /var/www/html/repos/video_embed_twitter/video_embed_twitter.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


    But the patch provided by @Harsh Panchal worked well for me. Tested with Gitpod on Drupal version 9.5.11

  • Status changed to Needs work 6 months ago
  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi

    I applied patch #2 and I confirmed that it fixes the PHPCS errors, but I will transition this to needs work because there is 1 file in the patch that was rejected and failed to apply.

    āžœ  video_embed_twitter git:(master) āœ— curl https://www.drupal.org/files/issues/2022-07-09/phpcs-drupal-standard-3295104-2.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  1404  100  1404    0     0   3031      0 --:--:-- --:--:-- --:--:--  3072
    patching file 'src/Plugin/video_embed_field/Provider/Twitter.php'
    patching file 'tests/src/Unit/ProviderUrlParseTest.php'
    patching file video_embed_twitter.info.yml
    1 out of 1 hunks failed--saving rejects to video_embed_twitter.info.yml.rej
    āžœ  video_embed_twitter git:(master) āœ— ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml video_embed_twitter
    
    FILE: /Users/clarksubing-subing/Projects/d9/d9-local/web/modules/contrib/video_embed_twitter/video_embed_twitter.info.yml
    -------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 2 LINES
    -------------------------------------------------------------------------------------------------------------------------
     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
     7 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
    -------------------------------------------------------------------------------------------------------------------------
    
    Time: 215ms; Memory: 10MB
    
    āžœ  contrib git:(master) āœ—
  • šŸ‡®šŸ‡³India ankithashetty Karnataka, India
  • Merge request !2Issue #3295104: Fix PHPCS errors. ā†’ (Open) created by ankithashetty
  • Status changed to Needs review 6 months ago
  • šŸ‡®šŸ‡³India ankithashetty Karnataka, India

    PHPCS errors are fixed in MR and ready for review.
    The MR has an additional fix : WARNING | All dependencies must be prefixed with the project name, for example "drupal:"

    Thanks!

  • Issue was unassigned.
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    I am resetting the Assigned field, since the person to which this issue was assigned has not worked on it in more than seven days. I apologize for bumping this issue.

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
Production build 0.69.0 2024