Fix the issues reported by phpcs

Created on 14 February 2023, over 1 year ago
Updated 4 March 2024, 4 months ago

Problem/Motivation

Getting following phpcs errors

FILE: ..._stripe_test/src/EventSubscriber/DecoratedOrderPaymentIntentSubscriber.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 9 | ERROR | [x] Missing class doc comment
--------------------------------------------------------------------------------

FILE: .../commerce_stripe_test/src/EventSubscriber/TransactionDataSubscriber.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 9 | ERROR | [x] Missing class doc comment
--------------------------------------------------------------------------------

FILE: .../commerce_stripe/tests/src/Kernel/PaymentIntentTest.php
--------------------------------------------------------------------------------
FOUND 5 ERRORS AND 1 WARNING AFFECTING 6 LINES
--------------------------------------------------------------------------------
 250 | ERROR   | The array declaration extends to column 133 (the limit is 80).
     |         | The array content should be split up over multiple lines
 251 | ERROR   | The array declaration extends to column 134 (the limit is 80).
     |         | The array content should be split up over multiple lines
 253 | ERROR   | The array declaration extends to column 126 (the limit is 80).
     |         | The array content should be split up over multiple lines
 254 | WARNING | Line exceeds 80 characters; contains 81 characters
 255 | ERROR   | The array declaration extends to column 110 (the limit is 80).
     |         | The array content should be split up over multiple lines
 257 | ERROR   | The array declaration extends to column 135 (the limit is 80).
     |         | The array content should be split up over multiple lines
--------------------------------------------------------------------------------

FILE: .../commerce_stripe/tests/src/Kernel/StripeIntegrationTestBase.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 8 | ERROR | [x] Missing class doc comment
--------------------------------------------------------------------------------

FILE: .../commerce_stripe/tests/src/Kernel/CreatePaymentTest.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 155 | ERROR | [x] Array closing indentation error, expected 4 spaces but found
     |       |     6
--------------------------------------------------------------------------------

FILE: .../commerce_stripe/src/PluginForm/Stripe/PaymentMethodAddForm.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AND 3 WARNINGS AFFECTING 5 LINES
--------------------------------------------------------------------------------
  83 | WARNING | t() calls should be avoided in classes, use
     |         | \Drupal\Core\StringTranslation\StringTranslationTrait and
     |         | $this->t() instead
  91 | WARNING | t() calls should be avoided in classes, use
     |         | \Drupal\Core\StringTranslation\StringTranslationTrait and
     |         | $this->t() instead
  99 | WARNING | t() calls should be avoided in classes, use
     |         | \Drupal\Core\StringTranslation\StringTranslationTrait and
     |         | $this->t() instead
 142 | ERROR   | The array declaration extends to column 97 (the limit is 80).
     |         | The array content should be split up over multiple lines
 172 | ERROR   | The array declaration extends to column 133 (the limit is 80).
     |         | The array content should be split up over multiple lines
--------------------------------------------------------------------------------

FILE: .../commerce_stripe/src/Plugin/Commerce/CheckoutPane/StripeReview.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
 162 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
     |       |     question marks, colons, or closing parentheses
 173 | ERROR | [x] Functions must not contain multiple empty lines in a row;
     |       |     found 2 empty lines
--------------------------------------------------------------------------------

FILE: .../commerce_stripe/src/Plugin/Commerce/PaymentGateway/Stripe.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
--------------------------------------------------------------------------------
  53 | WARNING | Line exceeds 80 characters; contains 91 characters
 266 | ERROR   | The array declaration extends to column 110 (the limit is 80).
     |         | The array content should be split up over multiple lines
--------------------------------------------------------------------------------

FILE: .../commerce_stripe/src/Event/TransactionDataEvent.php
--------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
 55 | ERROR | The text '@deprecated Transaction data is no longer influenced by
    |       | this event.' does not match the standard format: @deprecated in
    |       | %deprecation-version% and is removed from %removal-version%.
    |       | %extra-info%.
 55 | ERROR | Each @deprecated tag must have a @see tag immediately following
    |       | it
 69 | ERROR | The text '@deprecated Transaction data is no longer influenced by
    |       | this event.' does not match the standard format: @deprecated in
    |       | %deprecation-version% and is removed from %removal-version%.
    |       | %extra-info%.
 69 | ERROR | Each @deprecated tag must have a @see tag immediately following
    |       | it
--------------------------------------------------------------------------------

Steps to reproduce

run following command

phpcs --standard="Drupal,DrupalPractice" modules/contrib/commerce_stripe

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ“Œ Task
Status

