Drupal Coding Standards Issues | phpcs

Created on 30 December 2022, over 2 years ago
Updated 20 February 2023, about 2 years ago

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

📌 Task
Status

Fixed

Version

2.0

Component

Code

Created by

🇮🇳India samit.310@gmail.com

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024