Problem/Motivation
Getting following errors and warning
$ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig pagerer/
FILE: pagerer/pagerer_example/pagerer_example.routing.yml
-----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------
9 | WARNING | Open page callback found, please add a comment before the line why there is no access restriction
-----------------------------------------------------------------------------------------------------------------
FILE: pagerer/pagerer_example/src/Controller/PagererExampleController.php
-----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
-----------------------------------------------------------------------------------------------
20 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
38 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
54 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
71 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
83 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
-----------------------------------------------------------------------------------------------
FILE: pagerer/tests/modules/pagerer_test/pagerer_test.module
----------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------
18 | WARNING | Unused variable $index.
----------------------------------------------------------------------------------
FILE: pagerer/tests/src/Functional/PagererTest.php
------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------
570 | WARNING | Unused variable $match_querystring.
------------------------------------------------------------------------
FILE: pagerer/tests/src/FunctionalJavascript/CorePagerReplacePaginationAJAXTest.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------
36 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------
FILE: pagerer/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 32 WARNINGS AFFECTING 32 LINES
----------------------------------------------------------------------
38 | WARNING | Line exceeds 80 characters; contains 81 characters
51 | WARNING | Line exceeds 80 characters; contains 93 characters
57 | WARNING | Line exceeds 80 characters; contains 83 characters
58 | WARNING | Line exceeds 80 characters; contains 85 characters
256 | WARNING | Line exceeds 80 characters; contains 82 characters
265 | WARNING | Line exceeds 80 characters; contains 81 characters
281 | WARNING | Line exceeds 80 characters; contains 84 characters
286 | WARNING | Line exceeds 80 characters; contains 81 characters
313 | WARNING | Line exceeds 80 characters; contains 82 characters
320 | WARNING | Line exceeds 80 characters; contains 82 characters
328 | WARNING | Line exceeds 80 characters; contains 85 characters
331 | WARNING | Line exceeds 80 characters; contains 83 characters
340 | WARNING | Line exceeds 80 characters; contains 82 characters
344 | WARNING | Line exceeds 80 characters; contains 83 characters
351 | WARNING | Line exceeds 80 characters; contains 83 characters
354 | WARNING | Line exceeds 80 characters; contains 83 characters
361 | WARNING | Line exceeds 80 characters; contains 81 characters
363 | WARNING | Line exceeds 80 characters; contains 81 characters
365 | WARNING | Line exceeds 80 characters; contains 87 characters
368 | WARNING | Line exceeds 80 characters; contains 97 characters
374 | WARNING | Line exceeds 80 characters; contains 87 characters
379 | WARNING | Line exceeds 80 characters; contains 87 characters
382 | WARNING | Line exceeds 80 characters; contains 81 characters
384 | WARNING | Line exceeds 80 characters; contains 81 characters
391 | WARNING | Line exceeds 80 characters; contains 81 characters
394 | WARNING | Line exceeds 80 characters; contains 81 characters
403 | WARNING | Line exceeds 80 characters; contains 82 characters
405 | WARNING | Line exceeds 80 characters; contains 84 characters
432 | WARNING | Line exceeds 80 characters; contains 84 characters
435 | WARNING | Line exceeds 80 characters; contains 81 characters
444 | WARNING | Line exceeds 80 characters; contains 83 characters
463 | WARNING | Line exceeds 80 characters; contains 81 characters
----------------------------------------------------------------------
FILE: pagerer/interdiff_21-22.txt
----------------------------------------------------------------------
FOUND 0 ERRORS AND 12 WARNINGS AFFECTING 12 LINES
----------------------------------------------------------------------
25 | WARNING | Line exceeds 80 characters; contains 99 characters
33 | WARNING | Line exceeds 80 characters; contains 81 characters
58 | WARNING | Line exceeds 80 characters; contains 132 characters
66 | WARNING | Line exceeds 80 characters; contains 92 characters
69 | WARNING | Line exceeds 80 characters; contains 172 characters
84 | WARNING | Line exceeds 80 characters; contains 81 characters
88 | WARNING | Line exceeds 80 characters; contains 97 characters
112 | WARNING | Line exceeds 80 characters; contains 116 characters
120 | WARNING | Line exceeds 80 characters; contains 131 characters
145 | WARNING | Line exceeds 80 characters; contains 81 characters
164 | WARNING | Line exceeds 80 characters; contains 85 characters
175 | WARNING | Line exceeds 80 characters; contains 151 characters
----------------------------------------------------------------------
FILE: pagerer/pagerer.module
---------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
---------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
103 | ERROR | [x] Use null coalesce operator instead of ternary operator.
173 | ERROR | [x] Use null coalesce operator instead of ternary operator.
---------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------
FILE: pagerer/interdiff_19-21.txt
----------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
----------------------------------------------------------------------
43 | WARNING | Line exceeds 80 characters; contains 81 characters
56 | WARNING | Line exceeds 80 characters; contains 81 characters
198 | WARNING | Line exceeds 80 characters; contains 81 characters
225 | WARNING | Line exceeds 80 characters; contains 81 characters
234 | WARNING | Line exceeds 80 characters; contains 151 characters
----------------------------------------------------------------------
FILE: pagerer/src/Entity/PagererPreset.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
84 | ERROR | [x] list(...) is forbidden, use [...] instead.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: pagerer/src/PagererManager.php
------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------
7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Pager\PagerManager.
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------
FILE: pagerer/src/Form/PagererConfigForm.php
----------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------
10 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Pager\PagerManagerInterface.
----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------
FILE: pagerer/src/Form/PagererPresetEditForm.php
----------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------------------------------------------------------------------------
191 | ERROR | The array declaration extends to column 129 (the limit is 120). The array content should be split up over multiple lines
196 | ERROR | The array declaration extends to column 130 (the limit is 120). The array content should be split up over multiple lines
----------------------------------------------------------------------------------------------------------------------------------------
FILE: pagerer/src/Plugin/pagerer/PagererStyleBase.php
------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------
10 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactoryInterface.
------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------
FILE: pagerer/src/Plugin/pagerer/Adaptive.php
----------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------------
125 | ERROR | The array declaration extends to column 132 (the limit is 120). The array content should be split up over multiple lines
----------------------------------------------------------------------------------------------------------------------------------------
FILE: pagerer/src/Plugin/pagerer/Multipane.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
------------------------------------------------------------------------------------------------------------------------------
9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\pagerer\Entity\PagererPreset.
73 | ERROR | [x] Use null coalesce operator instead of ternary operator.
74 | ERROR | [x] Use null coalesce operator instead of ternary operator.
75 | ERROR | [x] Use null coalesce operator instead of ternary operator.
89 | ERROR | [x] Use null coalesce operator instead of ternary operator.
------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------
FILE: pagerer/src/Plugin/PagererStyleManager.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
18 | ERROR | [x] Missing function doc comment
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: pagerer/src/PagererPresetListBuilder.php
-----------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------
7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Entity\EntityHandlerInterface.
-----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------
Steps to reproduce
Run following command:
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig pagerer/
Proposed resolution
Run following command:
phpcbf --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml pagerer
and do more changes as per requirement.
Comments
Comment #2
shivam-kumar commentedFixed the above errors,some phpcs errors needs to be fixed.
Comment #3
shivam-kumar commentedUpdated patch to resolve above upcoming Issue.
Comment #4
atul_ghate commentedI will review this patch.
Comment #5
atul_ghate commentedThe patch has been reviewed and applied cleanly, but a few phpcs still remain
Comment #6
Neeraj333 commentedComment #7
Neeraj333 commentedComment #8
hardikpandya commentedComment #9
hardikpandya commentedFixed all phpcs issues.
Comment #11
akram khanFixed remaining PHPCS error
Comment #13
avpadernoComment #15
vishaljd commentedComment #16
avpadernoComment #17
urvashi_vora commentedPlease review this patch.
Thanks
Comment #19
adwivedi008 commentedRevised patch #18 and fixed remaining issues
Comment #21
nikolay shapovalov commentedThanks @adwivedi008 for you contribution,
Please double check that you remove trailing whitespaces.
I added
StringTranslationTraitin test file and removed trailing whitespaces.Comment #22
nikolay shapovalov commentedMade review of patch from #21.
Here is updated patch.
Comment #24
nikolay shapovalov commentedCreate MR 19 to use gitlab ci.
Hide all patch files.
Comment #25
nikolay shapovalov commentedUpdate Issue summary, update phpcs violations.
Comment #28
nikolay shapovalov commentedI create separate MR to test fixes for eslint, phpstan, stylelint.
https://git.drupalcode.org/issue/pagerer-3331519/-/merge_requests/2
Updated: MR is closed, future work happens in #3402666
Comment #29
mondrakeThanks for working on this. I agree, let's only do PHPCS fixes in this issue.
I just added more configuration for GitlabCI testing - phpstan.neon and phpcs.xml.dist. PHPCS is now configured to skip README.md, so I would not touch that here.
Also, I dropped all DrupalCI configration and testing.
Comment #30
nikolay shapovalov commentedThanks for the feedback and changes you made.
I created separate issue #3402666 to work on PHPStan, eslint, stylelint.
@mondrake do you want to remove changes in README.md file.
We already made some changes in this file and I think we can keep it even the file will be excluded from code style check in the future.
What do you think?
I don't see other things that needs to be done for this issue, there is no phpcs violations left. Please let me know if I miss something?
Comment #31
mondrakeThanks! I made some comments inline the MR, that need work. For README.md, OK to keep, but please let's make sure that if we make changes because of the 80 chars limit per line, each changed line gets as close as possible to 80 chars.
Comment #32
nikolay shapovalov commentedThanks for feedback.
Comment #33
nikolay shapovalov commentedI changed my mind about README.md, I think we can keep it without changes.
I updated MR, and removed changes for README.md file, and left only fix for it.
Comment #34
mondrakeVery close! Thanks for your work.
Comment #35
nikolay shapovalov commentedThanks for a review. I made suggested changes. MR is ready for review.
Comment #36
mondrakeDrupal core is slowly introducing this. See for example #1014086-368: Stampedes and cold cache performance issues with css/js aggregation.
Comment #37
mondrakeCredit.
Comment #39
mondrakeMerged. Thank you!!
Comment #40
mondrake