Fix the issues reported by phpcs

Created on 10 July 2023, over 1 year ago
Updated 24 July 2024, 5 months ago

Problem/Motivation

Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules/contrib
$ phpcs --standard=Drupal,DrupalPractice --extensions=php,inc,module,install,info,test,profile,theme syncommerce/

FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\contrib\syncommerce\src\Controller\SyncommerceController.php
---------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 8 WARNINGS AFFECTING 11 LINES
---------------------------------------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
   6 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Serialization\Json.
  48 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
  62 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 137 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 139 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 153 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 183 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 188 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 207 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 227 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------


FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\contrib\syncommerce\src\Form\ProductsEditForm.php
--------------------------------------------------------------------------------------------------------------------------------------------
FOUND 16 ERRORS AND 10 WARNINGS AFFECTING 24 LINES
--------------------------------------------------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
  10 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
  39 | ERROR   | [ ] The array declaration extends to column 84 (the limit is 80). The array content should be split up over multiple lines
  50 | WARNING | [ ] The use of function dsm() is discouraged
 104 | ERROR   | [ ] Comment indentation error, expected only 1 spaces
 107 | ERROR   | [ ] Comment indentation error, expected only 3 spaces
 109 | ERROR   | [ ] Comment indentation error, expected only 5 spaces
 114 | ERROR   | [ ] Comment indentation error, expected only 5 spaces
 125 | WARNING | [ ] Line exceeds 80 characters; contains 90 characters
 128 | WARNING | [ ] Line exceeds 80 characters; contains 95 characters
 134 | WARNING | [ ] Line exceeds 80 characters; contains 87 characters
 137 | ERROR   | [ ] Comment indentation error, expected only 5 spaces
 142 | ERROR   | [ ] Comment indentation error, expected only 5 spaces
 144 | ERROR   | [ ] Comment indentation error, expected only 7 spaces
 148 | ERROR   | [ ] Comment indentation error, expected only 9 spaces
 155 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 156 | WARNING | [ ] Unused variable $variations.
 159 | ERROR   | [ ] Comment indentation error, expected only 1 spaces
 160 | ERROR   | [ ] Comment indentation error, expected only 3 spaces
 163 | ERROR   | [ ] Comment indentation error, expected only 5 spaces
 166 | WARNING | [x] There must be no blank line following an inline comment
 166 | WARNING | [ ] There must be no blank line following an inline comment
 166 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 180 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 200 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 205 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
--------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------------


FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\contrib\syncommerce\src\Hook\Theme.php
-----------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
-----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------


FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\contrib\syncommerce\syncommerce.module
-----------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
-----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------

Time: 496ms; Memory: 10MB

Steps to reproduce

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,inc,module,install,info,test,profile,theme syncommerce/

Remaining tasks

Patch review

๐Ÿ“Œ Task
Status

RTBC

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

Merge Requests

Comments & Activities

  • Issue created by @urvashi_vora
  • Status changed to Needs work 12 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia ashutosh ahirwal India

    Provided patch get applied cleanly but there are so many remaining issue found by PHPCS command

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

    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/syncommerce/assets/js/index.js
    -------------------------------------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 3 LINES
    -------------------------------------------------------------------------------------------------------
    9 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
    47 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
    58 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
    -------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------

    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/syncommerce/assets/js/product_old.js
    -------------------------------------------------------------------------------------------------------------
    FOUND 4 ERRORS AFFECTING 4 LINES
    -------------------------------------------------------------------------------------------------------------
    12 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
    19 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
    43 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
    138 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
    -------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------

    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/syncommerce/assets/js/index_old.js
    -----------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------
    42 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
    -----------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------

    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/syncommerce/assets/js/product.js
    ---------------------------------------------------------------------------------------------------------
    FOUND 5 ERRORS AFFECTING 5 LINES
    ---------------------------------------------------------------------------------------------------------
    1 | ERROR | [x] Additional whitespace found at start of file
    26 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
    33 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
    56 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
    130 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
    ---------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------

    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/syncommerce/assets/gulpfile.js
    -------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------
    13 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
    -------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------

    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/syncommerce/src/Form/ProductsEditForm.php
    ------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    ------------------------------------------------------------------------------------------------------------------
    185 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    205 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    ------------------------------------------------------------------------------------------------------------------

    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/syncommerce/src/Controller/SyncommerceController.php
    ---------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 8 WARNINGS AFFECTING 9 LINES
    ---------------------------------------------------------------------------------------------------------------------------------
    6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Serialization\Json.
    48 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
    62 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
    137 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
    139 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
    153 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
    183 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
    207 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
    227 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
    ---------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------

    Time: 431ms; Memory: 18MB

  • First commit to issue fork.
  • Status changed to Needs review 11 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia viren18febS

    Hi , I have fixed the issues and added a patch for this , please review

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia pray_12

    Hi,
    I have applied the patch #4.
    The patch is successfully applied without any errors.

  • Status changed to Needs work 11 months ago
  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    Please don't run phpcs check on .js, .css files.

    To check linting on .js please use eslint โ†’ .
    To check .css please use stylelint โ†’ .

    Please exclude changes made to these files.
    You can create separate issue with these changes.

  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru
  • Assigned to nitin_lama
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama India
  • Merge request !1Resolve #3373470 "Fix the issues" โ†’ (Open) created by nitin_lama
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama India

    MR created for the changes. Please review.

  • Issue was unassigned.
  • Status changed to Needs review 11 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama India
  • Status changed to Needs work 11 months ago
  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    Thanks for suggested changes.
    Please check my comments, I left in the MR.

    Please update IS, update command (check comment #6), update phpcs report on latest 8.x-1.x branch.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia zkhan.aamir

    Hi,

    As per comment #6 I have updated issue summary please check

  • Arijit Acharya โ†’ made their first commit to this issueโ€™s fork.

  • Status changed to Needs review 7 months ago
  • Hello @nikolay-shapovalov I have resolved the comments that you have mentioned in the MR. Please review.

  • Status changed to RTBC 5 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Tirupati_Singh

    Hi, I can confirm that provided MR!1 resolves the phpcs issues successfully. Getting no phpcs errors after applying this MR. RTBC+1

Production build 0.71.5 2024