Problem/Motivation
FILE: ...tml/contribution/drupal10/web/modules/contrib/commerce_promo_bar/README.md
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------
14 | WARNING | Line exceeds 80 characters; contains 85 characters
36 | WARNING | Line exceeds 80 characters; contains 84 characters
--------------------------------------------------------------------------------
FILE: .../web/modules/contrib/commerce_promo_bar/src/Plugin/Block/PromoBarBlock.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
134 | WARNING | \Drupal calls should be avoided in classes, use dependency
| | injection instead
--------------------------------------------------------------------------------
FILE: ...upal10/web/modules/contrib/commerce_promo_bar/src/Event/PromoBarEvents.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
5 | ERROR | [x] Missing class doc comment
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...rupal10/web/modules/contrib/commerce_promo_bar/commerce_promo_bar.info.yml
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
10 | ERROR | [x] Expected 1 newline at end of file; 2 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...ion/drupal10/web/modules/contrib/commerce_promo_bar/css/promo_bar.form.css
--------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------------
22 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
23 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
57 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: .../modules/contrib/commerce_promo_bar/templates/commerce-promo-bar.html.twig
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
36 | ERROR | [x] Expected 1 newline at end of file; 2 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: .../drupal10/web/modules/contrib/commerce_promo_bar/commerce_promo_bar.module
--------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------
38 | WARNING | [ ] Line exceeds 80 characters; contains 91 characters
44 | ERROR | [x] Data types in @var tags need to be fully namespaced
67 | WARNING | [x] A comma should follow the last multiline array item. Found:
| | ]
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
Time: 1.73 secs; Memory: 14MB
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_promo_bar/
Proposed resolution
Fix the issues reported for Drupal and DrupalPractice coding standards.
Remaining tasks
Review.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 3358410-7.patch | 6.97 KB | soham sengupta |
| #5 | 3358410-5.patch | 7.01 KB | soham sengupta |
| #3 | with patch.png | 162.28 KB | kenyoowen |
| #3 | without patch.png | 273.41 KB | kenyoowen |
| #2 | Fixed-all-issues.patch | 6.74 KB | urvashi_vora |
Issue fork commerce_promo_bar-3358410
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
urvashi_vora commentedComment #3
kenyoowen commentedHi urvashi_vora
I applied patch Fixed-all-issues.patch to the “Commerce Promo Bar” module and confirmed that the mentioned PHPCS issues are resolved. Please see the screenshots attached.
For your review.
Thank you.
Comment #4
avpadernoClass descriptions must not start with Implements class nor repeat the class name. Instead, they should describe the class purpose.
Since that code is edited, it should also be edited to put the method declaration of a single line, since that is how Drupal coding standards say to format method/function declarations.
The comma after the last argument is only allowed on PHP 8. If that module does not explicitly require PHP 8, that comma must be removed.
Comment #5
soham sengupta commentedHi, Updated the patch with the suggested changes.
Comment #6
avpadernoAn associative array containing the commerce promo bar information and any fields attached to the entity. was already correct; it was just necessary to reformat the text to avoid lines longer than 80 characters.
Class descriptions do not need to contain the module machine name.
The verb should be Handles, and events should be better described as promo events.
Short descriptions for constructors are Constructs a new [class name] object. where [class name] is replaced by the class name (namespace included).
Comment #7
soham sengupta commentedThanks, I have updated the patch with the suggested changes, however I was unable to include the namespace of the class in the block constructor short description, as it was exceeding 80characters and the short description should be in a single line.
Comment #8
a.aaronjake commentedHi @Soham Sengupta,
After applying the patch you provided, new errors/warnings were reported. Please see:
Kindly check
Thanks,
Jake
Comment #11
avpadernoLet's create a merge request, now that patches are no longer tested.
Comment #13
avpadernoActually, no PHP_CodeSniffer errors/warnings are reported before doing any change.