Running phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig shows the following warnings/errors, which should be fixed.
Command:
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig modules/custom/crop/
Result:
FILE: crop/tests/src/Functional/CropFunctionalTest.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 13 WARNINGS AFFECTING 14 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
10 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Tests\BrowserTestBase.
84 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
85 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
88 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
101 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
109 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
110 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
122 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
123 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
142 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
147 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
148 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
152 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
153 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------
FILE: crop/tests/src/Kernel/CropCRUDTest.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 16 WARNINGS AFFECTING 16 LINES
------------------------------------------------------------------------------------------------------------------------------------------
68 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
69 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
70 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
75 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
76 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
77 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
103 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
104 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
105 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
106 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
109 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
110 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
111 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
112 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
113 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
114 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------
FILE: crop/tests/src/Kernel/CropUnitTestBase.php
---------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------
7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\KernelTests\KernelTestBase.
---------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------
FILE: crop/tests/src/Kernel/CropEffectTest.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------
95 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------
FILE: crop/src/Entity/Crop.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------
124 | WARNING | Exceptions should not be translated
124 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------
FILE: crop/src/CropTypeListBuilder.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------------------------------
71 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
112 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
131 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------
FILE: crop/src/Form/CropTypeDeleteForm.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
46 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
60 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------
Comments
Comment #2
emartoni commentedPatch attached!
Best,
Eduardo
Comment #3
woprrr commentedThis part does stay in inline form.
And small miss for crop.setting.yml the file will have a newline at the end. By the way we can a small typo for testCropDimenssions() method.
All the rest are OK to me :) When review are OK we can flag this RTBC.
Thank you a lot for help and contribution !!!! You ROCK !
Comment #4
idebr commentedThe patch in #3 contains changes from #2830768: Automated crop integration
Comment #5
woprrr commentedNow it does be good #2830768: Automated crop integration was merged.
In all cases we need to reroll it now :D that was a long time ago ...
Comment #6
neslee canil pintoFixed Coding Standard
Comment #7
woprrr commentedHi Neslee Canil Pinto,
I'm happy to see that super fast purpose !!!! :) Thank you great :) !
small feedback :
"The image that apply image style effect `crop`."
The crop type entity linked to this image.
Small Typo here + We can describe more (in limit of 80 characters) what configuration is here.
Other small question why you delete @deprecated notices in your patch ? That important for backward compatibility and user that use 8.1.
Comment #8
neslee canil pintoComment #9
neslee canil pintoHi woprrr,
I thought its deprecated, so will remove, i reverted it
Comment #11
nikolay shapovalov commentedIS updated.
Comment #13
nikolay shapovalov commentedI create MR.
Comment #14
nikolay shapovalov commentedHide patch files.
Comment #15
nikolay shapovalov commentedComment #16
silvi.addweb commentedRe-roll the patch according to the latest code changes.
Comment #17
nayana_mvr commentedTried to apply the patch #16 on Drupal version 10.4.x and Crop API module version 8.x-2.x but getting the following error:-
So I have created a new MR for fixing the phpcs issues. Please review.
Comment #21
avpadernoMR !13 fixes all the PHP_CodeSniffer errors/warnings.
Comment #22
avpadernoActually, it seems the PHP_CodeSniffer errors/warnings have been already fixed.
Comment #23
roberttabigue commentedHi,
I am moving this to 'Needs work', please check the PHPCS issues below after applying the 'MR !14' to the CROP API module against 8.x-2.x-dev on my D10 local.
Please check.
Thank you!
Comment #25
nilesh.addweb commented@roberttabigue,
There is two MR, MR !13 for phpcs and MR !14 for gitlab pipe line,
Please test now I have merge this two MR code in MR !13.
Comment #26
nilesh.addweb commentedHi,
I have fixed the PHPStan issues, and now the PHPStan job, along with all other jobs, has passed successfully. Please review the changes.
before --> https://git.drupalcode.org/issue/crop-2960098/-/pipelines/227578
after --> https://git.drupalcode.org/issue/crop-2960098/-/pipelines/227699
Comment #27
riddhi.addweb commentedI have applied the MR !13 and it resolves all the errors and tested module functionality with the image crop widget and focal point crop.
Please check the Screenshot for the same.
Comment #29
avpadernoThis issue is only for fixing PHP_CodeSniffer reports, not all the GitLab CI reports.
Comment #30
ambot112 commentedThe Merge request !13 is great, it solves all the phpcs and phstan errors.
Comment #31
nikolay shapovalov commentedYes @avpaderno, you are right. Right now there are no issues found by CI.
I found that a lot of changes that were implement at MR #6 were merged at #3447620: Declare compatibility with Drupal 11.
CI checks code using only Drupal rules set and DrupalPractice is ignored.
My suggestion to add DrupalPractice as well, using custom phpcs.xml.dist.
I update IS using check on latest 8.x-2.x-dev.
MR #6 is ready for review.
Comment #34
nikolay shapovalov commentedComment #35
avpadernoComment #36
nikolay shapovalov commentedUsing FormattableMarkup at tests assert is bad practice, removed from all tests.
MR updated and ready for review.
Comment #37
drdam commentedOk for me
Comment #39
phenaproximaComment #40
phenaproximaAuto-merged into 8.x-2.x. Thanks everyone!