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

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

arti_parmar created an issue. See original summary.

arti_parmar’s picture

Assigned: arti_parmar » Unassigned
Status: Active » Needs review
StatusFileSize
new27.9 KB

Kindly review patch.

clarkssquared’s picture

Status: Needs review » Needs work
StatusFileSize
new72.81 KB

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

mrinalini9’s picture

Status: Needs work » Needs review
StatusFileSize
new27.89 KB
new506 bytes

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

Thanks!

Frederikvho made their first commit to this issue’s fork.

frederikvho’s picture

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!

clarkssquared’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new71.51 KB

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

ipwa’s picture

Version: 1.0.x-dev » 1.1.x-dev
Status: Reviewed & tested by the community » Needs work

Merge request needs to be rebased for 1.1.x

sakthi_dev made their first commit to this issue’s fork.

sakthi_dev’s picture

Status: Needs work » Needs review

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

clarkssquared’s picture

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.

welly made their first commit to this issue’s fork.

welly’s picture

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).

welly’s picture

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!

chandansha’s picture

Status: Needs review » Needs work
Issue tags: +Coding standards

i used 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

xiwar made their first commit to this issue’s fork.

  • ipwa committed 67ab0493 on 3374650-fix-the-issue
    Issue #3374650 by xiwar: additional phpcs fixes.
    

  • ipwa committed 3dd8e10a on 3374650-fix-the-issue
    Issue#3374650: Fix PHPCS issue after rebase.
    

  • ipwa committed 7ef730fb on 3374650-fix-the-issue authored by frederikvho
    Issue #3374650 Fixed remaining phpcs errors.
    

  • ipwa committed 1888aec8 on 3374650-fix-the-issue authored by frederikvho
    Issue #3374650 Applied patch from comment 4.