Fix the issues reported by phpcs

Created on 29 June 2023, over 1 year ago
Updated 27 July 2024, 4 months ago

Problem/Motivation

There are some issues which are reported by PHP code sniffer within the module.

FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-------------------------------------------------------------------------------
15 | WARNING | Unused variable $operations.
56 | WARNING | Unused variable $feed_type_tamper_meta.
-------------------------------------------------------------------------------
FILE: D:\xampp\htdocs\know-how\modules\contrib\feeds_tamper\legacy\feeds_tamper_ui\tests\feeds_tamper_ui.test
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 8 WARNINGS AFFECTING 8 LINES
------------------------------------------------------------------------------------------------------------------------------------------
180 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
181 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
182 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
185 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
186 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
187 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
202 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
218 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------
FILE: D:\xampp\htdocs\know-how\modules\contrib\feeds_tamper\src\Form\TamperEditForm.php
---------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------------
67 | WARNING | Unused variable $tampers_config.
---------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\know-how\modules\contrib\feeds_tamper\tests\src\Functional\UiCrudTest.php
-----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------
182 | WARNING | Unused variable $uuid.

Proposed resolution

Need to fix the following issues using the php code standard commands.

๐Ÿ“Œ Task
Status

Closed: won't fix

Version

2.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia Prachi6824

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 @Prachi6824
  • Status changed to Needs review over 1 year ago
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.5 + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    Patch Failed to Apply
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Prachi6824

    Hello,

    I have created a patch to solve all the errors related to phpcs within the module

    Please review and apply it .

  • Open on Drupal.org โ†’
    Core: 9.5.5 + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    Not currently mergeable.
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia arpitk

    These fixes should always target dev branch.

  • ๐Ÿ‡ณ๐Ÿ‡ฑNetherlands megachriz

    Anything that's inside the folder 'legacy' isn't worth fixing. That is a reminder for me to see what's not ported from the D7 version yet.

    The remaining looks quite minor, not sure if that's worth fixing. The coding standard issues report on https://www.drupal.org/pift-ci-job/2704671 โ†’ do not mark unused variables as a coding standard violation.

    I tempted to close this as "Won't fix". It might be better to put your time in other things.

  • bindu r โ†’ made their first commit to this issueโ€™s fork.

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.5 + Environment: PHP 7.4 & MySQL 5.7
    last update 10 months ago
    36 pass
  • Hi,
    Applied MR !9, can still see some errors.

    FILE: C:\feeds_tamper\feeds_tamper.module
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    ----------------------------------------------------------------------
     15 | WARNING | Unused variable $operations.
     56 | WARNING | Unused variable $feed_type_tamper_meta.
    ----------------------------------------------------------------------
    
    
    FILE: C:\feeds_tamper\legacy\feeds_tamper_ui\tests\feeds_tamper_ui.test
    ------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AND 8 WARNINGS AFFECTING 10 LINES
    ------------------------------------------------------------------------------------------------------------------------------------------
     112 | ERROR   | The array declaration extends to column 94 (the limit is 80). The array content should be split up over multiple lines
     163 | ERROR   | Public method name "FeedsTamperUIWebTestCase::testCSV" is not in lowerCamel format
     193 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
     194 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
     195 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
     198 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
     199 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
     200 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
     215 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
     234 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
    ------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: C:\feeds_tamper\src\Form\TamperEditForm.php
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------
     67 | WARNING | Unused variable $tampers_config.
    ----------------------------------------------------------------------
    
    
    FILE: C:\feeds_tamper\tests\src\Functional\UiCrudTest.php
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------
     182 | WARNING | Unused variable $uuid.
    ----------------------------------------------------------------------
    
  • First commit to issue fork.
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.5 + Environment: PHP 7.4 & MySQL 5.7
    last update 10 months ago
    25 pass, 8 fail
  • Issue was unassigned.
  • Status changed to Needs review 10 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia pray_12
  • Status changed to RTBC 9 months ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines clarkssquared

    Hi

    I applied MR !9 after commit #8 and I confirmed that after applying the patch I can see no PHPCS issues.

    โžœ  feeds_tamper git:(8.x-2.0-beta3) curl https://git.drupalcode.org/project/feeds_tamper/-/merge_requests/9.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 16864    0 16864    0     0  31320      0 --:--:-- --:--:-- --:--:-- 31758
    patching file feeds_tamper.module
    patching file 'legacy/feeds_tamper_ui/feeds_tamper_ui.module'
    patching file 'legacy/feeds_tamper_ui/tests/feeds_tamper_ui.test'
    patching file 'src/Form/TamperEditForm.php'
    patching file 'tests/src/Functional/UiCrudTest.php'
    โžœ  feeds_tamper git:(8.x-2.0-beta3) โœ— ..
    โžœ  contrib git:(master) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml feeds_tamper 
    โžœ  contrib git:(master) โœ— 
    
    
  • Status changed to Closed: won't fix 4 months ago
  • ๐Ÿ‡ณ๐Ÿ‡ฑNetherlands megachriz

    Any remaining reported phpcs issues are in the legacy folder. And for that we have ๐Ÿ“Œ Remove legacy code from D7 Needs review .

    Closing this as "won't fix", because there is no need to fix phpcs issues from the legacy folder.

Production build 0.71.5 2024