Problem/Motivation
Getting following error/warnings
FILE: /app/modules/contrib/commerce_license/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 15 WARNINGS AFFECTING 15 LINES
----------------------------------------------------------------------
25 | WARNING | Line exceeds 80 characters; contains 114 characters
49 | WARNING | Line exceeds 80 characters; contains 82 characters
50 | WARNING | Line exceeds 80 characters; contains 96 characters
52 | WARNING | Line exceeds 80 characters; contains 89 characters
53 | WARNING | Line exceeds 80 characters; contains 87 characters
55 | WARNING | Line exceeds 80 characters; contains 82 characters
56 | WARNING | Line exceeds 80 characters; contains 100 characters
69 | WARNING | Line exceeds 80 characters; contains 82 characters
70 | WARNING | Line exceeds 80 characters; contains 96 characters
72 | WARNING | Line exceeds 80 characters; contains 89 characters
73 | WARNING | Line exceeds 80 characters; contains 87 characters
75 | WARNING | Line exceeds 80 characters; contains 82 characters
76 | WARNING | Line exceeds 80 characters; contains 100 characters
82 | WARNING | Line exceeds 80 characters; contains 88 characters
88 | WARNING | Line exceeds 80 characters; contains 81 characters
----------------------------------------------------------------------
FILE: /app/modules/contrib/commerce_license/commerce_license.page.inc
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
24 | WARNING | Unused variable $commerce_license.
----------------------------------------------------------------------
FILE: /app/modules/contrib/commerce_license/src/EventSubscriber/LicenseRenewalCartEventSubscriber.php
-----------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------
123 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
-----------------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/commerce_license/src/Form/LicenseCheckoutForm.php
---------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
---------------------------------------------------------------------------------------------
47 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
48 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/commerce_license/src/LicenseAvailabilityCheckerExistingRights.php
----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------
142 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/commerce_license/src/LicenseOrderProcessorMultiples.php
----------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------
43 | WARNING | There must be no blank line following an inline comment
----------------------------------------------------------------------------------
FILE: /app/modules/contrib/commerce_license/src/Plugin/Commerce/LicenseType/Role.php
-------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------
131 | WARNING | UserRole::loadMultiple calls should be avoided in classes, use dependency injection instead
-------------------------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/commerce_license/tests/src/Kernel/CommerceAvailabilityExistingRightsTest.php
-------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------
59 | WARNING | Unused variable $order_type.
-------------------------------------------------------------------------------------------------------
Time: 4.58 secs; Memory: 14MB
Steps to reproduce
Run following command
phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/commerce_license/
Proposed resolution
Above error/warnings need to be fixed
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | coding-standards-3330264-11.patch | 9.74 KB | tomtech |
| #9 | interdiff_5-9.txt | 5.99 KB | hardikpandya |
| #9 | 3330264-9.patch | 11.02 KB | hardikpandya |
| #5 | interdiff_2-5.txt | 445 bytes | samitk |
| #5 | 3330264-5.patch | 17.01 KB | samitk |
Issue fork commerce_license-3330264
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
samitk commentedError/warnings are fixed.
Comment #5
samitk commentedFailed test cases issue fixed.
interdiff with #2
Comment #6
atul_ghate commentedI will review this patch.
Comment #7
atul_ghate commentedI have reviewed and applied the patch cleanly it resolved all phpcs issues, moving to RTBC.
var/www/html/d9test/web $ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml --encoding=utf-8 -p modules/contrib/commerce_license/ --ignore=node_modules
............................................................ 60 / 92 (65%)
................................ 92 / 92 (100%)
Time: 2.1 secs; Memory: 14MB
Comment #8
rszrama commentedIt's perfectly fine for markdown file lines to exceed 80 characters.
Comment #9
hardikpandya commentedReverted md file changes.
Comment #11
tomtech commentedThanks for these contributions.
Several of the changes include unnecessary properties being added, e.g. adding
$timeas a property on the LicenseCheckoutForm.php class is unnecessary, as its parent class, ContentEntityForm.php, already has a$timeproperty.Attached is a revised patch that should address all coding standards issues.
Comment #13
tomtech commented