Coding standards fixes

Created on 6 February 2023, over 1 year ago

Problem/Motivation

A scan of this module identifies several coding standards issues:

./vendor/bin/phpcs -p --colors --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md --ignore=node_modules,vendor ./web/modules/contrib/feeds_tamper
W..W...........EE............W... 33 / 33 (100%)



FILE: /var/www/html/web/modules/contrib/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: /var/www/html/web/modules/contrib/feeds_tamper/tests/src/Functional/UiCrudTest.php
----------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------
 182 | WARNING | Unused variable $uuid.
----------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/contrib/feeds_tamper/legacy/feeds_tamper_ui/feeds_tamper_ui.module
--------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------------------------------
  6 | ERROR | [x] There must be exactly one blank line after the file comment
 12 | ERROR | [x] Expected 1 blank line before function; 2 found
 35 | ERROR | [x] Expected "object" but found "stdClass" for parameter type
--------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/contrib/feeds_tamper/legacy/feeds_tamper_ui/tests/feeds_tamper_ui.test
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 51 ERRORS AND 9 WARNINGS AFFECTING 51 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
  13 | ERROR   | [x] Missing function doc comment
  14 | ERROR   | [x] Short array syntax must be used to define arrays
  19 | ERROR   | [x] Expected 1 blank line after function; 0 found
  20 | ERROR   | [x] Missing function doc comment
  21 | ERROR   | [x] Short array syntax must be used to define arrays
  21 | ERROR   | [x] Short array syntax must be used to define arrays
  24 | ERROR   | [x] Missing function doc comment
  32 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 5
  36 | ERROR   | [x] Short array syntax must be used to define arrays
  37 | ERROR   | [x] Short array syntax must be used to define arrays
  42 | ERROR   | [x] Short array syntax must be used to define arrays
  47 | ERROR   | [x] Short array syntax must be used to define arrays
  64 | ERROR   | [x] Short array syntax must be used to define arrays
  77 | ERROR   | [x] Short array syntax must be used to define arrays
  81 | ERROR   | [x] Short array syntax must be used to define arrays
  92 | ERROR   | [x] Short array syntax must be used to define arrays
 101 | ERROR   | [x] Short array syntax must be used to define arrays
 102 | ERROR   | [ ] The array declaration extends to column 99 (the limit is 80). The array content should be split up over multiple lines
 102 | ERROR   | [x] Short array syntax must be used to define arrays
 111 | ERROR   | [x] Short array syntax must be used to define arrays
 116 | ERROR   | [x] Short array syntax must be used to define arrays
 117 | ERROR   | [x] Short array syntax must be used to define arrays
 126 | ERROR   | [x] Short array syntax must be used to define arrays
 131 | ERROR   | [x] Short array syntax must be used to define arrays
 137 | ERROR   | [x] Short array syntax must be used to define arrays
 145 | ERROR   | [x] Short array syntax must be used to define arrays
 147 | ERROR   | [x] Short array syntax must be used to define arrays
 150 | ERROR   | [ ] Public method name "FeedsTamperUIWebTestCase::testCSV" is not in lowerCamel format
 150 | ERROR   | [x] Missing function doc comment
 158 | ERROR   | [x] Short array syntax must be used to define arrays
 159 | ERROR   | [x] Short array syntax must be used to define arrays
 163 | ERROR   | [x] Short array syntax must be used to define arrays
 168 | ERROR   | [x] Short array syntax must be used to define arrays
 176 | ERROR   | [x] Short array syntax must be used to define arrays
 180 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 181 | ERROR   | [x] Short array syntax must be used to define arrays
 181 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 182 | ERROR   | [x] Short array syntax must be used to define arrays
 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 | ERROR   | [x] Short array syntax must be used to define arrays
 186 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 187 | ERROR   | [x] Short array syntax must be used to define arrays
 187 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 198 | ERROR   | [x] Short array syntax must be used to define arrays
 200 | WARNING | [x] A comma should follow the last multiline array item. Found: FALSE
 202 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 204 | ERROR   | [x] Short array syntax must be used to define arrays
 213 | ERROR   | [x] Missing function doc comment
 213 | ERROR   | [x] Short array syntax must be used to define arrays
 218 | ERROR   | [x] Short array syntax must be used to define arrays
 218 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 223 | ERROR   | [x] Short array syntax must be used to define arrays
 241 | ERROR   | [x] Missing function doc comment
 245 | ERROR   | [x] Short array syntax must be used to define arrays
 250 | ERROR   | [x] Missing function doc comment
 253 | ERROR   | [x] Short array syntax must be used to define arrays
 258 | ERROR   | [x] Missing function doc comment
 264 | ERROR   | [x] Short array syntax must be used to define arrays
 267 | ERROR   | [x] Short array syntax must be used to define arrays
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 50 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/contrib/feeds_tamper/src/Form/TamperEditForm.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 67 | WARNING | Unused variable $tampers_config.
--------------------------------------------------------------------------------
πŸ“Œ Task
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡―πŸ‡΅Japan ptmkenny

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @ptmkenny
  • @ptmkenny opened merge request.
  • Status changed to Needs review over 1 year ago
  • πŸ‡―πŸ‡΅Japan ptmkenny

    The MR fixes many of the issues. The remaining issues are related to DI (which I think should be in a separate issue because it can break things) and "unused variables" that actually appear to have functions in the code, which I think should be resolved by someone who understands the code better than me :)

    Remaining issues:

    
    
    FILE: /var/www/html/web/modules/contrib/feeds_tamper/feeds_tamper.module
    ------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------
     54 | WARNING | Unused variable $feed_type_tamper_meta.
    ------------------------------------------------------------------------
    
    
    FILE: /var/www/html/web/modules/contrib/feeds_tamper/tests/src/Functional/UiCrudTest.php
    ----------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------
     182 | WARNING | Unused variable $uuid.
    ----------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/web/modules/contrib/feeds_tamper/legacy/feeds_tamper_ui/tests/feeds_tamper_ui.test
    ------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 8 WARNINGS AFFECTING 9 LINES
    ------------------------------------------------------------------------------------------------------------------------------
     166 | ERROR   | Public method name "FeedsTamperUIWebTestCase::testCSV" is not in lowerCamel format
     196 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and
         |         | $this->t() instead
     197 | 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
     201 | 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
     203 | 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
     237 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and
         |         | $this->t() instead
    ------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/web/modules/contrib/feeds_tamper/src/Form/TamperEditForm.php
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     67 | WARNING | Unused variable $tampers_config.
    --------------------------------------------------------------------------------
    
  • πŸ‡³πŸ‡±Netherlands MegaChriz

    Anything in the legacy folder is not worth fixing, so don't spend any extra time there. The legacy folder only contains the code that has not been ported yet from the D7 version.

    We should remove the legacy folder before releasing a stable version. I am first focussing on getting Feeds stable, so Feeds Tamper only gets minimal attention from me right now.

Production build 0.69.0 2024