Fix the issues reported by phpcs

Created on 28 April 2023, about 1 year ago
Updated 4 May 2023, about 1 year ago

Problem/Motivation

FILE: ...ommerce_instamojo/src/Plugin/Commerce/PaymentGateway/InstamojoCheckout.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
9 | WARNING | [x] Unused use statement
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...b/commerce_instamojo/src/PluginForm/OffsiteRedirect/PaymentOffsiteForm.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
--------------------------------------------------------------------------------
20 | WARNING | The class short comment should describe what the class does and
| | not simply repeat the class name
92 | ERROR | The array declaration extends to column 131 (the limit is 80).
| | The array content should be split up over multiple lines
--------------------------------------------------------------------------------

FILE: ...al9/web/modules/contrib/commerce_instamojo/commerce_instamojo.services.yml
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
10 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 538ms; Memory: 10MB

Steps to reproduce

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig commerce_instamojo/

Proposed resolution

Fix all the issues reported for Drupal and DrupalPractice coding standards.

Remaining tasks

Patch review.

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India urvashi_vora Madhya Pradesh, India

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

Comments & Activities

  • Issue created by @urvashi_vora
  • Status changed to Needs work about 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
     /**
    - * Class PaymentOffsiteForm.
    + * Implements Class PaymentOffsiteForm.
      *

    The short description for a class does not start with Implements nor doe it repeat the class name. (Also, saying that a class implements itself does not make sense.)

    -          "redirect_url" => Url::FromRoute('commerce_payment.checkout.return', ['commerce_order' => $order_id, 'step' => 'payment'], ['absolute' => TRUE])->toString(),
    +          "redirect_url" => Url::FromRoute('commerce_payment.checkout.return',
    +                            ['commerce_order' => $order_id, 'step' => 'payment'],
    +                            ['absolute' => TRUE])->toString(),

    Drupal coding standards say that lines are allowed to be longer than 80 character, if they are more readable. The changed code is not more readable and it is wrongly indented.

  • Status changed to Needs review about 1 year ago
  • 🇮🇳India Soham Sengupta

    Hi, I have updated the patch with the changes

  • Status changed to Needs work about 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
     /**
    - * Class PaymentOffsiteForm.
    + * Provides payment off site form.

    Actually, it is the off-site payment form, which means the full description is Provides the off-site payment form.

  • Status changed to Needs review about 1 year ago
  • 🇮🇳India Soham Sengupta

    Thanks, I have updated the description as per your suggestion.

  • Status changed to RTBC about 1 year ago
  • 🇮🇳India Mahima_Mathur23

    Verified the patch.
    The changes raised by @apaderno have been incorporated and there are no more Phpcs errors.

    Moving to RTBC.

  • Assigned to i-trokhanenko
  • Status changed to Downport about 1 year ago
  • 🇺🇦Ukraine i-trokhanenko Lutsk 🇺🇦
  • Issue was unassigned.
  • Status changed to Fixed about 1 year ago
  • 🇺🇦Ukraine i-trokhanenko Lutsk 🇺🇦
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024