Prepare list of coding standards issues

Created on 5 June 2023, over 1 year ago

Problem/Motivation

We need to fix coding standards issues in the module.
Running cmd

vendor/bin/phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/stripe_integration/
PHP Warning:  Module "fileinfo" is already loaded in Unknown on line 0
PHP Warning:  Module "gd" is already loaded in Unknown on line 0
PHP Warning:  Module "gettext" is already loaded in Unknown on line 0

FILE: /home/gai/drupal-git/drupal/modules/stripe_integration/stripe_integration.module
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 1 WARNING AFFECTING 5 LINES
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 19 | ERROR   | [ ] String concat is not required here; use a single string instead
 21 | WARNING | [ ] Do not concatenate strings to translatable strings, they should be part of the t() argument and you should use placeholders
 22 | ERROR   | [x] Space found before semicolon; expected "'<br/><a href="/admin/config/system/stripe_integration">Click here to configure</a><br/>';" but found "'<br/><a
    |         |     href="/admin/config/system/stripe_integration">Click here to configure</a><br/>' ;"
 27 | ERROR   | [x] Expected 1 newline at end of file; 4 found
 30 | ERROR   | [ ] More than 2 empty lines are not allowed
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/gai/drupal-git/drupal/modules/stripe_integration/src/Services/StripeIntegrationService.php
--------------------------------------------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AND 1 WARNING AFFECTING 7 LINES
--------------------------------------------------------------------------------------------------------------------------------------
  66 | ERROR   | [ ] Public method name "StripeIntegrationService::get_stripe_environment" is not in lowerCamel format
  76 | ERROR   | [ ] Public method name "StripeIntegrationService::get_stripe_environment_config" is not in lowerCamel format
  86 | ERROR   | [ ] Public method name "StripeIntegrationService::get_current_stripe_environment_config" is not in lowerCamel format
 101 | ERROR   | [ ] Public method name "StripeIntegrationService::create_product_price_payment_link" is not in lowerCamel format
 115 | WARNING | [x] A comma should follow the last multiline array item. Found: TRUE
 159 | ERROR   | [ ] Public method name "StripeIntegrationService::create_checkout_session" is not in lowerCamel format
 198 | ERROR   | [ ] Public method name "StripeIntegrationService::update_config" is not in lowerCamel format
--------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/gai/drupal-git/drupal/modules/stripe_integration/src/Controller/StripeController.php
----------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 2 WARNINGS AFFECTING 5 LINES
----------------------------------------------------------------------------------------------------------------------
  18 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
  74 | ERROR   | [ ] Parameter $messenger is not described in comment
  86 | ERROR   | [x] Expected 1 space between comma and type hint "Messenger"; 2 found
  86 | ERROR   | [x] Expected one space after the comma, 2 found
 105 | WARNING | [x] There must be no blank line following an inline comment
 167 | ERROR   | [x] Whitespace found at end of line
----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------


FILE: /home/gai/drupal-git/drupal/modules/stripe_integration/src/Form/StripeIntegrationSettingsForm.php
---------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 4 WARNINGS AFFECTING 4 LINES
---------------------------------------------------------------------------------------------------------------------------
  12 | WARNING | [x] Unused use statement
  18 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
  73 | ERROR   | [x] Expected 1 blank line after function; 2 found
 102 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
 102 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
---------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------


FILE: /home/gai/drupal-git/drupal/modules/stripe_integration/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
----------------------------------------------------------------------
  5 | WARNING | Line exceeds 80 characters; contains 105 characters
 15 | WARNING | Line exceeds 80 characters; contains 98 characters
 17 | WARNING | Line exceeds 80 characters; contains 155 characters
 30 | WARNING | Line exceeds 80 characters; contains 98 characters
----------------------------------------------------------------------

Time: 75ms; Memory: 10MB

Steps to reproduce

Proposed resolution

1) Using the code sniffer, rector, or other tools prepare a list of files that need to be refactored.

2) Place the list into a comment, please describe how you checked the code (which tools you are using, and what problems you have found)

📌 Task
Status

Needs review

Component

Code

Created by

🇮🇳India Akshay kashyap

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

Comments & Activities

Production build 0.71.5 2024