Fix the issue reported by phpcs

Created on 14 July 2023, over 1 year ago
Updated 30 August 2024, 3 months ago

Problem/Motivation

Getting following error/warnings:

FILE: D:\xampp\htdocs\project_10\web\modules\contrib\tiny_slider\README.md
--------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------
12 | WARNING | Line exceeds 80 characters; contains 250 characters
19 | WARNING | Line exceeds 80 characters; contains 106 characters
--------------------------------------------------------------------------

FILE: D:\xampp\htdocs\project_10\web\modules\contrib\tiny_slider\src\Plugin\Field\FieldFormatter\TinySliderFieldFormatter.php
-----------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 25 WARNINGS AFFECTING 25 LINES
-----------------------------------------------------------------------------------------------------------------------------
386 | WARNING | Unused variable $autoplayposition.
390 | WARNING | Unused variable $controlsplayposition.
399 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
400 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
401 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
402 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
403 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
404 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
405 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
406 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
407 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
408 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
409 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
410 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
411 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
412 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
413 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
414 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
415 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
416 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
419 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
423 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
427 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
431 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
476 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
-----------------------------------------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\project_10\web\modules\contrib\tiny_slider\tiny_slider.module
-----------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------
79 | WARNING | Unused variable $view.
-----------------------------------------------------------------------------------

Steps to reproduce

Run following command:

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

Proposed resolution

Above error/warnings need to be fixed

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Needs work

Version

1.1

Component

Code

Created by

🇮🇳India arti_parmar

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 @arti_parmar
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India arti_parmar

    Kindly review patch.

  • Status changed to Needs work over 1 year ago
  • 🇵🇭Philippines clarkssquared

    Hi arti_parmar

    I applied your patch and I confirmed that it fixed all the PHPCS errors/issues. However, there are whitespace errors in your patch, kindly fix all the whitespace errors in your patch and it will be all good.

    Please look at the screenshot I attached for your reference.

    Thank you

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India mrinalini9 New Delhi

    Updated patch #2 by addressing #3, please review it.

    Thanks!

  • First commit to issue fork.
  • 🇧🇪Belgium Frederikvho Belgium

    Hi,

    As I still received a few remaining PHPCS errors I created an issue fork and opened up a merge request.
    Summary: Applied the patch from comment #4 and fixed the remaining PHPCS errors.

    Please review.
    Thanks!

  • Status changed to RTBC over 1 year ago
  • 🇵🇭Philippines clarkssquared

    Hi Frederikvho

    I applied your MR !10 to the module and I confirmed that it applies cleanly and fixed all the PHPCS errors/issues.

    Please look at the screenshot I attached for your reference.

    Thank you

  • Status changed to Needs work about 1 year ago
  • 🇬🇧United Kingdom ipwa

    Merge request needs to be rebased for 1.1.x

  • First commit to issue fork.
  • Status changed to Needs review about 1 year ago
  • 🇮🇳India sakthi_dev

    Did rebase to 1.1.x and fixed the issues. Please review.

  • 🇵🇭Philippines clarkssquared

    I applied MR !10 and I confirmed that it fixes all the PHPCS issues except for

    FILE: /Users/clarksubing-subing/Projects/d9/d9-local/web/modules/contrib/tiny_slider/src/Plugin/Field/FieldFormatter/TinySliderFieldFormatter.php
    -------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------------------------
     21 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Entity\EntityTypeManagerInterface.
    -------------------------------------------------------------------------------------------------------------------------------------------------
    

    I updated the MR !10 to fix this error,
    please review.

  • First commit to issue fork.
  • 🇬🇧United Kingdom welly

    Looks good to me - I've also committed the gitlab-ci template so we can take advantage of running automated tests (mainly phpcs at this point).

  • 🇬🇧United Kingdom welly

    Also cleaned up the CSS as per the stylelint feedback from Gitlab. Obviously this will need testing to make sure it all still works/looks correct!

  • Pipeline finished with Success
    5 months ago
    Total: 214s
    #212527
  • Status changed to Needs work 5 months ago
  • 🇮🇳India chandansha

    i below command and get some error use below command.
    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig .

    FILE: /var/www/html/testd10/web/modules/cspell/tiny_slider-3374650/src/TinySliderGlobal.php
    -------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    -------------------------------------------------------------------------------------------
     108 | ERROR | [ ] Description for the @return value is missing
     111 | ERROR | [x] There should be no white space before a closing ")"
    -------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/testd10/web/modules/cspell/tiny_slider-3374650/src/Plugin/views/style/TinySlider.php
    --------------------------------------------------------------------------------------------------------
    FOUND 27 ERRORS AFFECTING 27 LINES
    --------------------------------------------------------------------------------------------------------
      44 | ERROR | [x] Expected 1 space after IF keyword; 0 found
      70 | ERROR | [x] Use null coalesce operator instead of ternary operator.
      78 | ERROR | [x] Use null coalesce operator instead of ternary operator.
      90 | ERROR | [x] Use null coalesce operator instead of ternary operator.
      98 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     110 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     123 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     136 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     157 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     174 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     188 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     201 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     214 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     226 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     239 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     251 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     263 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     271 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     279 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     287 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     295 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     303 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     311 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     320 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     328 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     337 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     366 | ERROR | [x] Missing function doc comment
    --------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 27 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/testd10/web/modules/cspell/tiny_slider-3374650/src/Plugin/Field/FieldFormatter/TinySliderFieldFormatter.php
    -------------------------------------------------------------------------------------------------------------------------------
    FOUND 4 ERRORS AND 28 WARNINGS AFFECTING 30 LINES
    -------------------------------------------------------------------------------------------------------------------------------
     107 | WARNING | [ ] Unused variable $json_config_default.
     507 | WARNING | [ ] Unused variable $autoplayposition.
     511 | WARNING | [ ] Unused variable $controlsplayposition.
     523 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     523 | ERROR   | [x] Space found before semicolon; expected "$advancedMode;" but found "$advancedMode ;"
     524 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     528 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     529 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     530 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     531 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     532 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     533 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     534 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     535 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     536 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     537 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     538 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     539 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     540 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     541 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     542 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     543 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     544 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     545 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     546 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     547 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     548 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     549 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     550 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     550 | ERROR   | [x] Space found before semicolon; expected "$advancedMode;" but found "$advancedMode ;"
     572 | ERROR   | [x] Missing function doc comment
     573 | ERROR   | [x] Opening brace should be on the same line as the declaration
    -------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/testd10/web/modules/cspell/tiny_slider-3374650/templates/tiny-slider.html.twig
    --------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------
     8 | ERROR | [x] Expected 1 newline at end of file; 0 found
    --------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/testd10/web/modules/cspell/tiny_slider-3374650/tiny_slider.module
    -------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    -------------------------------------------------------------------------------------
      10 | WARNING | [x] Unused use statement
     128 | ERROR   | [ ] Description for the @return value is missing
    -------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------
    
    Time: 340ms; Memory: 14MB
    
  • First commit to issue fork.
  • Pipeline finished with Success
    3 months ago
    Total: 166s
    #269504
Production build 0.71.5 2024