Problem/Motivation
Running phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml shows the following errors/warnings which should be fixed.
FILE: web/modules/contrib/taxonomy_protect/taxonomy_protect.module
-------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
-------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------
FILE: web/modules/contrib/taxonomy_protect/taxonomy_protect.install
--------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
11 | ERROR | [x] Short array syntax must be used to define arrays
--------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------
FILE: web/modules/contrib/taxonomy_protect/src/Form/TaxonomyProtectAdminSettingsForm.php
-----------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 2 WARNINGS AFFECTING 5 LINES
-----------------------------------------------------------------------------------------------------------------------
3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
14 | ERROR | [x] Missing class doc comment
30 | ERROR | [x] Missing function doc comment
31 | WARNING | [ ] Vocabulary::loadMultiple calls should be avoided in classes, use dependency injection instead
44 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
-----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | Screenshot from 2024-07-10 13-37-08.png | 159.25 KB | riddhi.addweb |
Issue fork taxonomy_protect-3426884
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
Comment #2
andrii momotov commentedComment #4
andrii momotov commentedFixed the errors/warnings reported by PHP_CodeSniffer.
Please review. Thanks!
Comment #5
clarkssquared commentedHi
I applied MR !3 but there are still many PHPCS issues that needs to be resolved.
Comment #6
andrii momotov commentedHi @clarkssquared
You are doing something wrong. I've checked several times and it doesn't show any more warnings or errors.
For example, in your message, the first error says:
Please look at my MR:
https://git.drupalcode.org/project/taxonomy_protect/-/merge_requests/3/d...
So you'll see, I added a doc comment to the taxonomy_protect.module file.
Thanks!
Comment #7
jasjeet kaur brar commentedHiiee Andrii, These issues are already been taken care of in another ticket by me which was added by you for GitLab CI.
Can you please confirm from that ticket? And Thanks.
Comment #8
jasjeet kaur brar commentedComment #9
riddhi.addweb commentedI tried to apply the patch [MR3], but it failed when applied. Attaching a screenshot for the same.
Comment #10
riddhi.addweb commentedComment #12
jrb