7.x phpcs coding standards

Created on 22 February 2023, almost 2 years ago

Coding standards fixes remaining

โœจ Feature request
Status

Active

Version

3.0

Component

Code

Created by

๐Ÿ‡ฆ๐Ÿ‡บAustralia VladimirAus Brisbane, Australia

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

Merge Requests

Comments & Activities

  • Issue created by @VladimirAus
  • Status changed to Needs work almost 2 years ago
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia VladimirAus Brisbane, Australia
  • First commit to issue fork.
  • First commit to issue fork.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia annmarysruthy

    Made commit to fix some more issues in phpcs. However 1 warning is remaining which cannot be solved.

    FILE: /var/www/html/web/modules/contrib/weight-3343609/weight.views.inc
    -----------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------
    17 | WARNING | Unused variable $table_name.
    -----------------------------------------------------------------------

    we cannot remove the $table_name variable from the foreach loop because it is used as a key in the $data array. Removing it would cause an error in the loop, as it would not be possible to access the data in the $data array without the key.

  • Status changed to Needs review almost 2 years ago
  • Status changed to Needs work almost 2 years ago
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia VladimirAus Brisbane, Australia

    Thanks for commit. phpcs return other errors

    FILE: /Users/tesboss/_PROJECTS/drupal/weight/weight.module
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
     153 | WARNING | Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements hook_foo_BAR_ID_bar() for
         |         | xyz-bar.html.twig.", "* Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates."
     192 | WARNING | Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements hook_foo_BAR_ID_bar() for
         |         | xyz-bar.html.twig.", "* Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates."
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/tesboss/_PROJECTS/drupal/weight/weight.install
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
     78 | ERROR | Doc comment is empty
    ----------------------------------------------------------------------
    
    
    FILE: /Users/tesboss/_PROJECTS/drupal/weight/views/views_handler_weight_selector.inc
    -------------------------------------------------------------------------------------------------------------------
    FOUND 14 ERRORS AND 2 WARNINGS AFFECTING 14 LINES
    -------------------------------------------------------------------------------------------------------------------
       3 | ERROR   | Doc comment is empty
       6 | ERROR   | Class name must begin with a capital letter
       6 | ERROR   | Class name must use UpperCamel naming without underscores
       6 | WARNING | Class name must be prefixed with the project name "Weight"
       8 | ERROR   | Doc comment is empty
      17 | ERROR   | Doc comment is empty
      20 | ERROR   | Public method name "views_handler_weight_selector::option_definition" is not in lowerCamel format
      30 | ERROR   | Doc comment is empty
      33 | ERROR   | Public method name "views_handler_weight_selector::options_form" is not in lowerCamel format
      47 | ERROR   | Doc comment is empty
      54 | ERROR   | Doc comment is empty
      61 | ERROR   | Doc comment is empty
      64 | ERROR   | Public method name "views_handler_weight_selector::views_form" is not in lowerCamel format
      91 | WARNING | Line exceeds 80 characters; contains 83 characters
     123 | ERROR   | Doc comment is empty
     126 | ERROR   | Public method name "views_handler_weight_selector::views_form_submit" is not in lowerCamel format
    -------------------------------------------------------------------------------------------------------------------
    
    
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States nmorin Huntsville, AL

    Getting Error when attempting to update weight module... Is this related to the errors in the previous comments?

    PHP Parse error:  syntax error, unexpected '?', expecting ')' in /var/www/drupalbase/sites/all/modules/weight/weight.install on line 39
    Drush command terminated abnormally due to an unrecoverable error.                                                                           [error]
    Error: syntax error, unexpected '?', expecting ')' in /var/www/drupalbase/sites/all/modules/weight/weight.install, line 39
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States dhigby

    I got the same "unexpected '?'" error, reported here: https://www.drupal.org/project/weight/issues/3344820 ๐Ÿ› Apache 500 error with 7.x-3.2 Needs review

  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia VladimirAus Brisbane, Australia

    Patch was pushed for testing for ๐Ÿ› Apache 500 error with 7.x-3.2 Needs review .
    Please test.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • First commit to issue fork.
  • First commit to issue fork.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia zkhan.aamir

    Hi,

    MR #15 applied successfully.

    Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules/contrib/weight (7.x-3.x)
    $ curl https://git.drupalcode.org/project/weight/-/merge_requests/10.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 16773    0 16773    0     0  17530      0 --:--:-- --:--:-- --:--:-- 17544
    patching file .gitlab-ci.yml
    patching file README.md (renamed from README.txt)
    patching file views/views_handler_weight_selector.inc
    patching file views/weight.views.inc
    patching file weight.install
    patching file weight.module
    

    Remaining issues

    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 weight/
    
    FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\contrib\weight\views\views_handler_weight_selector.inc
    -------------------------------------------------------------------------------------------------------------------
    FOUND 6 ERRORS AND 1 WARNING AFFECTING 5 LINES
    -------------------------------------------------------------------------------------------------------------------
       6 | ERROR   | Class name must begin with a capital letter
       6 | ERROR   | Class name must use UpperCamel naming without underscores
       6 | WARNING | Class name must be prefixed with the project name "Weight"
      28 | ERROR   | Public method name "views_handler_weight_selector::option_definition" is not in lowerCamel format
      46 | ERROR   | Public method name "views_handler_weight_selector::options_form" is not in lowerCamel format
      91 | ERROR   | Public method name "views_handler_weight_selector::views_form" is not in lowerCamel format
     158 | ERROR   | Public method name "views_handler_weight_selector::views_form_submit" is not in lowerCamel format
    -------------------------------------------------------------------------------------------------------------------
    
    
    FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\contrib\weight\weight.module
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     153 | WARNING | Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements hook_foo_BAR_ID_bar() for
         |         | xyz-bar.html.twig.", "* Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates."
     192 | WARNING | Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements hook_foo_BAR_ID_bar() for
         |         | xyz-bar.html.twig.", "* Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates."
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 357ms; Memory: 10MB
    
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia zkhan.aamir

    Issue summary updated.

  • First commit to issue fork.
  • Pipeline finished with Failed
    10 months ago
    Total: 164s
    #113503
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Yashaswi18

    Hello, after checking out to the branch '3343609-7.x-phpcs-coding', found these errors remaining :

    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,js,yml weight/

    FILE: /home/yashaswi/contribs/weight/views/views_handler_weight_selector.inc
    -------------------------------------------------------------------------------------------------------------------
    FOUND 6 ERRORS AND 1 WARNING AFFECTING 5 LINES
    -------------------------------------------------------------------------------------------------------------------
    6 | ERROR | Class name must begin with a capital letter
    6 | ERROR | Class name must use UpperCamel naming without underscores
    6 | WARNING | Class name must be prefixed with the project name "Weight"
    28 | ERROR | Public method name "views_handler_weight_selector::option_definition" is not in lowerCamel format
    46 | ERROR | Public method name "views_handler_weight_selector::options_form" is not in lowerCamel format
    91 | ERROR | Public method name "views_handler_weight_selector::views_form" is not in lowerCamel format
    158 | ERROR | Public method name "views_handler_weight_selector::views_form_submit" is not in lowerCamel format
    -------------------------------------------------------------------------------------------------------------------

  • First commit to issue fork.
  • Pipeline finished with Success
    9 months ago
    Total: 134s
    #126001
  • Status changed to Needs review 9 months ago
  • Pipeline finished with Failed
    9 months ago
    Total: 133s
    #126871
  • Pipeline finished with Success
    9 months ago
    Total: 134s
    #126886
  • Pipeline finished with Failed
    9 months ago
    Total: 100s
    #126888
  • Status changed to Needs work 5 months ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines roberttabigue

    Hi @avpaderno,

    After reviewing and applied the MR!10 to the Weight module against 7.x-3.x-dev on Drupal 10, I still see 1 PHPCS warning.
    See below:

    FILE: /Users/roberttabigue/Project/DrupalOrg/drupalorgissues/web/modules/contrib/weight/views/views_handler_weight_selector.inc
    -------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------
     8 | WARNING | Class name must be prefixed with the project name "Weight"
    -------------------------------------------------------------------------------------------------------------------------------

    I ran this command on the module:
    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,css,js weight/

    I'm moving this to โ€˜Needs workโ€™ for now.

    Thank you!

  • Status changed to Needs review 5 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    GitLab CI does not report any PHP_CodeSniffer error/warning. phpcs --standard=Drupal,DrupalPractice does not applies the same PHP_CodeSniffer rules GitLab CI applies, which means it can give different errors/warnings, but that is irrelevant, since GitLab CI is used to test the project.

  • Status changed to RTBC 5 months ago
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia VladimirAus Brisbane, Australia
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany Anybody Porta Westfalica

    Here's the fix for modern Drupal: ๐Ÿ› Fix phpcs, cspell and phpunit Active could both be merged perhaps?

  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia VladimirAus Brisbane, Australia

    vladimiraus โ†’ changed the visibility of the branch 8.x-3.x to hidden.

  • Pipeline finished with Skipped
    2 months ago
    #317630
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia VladimirAus Brisbane, Australia

    Thanks, everyone! ๐Ÿง
    Committed!

  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia VladimirAus Brisbane, Australia
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024