Fix the warnings/errors reported by PHP_CodeSniffer

Created on 10 July 2023, 12 months ago
Updated 29 April 2024, about 2 months ago

Problem/Motivation

FILE: /home/lenovo/d7to9/web/modules/contrib/commerce_abandoned_carts/commerce_abandoned_carts.module
---------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 23 ERRORS AND 8 WARNINGS AFFECTING 18 LINES
---------------------------------------------------------------------------------------------------------------------------------------------------
  79 | WARNING | [ ] Line exceeds 80 characters; contains 98 characters
  80 | WARNING | [ ] Line exceeds 80 characters; contains 97 characters
  81 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  88 | ERROR   | [x] Expected 1 space before "="; 0 found
  88 | ERROR   | [x] Expected 1 space after "="; 0 found
  91 | WARNING | [ ] Line exceeds 80 characters; contains 110 characters
  91 | WARNING | [x] There must be no blank line following an inline comment
  91 | WARNING | [ ] There must be no blank line following an inline comment
  91 | ERROR   | [x] No space found before comment text; expected "// If we'll be sending emails, set up the static elements, using local
     |         |     variables to avoid repeated calls..." but found "//If we'll be sending emails, set up the static elements, using local
     |         |     variables to avoid repeated calls..."
  99 | ERROR   | [x] Expected newline after closing brace
  99 | ERROR   | [x] Expected 1 space after ELSE keyword; 0 found
 100 | ERROR   | [x] Comments may not appear after statements
 100 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 104 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 104 | ERROR   | [x] Closing brace indented incorrectly; expected 4 spaces, found 6
 104 | ERROR   | [x] Expected newline after closing brace
 105 | ERROR   | [x] Comments may not appear after statements
 105 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 106 | ERROR   | [x] Closing brace indented incorrectly; expected 6 spaces, found 4
 118 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
 119 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
 129 | ERROR   | [x] Expected newline after closing brace
 129 | ERROR   | [x] Expected 1 space after ELSE keyword; 0 found
 138 | ERROR   | [x] Expected newline after closing brace
 138 | ERROR   | [x] Expected 1 space after ELSE keyword; 0 found
 156 | WARNING | [x] A comma should follow the last multiline array item. Found: 'commerce_abandoned_carts'
 156 | WARNING | [ ] Line exceeds 80 characters; contains 105 characters
 156 | ERROR   | [x] Comments may not appear after statements
 166 | ERROR   | [x] Concat operator must be surrounded by a single space
 176 | WARNING | [ ] Unused variable $nid.
 177 | ERROR   | [x] Object operator not indented correctly; expected 10 spaces but found 12
---------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 25 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/commerce_abandoned_carts/tests/src/Functional/MailTest.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------
 230 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------

Time: 174ms; Memory: 12MB

Steps to reproduce

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

Proposed resolution

Remaining tasks

FILE: /home/lenovo/d7to9/web/modules/contrib/commerce_abandoned_carts/commerce_abandoned_carts.module
-----------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
-----------------------------------------------------------------------------------------------------
  79 | WARNING | Line exceeds 80 characters; contains 98 characters
  80 | WARNING | Line exceeds 80 characters; contains 97 characters
  91 | WARNING | Line exceeds 80 characters; contains 111 characters
 182 | WARNING | Unused variable $nid.
-----------------------------------------------------------------------------------------------------

Time: 176ms; Memory: 12MB

User interface changes

API changes

Data model changes

📌 Task
Status

Closed: won't fix

Version

2.0

Component

Code

Created by

🇮🇳India roshni27

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 @roshni27
  • Issue was unassigned.
  • Status changed to Needs review 12 months ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update 12 months ago
    19 pass
  • 🇮🇳India roshni27

    Some issues which are better know to maintainer are pending, for reading purpose character limits issues remain and all remaining issues solve by me. Please review the MR.

  • Status changed to Needs work 4 months ago
  • 🇮🇳India Ashutosh Ahirwal India

    Hi, Provided patch in #2 get applied cleanly but still found some issue.
    Moving to need work.

    Used command:- ./vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,css,js,yml web/modules/custom/commerce_abandoned_carts

    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/commerce_abandoned_carts/commerce_abandoned_carts.module
    ---------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
    ---------------------------------------------------------------------------------------------------------------------------------
    79 | WARNING | Line exceeds 80 characters; contains 98 characters
    80 | WARNING | Line exceeds 80 characters; contains 97 characters
    91 | WARNING | Line exceeds 80 characters; contains 111 characters
    182 | WARNING | Unused variable $nid.
    ---------------------------------------------------------------------------------------------------------------------------------

    Time: 461ms; Memory: 12MB

  • Status changed to Closed: won't fix about 2 months ago
  • 🇳🇱Netherlands MegaChriz

    The latest code in ✨ Use queue for sending emails Needs review has all coding standards fixed. I think it would be a waste of energy to try to fix it also for 2.0.x.

Production build 0.69.0 2024