Fix the issues reported by phpcs

Created on 22 June 2023, about 2 years ago
Updated 4 July 2023, about 2 years ago

Problem/Motivation

----------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
----------------------------------------------------------------------
  34 | ERROR   | Type hint "array" missing for $variables
 153 | WARNING | Line exceeds 80 characters; contains 109 characters
----------------------------------------------------------------------


FILE: /var/www/html/seeds_media/src/Form/SeedsMediaConfigForm.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 9 | ERROR | Doc comment is empty
----------------------------------------------------------------------


FILE: /var/www/html/seeds_media/src/Form/EntityEmbedDialog.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 9 | ERROR | Doc comment is empty
----------------------------------------------------------------------


FILE: /var/www/html/seeds_media/src/Plugin/entity_embed/EntityEmbedDisplay/MediaImage.php
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AND 1 WARNING AFFECTING 6 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
  45 | WARNING | [ ] Line exceeds 80 characters; contains 84 characters
  62 | ERROR   | [ ] sizeof() is a function name alias, use count() instead
  86 | ERROR   | [ ] The array declaration extends to column 305 (the limit is 80). The array content should be split up over multiple lines
 172 | ERROR   | [ ] Description for the @return value is missing
 198 | ERROR   | [x] list(...) is forbidden, use [...] instead.
 264 | ERROR   | [ ] The array declaration extends to column 106 (the limit is 80). The array content should be split up over multiple lines
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/seeds_media/src/MediaHelper.php
---------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 3 LINES
---------------------------------------------------------------------------
  31 | ERROR | Parameter $entity_field_manager is not described in comment
 140 | ERROR | Throws comment indentation must be 3 spaces, found 1 spaces
 140 | ERROR | @throws tag comment must start with a capital letter
 238 | ERROR | @throws comment must be on the next line
---------------------------------------------------------------------------

Steps to reproduce

Run following command
phpcs --standard=โ€œDrupal,DrupalPracticeโ€ --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,css,js .

๐Ÿ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal365365

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 @vishal365365
  • Issue was unassigned.
  • Status changed to Fixed about 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal365365

    Issues Fixed

  • Status changed to Needs review about 2 years ago
  • Status changed to Needs work about 2 years ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines clarkssquared

    Hi vishal365365

    I applied your patch #2 to my local but I noticed that after applying the patch there are still PHPCS issues/warning shown in my terminal, I executed the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml seeds_media and below is the output of my terminal

    FILE: /Users/studenttrainees/Projects/drupalorgissues/docroot/modules/contrib/seeds_media/README.md
    ---------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
    ---------------------------------------------------------------------------------------------------
    6 | WARNING | Line exceeds 80 characters; contains 110 characters
    7 | WARNING | Line exceeds 80 characters; contains 130 characters
    9 | WARNING | Line exceeds 80 characters; contains 81 characters
    15 | WARNING | Line exceeds 80 characters; contains 114 characters
    22 | WARNING | Line exceeds 80 characters; contains 114 characters
    ---------------------------------------------------------------------------------------------------

    FILE: /Users/studenttrainees/Projects/drupalorgissues/docroot/modules/contrib/seeds_media/src/Form/SeedsMediaConfigForm.php
    -----------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    -----------------------------------------------------------------------------------------------------------------------------------------
    30 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
    41 | WARNING | ImageStyle::loadMultiple calls should be avoided in classes, use dependency injection instead
    50 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
    -----------------------------------------------------------------------------------------------------------------------------------------

    FILE: /Users/studenttrainees/Projects/drupalorgissues/docroot/modules/contrib/seeds_media/src/Plugin/entity_embed/EntityEmbedDisplay/MediaImage.php
    ---------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 6 WARNINGS AFFECTING 6 LINES
    ---------------------------------------------------------------------------------------------------------------------------------------------------
    50 | WARNING | Unused variable $embed_button.
    52 | WARNING | Unused variable $editor.
    54 | WARNING | Unused variable $entity.
    55 | WARNING | Unused variable $values.
    80 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
    99 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
    ---------------------------------------------------------------------------------------------------------------------------------------------------

    FILE: /Users/studenttrainees/Projects/drupalorgissues/docroot/modules/contrib/seeds_media/src/MediaHelper.php
    -------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------
    106 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    -------------------------------------------------------------------------------------------------------------

    Time: 403ms; Memory: 10MB

    Please also look at the attached screenshots for your reference.

    Thank you

  • Assigned to nitin_lama
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama India
  • First commit to issue fork.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia bharath-kondeti Hyderabad

    Attaching a patch addressing all the issue. Please review

  • Status changed to Needs review about 2 years ago
  • @bharath-kondeti opened merge request.
  • Issue was unassigned.
  • Status changed to Needs work about 2 years 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 and arguments have been used and which report that command shown. In this way, project maintainers can verify the patch/MR fixes all the warnings/errors.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada imustakim Canada

    Issue summary updated.

  • Status changed to Needs review about 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
Production build 0.71.5 2024