Problem/Motivation
FILE: /Users/studenttrainees/Drupal.org/drupalorg-site/docroot/modules/contrib/w3c_validator/w3c_validator.permissions.yml
--------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------
3 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------
FILE: /Users/studenttrainees/Drupal.org/drupalorg-site/docroot/modules/contrib/w3c_validator/w3c_validator.module
-----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------
12 | WARNING | Unused variable $context.
-----------------------------------------------------------------------------------------------------------------
FILE: /Users/studenttrainees/Drupal.org/drupalorg-site/docroot/modules/contrib/w3c_validator/src/W3CTokenManager.php
--------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------
103 | WARNING | User::load calls should be avoided in classes, use dependency injection instead
--------------------------------------------------------------------------------------------------------------------
FILE: /Users/studenttrainees/Drupal.org/drupalorg-site/docroot/modules/contrib/w3c_validator/src/Form/W3cValidatorSettingsForm.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
-------------------------------------------------------------------------------------------------------------------------------------------
81 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t()
| | instead
82 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t()
| | instead
84 | WARNING | [x] A comma should follow the last multiline array item. Found: )
87 | WARNING | [x] A comma should follow the last multiline array item. Found: )
-------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------
FILE: /Users/studenttrainees/Drupal.org/drupalorg-site/docroot/modules/contrib/w3c_validator/src/W3CProcessor.php
-----------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------
119 | ERROR | [x] Separate the @return and @todo sections by a blank line.
206 | ERROR | [x] Use null coalesce operator instead of ternary operator.
-----------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------
FILE: /Users/studenttrainees/Drupal.org/drupalorg-site/docroot/modules/contrib/w3c_validator/src/Controller/W3CLogController.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-------------------------------------------------------------------------------------------------------------------------------------------
275 | ERROR | unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the allowed_classes
| | option.
312 | ERROR | unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the allowed_classes
| | option.
349 | ERROR | unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the allowed_classes
| | option.
-------------------------------------------------------------------------------------------------------------------------------------------
Time: 456ms; Memory: 12MB
Steps to reproduce
Run following command: phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml /Applications/MAMP/htdocs/9.4.x/drupal/modules/contrib/w3c_validator
Proposed resolution
Needs to resolve/fixed the issues.
Remaining tasks
Comments
Comment #2
sahil.goyal commentedFixes the issue.
Comment #3
hardikpandya commentedCan not apply the patch against 8.x-1.x
Comment #7
sahil.goyal commentedthere was some issue with my setup before, so updating the patch again against 8.x-1.x
Comment #8
avpadernoComment #9
avpadernoEntity is misspelled.
It is sufficient to use
{@inheritDoc}.Comment #10
himanshu_jhaloya commentedI will work on this issue
Comment #11
himanshu_jhaloya commentedCreated a patch for the commented issue. please review
Comment #12
avpadernoOnly the first word in the description is capitalized.
There must not be empty lines between a method declaration and the documentation comment.
Comment #13
himanshu_jhaloya commentedcreate a patch to fix the above issue. please review
Comment #14
avpadernoThe patch must include all the changes, not just the ones reported in the last comment.
Comment #15
sourabhjainComment #16
sourabhjainComment #17
chaitanyadessai commentedPatch added please review.
Comment #18
paraderojether commentedI update the summary since I'm getting different phpcs issues results after running this command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig w3c_validator.
I also reviewed patch #17, applied against W3C Validator 8.x-1.x-dev, and confirmed it fixes the issues reported by phpcs.
I added screenshots for reference.
Thank You.
Comment #19
avpadernocreate()must pass three arguments to the constructor, not one.Comment #20
bharath-kondeti commentedAddressed #19 and updated the patch. Please review.
Comment #21
avpadernoThat is not how a user account is loaded from the database. The current_user service is only for the currently logged-in user account; the class implementing that service does not even have a
load()method.Comment #22
akashkumar07 commentedThe patch addresses #21. Please review.
Comment #23
avpadernoThe last patch does not fix the User::load calls should be avoided in classes, use dependency injection instead warning for the
W3CTokenManagerclass.Comment #24
imustakim commentedComment #25
imustakim commentedPatch updated.
Please review.
Comment #26
sourabhjain@imustakin could you please add interdiff file.
Comment #27
dom. commented