Closed: works as designed

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia TanujJain-TJ

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

  • Issue created by @TanujJain-TJ
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia TanujJain-TJ

    Fixed above mentioned phpcs issues in this module

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • First commit to issue fork.
  • Assigned to himanshu_jhaloya
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia himanshu_jhaloya Mandsaur

    After applied the patch found some issues

    FILE: /var/www/html/contribution/web/modules/contrib/commerce_stripe-3341472/README.txt
    ---------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    ---------------------------------------------------------------------------------------
    44 | WARNING | Line exceeds 80 characters; contains 84 characters
    50 | WARNING | Line exceeds 80 characters; contains 87 characters
    ---------------------------------------------------------------------------------------

    FILE: /var/www/html/contribution/web/modules/contrib/commerce_stripe-3341472/src/Plugin/Commerce/PaymentGateway/Stripe.php
    --------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------------------
    279 | ERROR | [x] Use null coalesce operator instead of ternary operator.
    --------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------------------

    FILE: /var/www/html/contribution/web/modules/contrib/commerce_stripe-3341472/commerce_stripe.module
    -------------------------------------------------------------------------------------------------------
    FOUND 12 ERRORS AND 1 WARNING AFFECTING 4 LINES
    -------------------------------------------------------------------------------------------------------
    14 | ERROR | [x] Expected 0 spaces after opening parenthesis; 1 found
    14 | ERROR | [x] There should be no white space after an opening "("
    14 | ERROR | [x] There should be no white space before a closing ")"
    14 | ERROR | [x] Expected 0 spaces before closing parenthesis; 1 found
    17 | ERROR | [x] There should be no white space after an opening "("
    17 | ERROR | [x] There should be no white space after an opening "("
    17 | ERROR | [x] There should be no white space before a closing ")"
    17 | ERROR | [x] There should be no white space before a closing ")"
    22 | ERROR | [x] There should be no white space after an opening "("
    22 | ERROR | [x] There should be no white space after an opening "("
    22 | ERROR | [x] There should be no white space before a closing ")"
    22 | ERROR | [x] There should be no white space before a closing ")"
    25 | WARNING | [x] A comma should follow the last multiline array item. Found: 'addAddressAttributes'
    -------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 13 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------

  • Merge request !21fixed the remaining issues โ†’ (Open) created by himanshu_jhaloya
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia himanshu_jhaloya Mandsaur
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Nayana Ramakrishnan

    Verified MR!21. All the coding standard issues are fixed. But got the following warning messages related to spacing issues while applying the patch:

    21.diff:36: trailing whitespace.
     
    21.diff:47: trailing whitespace.
     
    21.diff:83: trailing whitespace.
     
    21.diff:92: trailing whitespace.
     
    21.diff:101: trailing whitespace.
     
    Checking patch 3341472-2.patch...
    Checking patch README.txt...
    Checking patch commerce_stripe.module...
    Checking patch src/Event/TransactionDataEvent.php...
    Checking patch src/Plugin/Commerce/CheckoutPane/StripeReview.php...
    Checking patch src/Plugin/Commerce/PaymentGateway/Stripe.php...
    Checking patch src/PluginForm/Stripe/PaymentMethodAddForm.php...
    Checking patch tests/modules/commerce_stripe_test/src/EventSubscriber/DecoratedOrderPaymentIntentSubscriber.php...
    Checking patch tests/modules/commerce_stripe_test/src/EventSubscriber/TransactionDataSubscriber.php...
    Checking patch tests/src/Kernel/CreatePaymentTest.php...
    Checking patch tests/src/Kernel/PaymentIntentTest.php...
    Checking patch tests/src/Kernel/StripeIntegrationTestBase.php...
    Applied patch 3341472-2.patch cleanly.
    Applied patch README.txt cleanly.
    Applied patch commerce_stripe.module cleanly.
    Applied patch src/Event/TransactionDataEvent.php cleanly.
    Applied patch src/Plugin/Commerce/CheckoutPane/StripeReview.php cleanly.
    Applied patch src/Plugin/Commerce/PaymentGateway/Stripe.php cleanly.
    Applied patch src/PluginForm/Stripe/PaymentMethodAddForm.php cleanly.
    Applied patch tests/modules/commerce_stripe_test/src/EventSubscriber/DecoratedOrderPaymentIntentSubscriber.php cleanly.
    Applied patch tests/modules/commerce_stripe_test/src/EventSubscriber/TransactionDataSubscriber.php cleanly.
    Applied patch tests/src/Kernel/CreatePaymentTest.php cleanly.
    Applied patch tests/src/Kernel/PaymentIntentTest.php cleanly.
    Applied patch tests/src/Kernel/StripeIntegrationTestBase.php cleanly.
    warning: squelched 12 whitespace errors
    warning: 17 lines add whitespace errors.
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • Hi, I verified MR!21 still found some phpcs issues.
    Attached screenshot for reference.
    Thankyou.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Preethy_ray

    pray_12 โ†’ made their first commit to this issueโ€™s fork.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Yashaswi18

    Hello, to verify, I checked out to the branch 'phpcs_fixed' and ran the command phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml commerce_stripe/, found no errors or warnings.

  • Status changed to Closed: works as designed 4 months ago
  • ๐Ÿ‡บ๐Ÿ‡ฆUkraine marchuk.vitaliy Rivne, UA

    There is nothing to fix. This has already been fixed and merged. See the latest pipelines https://git.drupalcode.org/project/commerce_stripe/-/pipelines/110553

Production build 0.69.0 2024