Fix the issues reported by PHP_CodeSniffer

Created on 21 November 2023, over 1 year ago
Updated 27 November 2023, over 1 year ago

Problem/Motivation

There are following errors and warnings which are reported by PHP code sniffer within the module :

FILE: /opt/lampp/htdocs/develop/web/modules/contrib/responsive_views_pager/README.md
------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
------------------------------------------------------------------------------------
 11 | WARNING | Line exceeds 80 characters; contains 118 characters
 13 | WARNING | Line exceeds 80 characters; contains 117 characters
 15 | WARNING | Line exceeds 80 characters; contains 130 characters
 20 | WARNING | Line exceeds 80 characters; contains 146 characters
------------------------------------------------------------------------------------


FILE: /opt/lampp/htdocs/develop/web/modules/contrib/responsive_views_pager/src/Cache/Context/ResponsiveDeviceCacheContext.php
-----------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------
 16 | ERROR | Missing short description in doc comment
 24 | ERROR | Missing parameter comment
-----------------------------------------------------------------------------------------------------------------------------


FILE: /opt/lampp/htdocs/develop/web/modules/contrib/responsive_views_pager/src/Plugin/views/pager/Dynamic.php
----------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
----------------------------------------------------------------------------------------------------------------------------------------
 131 | ERROR | Doc comment is empty
 135 | ERROR | The array declaration extends to column 139 (the limit is 120). The array content should be split up over multiple lines
 146 | ERROR | The array declaration extends to column 221 (the limit is 120). The array content should be split up over multiple lines
----------------------------------------------------------------------------------------------------------------------------------------

Time: 69ms; Memory: 10MB

Steps to reproduce

1) Install and enable this module or Clone it from issue fork.

2) Run following command :

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

Proposed resolution

Above error/warnings need to be fixed as per the coding standard.

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇲🇼Malawi chancenyasulu

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 @chancenyasulu
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India sijumpk

    Fixed those PHPCS flags.

  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    A summary must describe what needs to be changed, and eventually why. A screenshot is not sufficient, even in the case a patch/MR is provided.
    In the case of bug reports, the steps to reproduce the bug should be provided too. In the case of coding standards issues found using an automatic tool, the report given by that tool must be quoted too, including the arguments passed to that tool, if it is a command line tool.

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India sijumpk

    There are not much details provided about the command used for getting the results in the issue description. It seems like PHP CodeSniffer is used (from the issue title) for generating it. Any way all these warnings and errors were present when I checked with phpcs using Drupal and DrupalPractice as standards. Those are all fixed (and some more) and committed to the repository. In order to test it, one can use the following command. Now its returning an empty result.

    $ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig responsive_views_pager/*

  • First commit to issue fork.
  • Hi @sijumpk,
    I have reviewed the module by cloning the issue fork and running the PHPCS command. It appears that all the previous errors and warnings reported by the code sniffer have been addressed; however, some errors still persist.

    svinfotech1@svinfotech1:/opt/lampp/htdocs/testing$ ./vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml web/modules/responsive_views_pager-3403133/
    
    FILE: .../modules/responsive_views_pager-3403133/src/Plugin/views/pager/Dynamic.php
    --------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    --------------------------------------------------------------------------------
     136 | ERROR | The array declaration extends to column 88 (the limit is 80).
         |       | The array content should be split up over multiple lines
     149 | ERROR | The array declaration extends to column 84 (the limit is 80).
         |       | The array content should be split up over multiple lines
    --------------------------------------------------------------------------------
    
    Time: 1.21 secs; Memory: 10MB
    
    

    Thank you.

  • Merge request !1Draft: Resolve #3403133 "Updates" → (Open) created by sijumpk
  • Status changed to Fixed over 1 year ago
  • 🇮🇳India sijumpk

    Updated changes and released a new version.

  • Status changed to Fixed over 1 year ago
  • Status changed to Fixed over 1 year ago
  • Status changed to Fixed over 1 year ago
Production build 0.71.5 2024