Fix the issues reported by phpcs

Created on 9 January 2024, 10 months ago
Updated 27 June 2024, 5 months ago

Problem/Motivation

FILE: /Users/qe42/Sites/contribution/web/modules/contrib/expand_link_formatter/expand_link_formatter.module
-----------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------
21 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
-----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------

FILE: /Users/qe42/Sites/contribution/web/modules/contrib/expand_link_formatter/src/Plugin/Field/FieldFormatter/ExpandLinkFormatter.php
--------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 5 WARNINGS AFFECTING 6 LINES
--------------------------------------------------------------------------------------------------------------------------------------
66 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
96 | ERROR | [x] list(...) is forbidden, use [...] instead.
117 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
118 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
132 | WARNING | [ ] Only string literals should be passed to t() where possible
133 | WARNING | [ ] Only string literals should be passed to t() where possible
--------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------

Time: 283ms; Memory: 10MB

Steps to reproduce

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

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ“Œ Task
Status

RTBC

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia mahtab_alam

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 @mahtab_alam
  • Assigned to sourabhjain
  • Issue was unassigned.
  • Status changed to Needs review 10 months ago
  • Status changed to Needs work 10 months ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines clarkssquared

    Hi

    Your MR seems to have conflict with the base branch which blocks your merge request, I also tried to apply your MR !2 and below is what my terminal says

    โžœ  expand_link_formatter git:(8.x-1.0-beta2) โœ— curl https://git.drupalcode.org/project/expand_link_formatter/-/merge_requests/2.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  2791    0  2791    0     0   4603      0 --:--:-- --:--:-- --:--:--  4651
    patching file expand_link_formatter.module
    patching file 'src/Plugin/Field/FieldFormatter/ExpandLinkFormatter.php'
    Reversed (or previously applied) patch detected!  Assume -R? [y] y
    2 out of 4 hunks failed--saving rejects to 'src/Plugin/Field/FieldFormatter/ExpandLinkFormatter.php.rej'
    โžœ  expand_link_formatter git:(8.x-1.0-beta2) โœ— 

    hence I will move this issue to needs work and fix the conflict in your MR

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia zkhan.aamir

    Issue summary updated

  • Status changed to Needs review 10 months ago
  • Status changed to Needs work 10 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia zkhan.aamir

    Hi

    MR #7 applied successfully.

    Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules/contrib/expand_link_formatter (8.x-1.x)
    $ curl https://git.drupalcode.org/project/expand_link_formatter/-/merge_requests/2.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100   989    0   989    0     0   1969      0 --:--:-- --:--:-- --:--:--  1974
    patching file src/Plugin/Field/FieldFormatter/ExpandLinkFormatter.php
    

    Still some warnings are remaining

    Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules/contrib
    $ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,js,yml expand_link_formatter/
    
    FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\contrib\expand_link_formatter\src\Plugin\Field\FieldFormatter\ExpandLinkFormatter.php
    ----------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 3 LINES
    ----------------------------------------------------------------------------------------------------------------------------------------------
      78 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
     133 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
     133 | WARNING | Only string literals should be passed to t() where possible
     134 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
     134 | WARNING | Only string literals should be passed to t() where possible
    ----------------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 291ms; Memory: 10MB
    
  • First commit to issue fork.
  • Status changed to Needs review 10 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sakthi_dev

    Please review.

  • Status changed to Needs work 10 months ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines clarkssquared

    Hi

    I applied the MR !2 after the commit #9 and This is the remaining PHPCS issues that my terminal is showing.

    โžœ  expand_link_formatter git:(8.x-1.0-beta2) curl https://git.drupalcode.org/project/expand_link_formatter/-/merge_requests/2.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  2310    0  2310    0     0   4382      0 --:--:-- --:--:-- --:--:--  4425
    patching file 'src/Plugin/Field/FieldFormatter/ExpandLinkFormatter.php'
    โžœ  expand_link_formatter git:(8.x-1.0-beta2) โœ— ..
    โžœ  contrib git:(master) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml expand_link_formatter
    
    FILE: ...and_link_formatter/src/Plugin/Field/FieldFormatter/ExpandLinkFormatter.php
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    --------------------------------------------------------------------------------
     133 | WARNING | Only string literals should be passed to t() where possible
     134 | WARNING | Only string literals should be passed to t() where possible
    --------------------------------------------------------------------------------
    
    Time: 255ms; Memory: 10MB
    
    โžœ  contrib git:(master) โœ— 
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia mohd sahzad

    Mohd Sahzad โ†’ made their first commit to this issueโ€™s fork.

  • Status changed to Needs review 10 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia mohd sahzad

    Hi @clarkssquared,
    I have fixed remaining PHPCS issues please review last commit in MR !2

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia zkhan.aamir

    Hi,

    MR #13 applied successfully

    Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules/contrib/expand_link_formatter (8.x-1.x)
    $ curl https://git.drupalcode.org/project/expand_link_formatter/-/merge_requests/2.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  2737    0  2737    0     0   7332      0 --:--:-- --:--:-- --:--:--  7377
    patching file src/Plugin/Field/FieldFormatter/ExpandLinkFormatter.php
    

    All the issues are resolved

    Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules/contrib
    $ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,js,yml expand_link_formatter/
    
    Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules/contrib
    $
    
    
    
  • Status changed to RTBC 5 months ago
Production build 0.71.5 2024