Fix the issues reported by phpcs

Created on 9 July 2024, 5 months ago
Updated 6 September 2024, 3 months ago

Problem/Motivation

command -:
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig web/modules/contrib/authorized_payment-3460171/

FILE: /var/www/html/d10/web/modules/contrib/authorized_payment/webform_authorize_net_payment.module
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 8 ERRORS AND 9 WARNINGS AFFECTING 14 LINES
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   3 | ERROR   | Missing short description in doc comment
  14 | ERROR   | Missing short description in doc comment
  23 | ERROR   | Doc comment short description must end with a full stop
  23 | ERROR   | Doc comment short description must be on a single line, further text should be a separate paragraph
  69 | WARNING | #description values usually have to run through t() for translation
  79 | WARNING | #description values usually have to run through t() for translation
  89 | WARNING | #description values usually have to run through t() for translation
  99 | WARNING | #description values usually have to run through t() for translation
 109 | WARNING | #description values usually have to run through t() for translation
 120 | WARNING | #description values usually have to run through t() for translation
 136 | WARNING | Line exceeds 80 characters; contains 107 characters
 137 | WARNING | Line exceeds 80 characters; contains 107 characters
 137 | ERROR   | Doc comment short description must be on a single line, further text should be a separate paragraph
 139 | ERROR   | Invalid function name, expected is_payment_field_enabled but found isPaymentFieldEnabled
 139 | ERROR   | All functions defined in a module file must be prefixed with the module's name, found "isPaymentFieldEnabled" but expected "webform_authorize_net_payment_isPaymentFieldEnabled"
 142 | WARNING | Line exceeds 80 characters; contains 83 characters
 172 | ERROR   | Doc comment short description must be on a single line, further text should be a separate paragraph
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/d10/web/modules/contrib/authorized_payment/src/Controller/AuthorizeNetWebformPaymentController.php
----------------------------------------------------------------------------------------------------------------------
FOUND 17 ERRORS AND 5 WARNINGS AFFECTING 22 LINES
----------------------------------------------------------------------------------------------------------------------
  18 | ERROR   | Doc comment is empty
  23 | ERROR   | Doc comment is empty
  30 | ERROR   | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
  35 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  36 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  38 | ERROR   | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
  43 | ERROR   | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
  51 | ERROR   | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
  57 | ERROR   | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
  64 | ERROR   | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
  73 | ERROR   | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
  81 | ERROR   | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
  88 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  89 | ERROR   | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
  94 | ERROR   | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
 100 | ERROR   | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
 119 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 124 | ERROR   | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
 129 | ERROR   | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
 133 | ERROR   | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
 136 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 151 | ERROR   | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
----------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/d10/web/modules/contrib/authorized_payment/src/Form/AuthorizationAuthenticationForm.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 9 WARNINGS AFFECTING 7 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
 31 | WARNING | Unused variable $config.
 35 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 36 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 39 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 39 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 44 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 45 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 47 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 47 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
-----------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/d10/web/modules/contrib/authorized_payment/webform_authorize_net_payment.info.yml
-------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------
 1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
 1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
 1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
-------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/d10/web/modules/contrib/authorized_payment/README.txt
-------------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
-------------------------------------------------------------------------
 12 | WARNING | Line exceeds 80 characters; contains 108 characters
 15 | WARNING | Line exceeds 80 characters; contains 168 characters
 24 | WARNING | Line exceeds 80 characters; contains 97 characters
 33 | WARNING | Line exceeds 80 characters; contains 107 characters
 39 | WARNING | Line exceeds 80 characters; contains 86 characters
-------------------------------------------------------------------------

Time: 323ms; Memory: 12MB


Steps to reproduce

Run PHPCS on Config Pages module.

Proposed resolution

Fixed the coding standards.

Remaining tasks

Submit the patch either MR.

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India hetal.solanki

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024