Fix the errors/warnings reported by Php_CodeSniffer

Created on 6 July 2023, over 1 year ago
Updated 7 July 2023, over 1 year ago

Problem/Motivation

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\uikit_image_formatter\README.md
-------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------
 26 | WARNING | Line exceeds 80 characters; contains 126 characters
 29 | WARNING | Line exceeds 80 characters; contains 82 characters
-------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\uikit_image_formatter\src\Plugin\Field\FieldFormatter\UikitLightbox.php
-----------------------------------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AND 3 WARNINGS AFFECTING 7 LINES
-----------------------------------------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
   6 | WARNING | [x] Unused use statement
 127 | WARNING | [ ] Only string literals should be passed to t() where possible
 131 | WARNING | [ ] #options values usually have to run through t() for translation
 231 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 232 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 235 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 235 | ERROR   | [x] Comments may not appear after statements
-----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\uikit_image_formatter\src\Plugin\Field\FieldFormatter\UikitSlider.php
---------------------------------------------------------------------------------------------------------------------------------
FOUND 33 ERRORS AND 5 WARNINGS AFFECTING 37 LINES
---------------------------------------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
   6 | WARNING | [x] Unused use statement
 121 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 5
 122 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 123 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 124 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 125 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 126 | ERROR   | [x] Array indentation error, expected 7 spaces but found 8
 131 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
 141 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 142 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 143 | ERROR   | [x] Array closing indentation error, expected 5 spaces but found 4
 144 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 5
 145 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 146 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 147 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 148 | ERROR   | [x] Array indentation error, expected 7 spaces but found 8
 164 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 165 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 166 | ERROR   | [x] Array closing indentation error, expected 5 spaces but found 4
 167 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 5
 168 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 169 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 170 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 171 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 172 | ERROR   | [x] Array indentation error, expected 7 spaces but found 8
 177 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 178 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 179 | ERROR   | [x] Array closing indentation error, expected 5 spaces but found 4
 290 | WARNING | [ ] Only string literals should be passed to t() where possible
 294 | WARNING | [ ] #options values usually have to run through t() for translation
 363 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
 365 | ERROR   | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
 477 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 492 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 493 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 496 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 496 | ERROR   | [x] Comments may not appear after statements
---------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 34 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\uikit_image_formatter\src\Plugin\Field\FieldFormatter\UikitSlideshow.php
------------------------------------------------------------------------------------------------------------------------------------
FOUND 33 ERRORS AND 3 WARNINGS AFFECTING 35 LINES
------------------------------------------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
   6 | WARNING | [x] Unused use statement
 113 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 5
 114 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 115 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 116 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 117 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 118 | ERROR   | [x] Array indentation error, expected 7 spaces but found 8
 123 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
 133 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 134 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 135 | ERROR   | [x] Array closing indentation error, expected 5 spaces but found 4
 136 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 5
 137 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 138 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 139 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 140 | ERROR   | [x] Array indentation error, expected 7 spaces but found 8
 156 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 157 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 158 | ERROR   | [x] Array closing indentation error, expected 5 spaces but found 4
 159 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 5
 160 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 161 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 162 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 163 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 164 | ERROR   | [x] Array indentation error, expected 7 spaces but found 8
 169 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 170 | ERROR   | [x] Array indentation error, expected 7 spaces but found 6
 171 | ERROR   | [x] Array closing indentation error, expected 5 spaces but found 4
 320 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
 439 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 450 | ERROR   | [x] Opening brace must be the last content on the line
 454 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 455 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 458 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 458 | ERROR   | [x] Comments may not appear after statements
------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 34 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\uikit_image_formatter\templates\field--uikit-slider.html.twig
-------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------
 168 | ERROR | [x] Expected 1 newline at end of file; 2 found
-------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\uikit_image_formatter\templates\uikit-slideshow.html.twig
---------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------
 28 | ERROR | [x] Expected 1 newline at end of file; 3 found
---------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\uikit_image_formatter\tests\src\Functional\LoadTest.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:\xampp\htdocs\backendassignment\web\modules\contrib\uikit_image_formatter\uikit_image_formatter.module
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 10 ERRORS AND 1 WARNING AFFECTING 10 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
  91 | WARNING | [ ] Unused variable $size.
  99 | ERROR   | [x] Concat operator must be surrounded by a single space
  99 | ERROR   | [x] Concat operator must be surrounded by a single space
 100 | ERROR   | [ ] The array declaration extends to column 145 (the limit is 80). The array content should be split up over multiple lines
 101 | ERROR   | [ ] The array declaration extends to column 137 (the limit is 80). The array content should be split up over multiple lines
 102 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 104 | ERROR   | [x] Expected 1 space before ":"; 0 found
 116 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 117 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 119 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\uikit_image_formatter\uikit_image_formatter.theme.inc
-------------------------------------------------------------------------------------------------------------------------------
FOUND 15 ERRORS AND 1 WARNING AFFECTING 12 LINES
-------------------------------------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
  92 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
  93 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  97 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
  98 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 115 | ERROR   | [x] Expected 1 space between "'class'" and double arrow; 0 found
 115 | ERROR   | [x] Expected 1 space between double arrow and "'uk-cover'"; 0 found
 115 | ERROR   | [x] Expected 1 space before "=>"; 0 found
 115 | ERROR   | [x] Expected 1 space after "=>"; 0 found
 130 | WARNING | [ ] Line exceeds 80 characters; contains 84 characters
 130 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 131 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 155 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 156 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 217 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 218 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
-------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 15 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------

Time: 3.68 secs; Memory: 8MB

Steps to reproduce

Run the phpcs command on the module.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India sidharth_soman Bangalore

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 @sidharth_soman
  • @sidharth_soman opened merge request.
  • Status changed to Needs review over 1 year ago
  • Issue was unassigned.
  • 🇵🇭Philippines roberttabigue

    Hi,

    I reviewed the changes and applied the latest MR to the UIkit Image Formatter against 8.x-1.x-dev.

    I ran the command below on the module:

    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig uikit_image_formatter/

    Confirmed it resolves some of the PHPCS errors but I'm still seeing ones:

    FILE: /Users/roberttabigue/Projects/drupalorgissues/docroot/modules/contrib/uikit_image_formatter/uikit_image_formatter.module
    ------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------
     91 | WARNING | Unused variable $size.
    ------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/roberttabigue/Projects/drupalorgissues/docroot/modules/contrib/uikit_image_formatter/README.md
    -----------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    -----------------------------------------------------------------------------------------------------------
     26 | WARNING | Line exceeds 80 characters; contains 126 characters
     29 | WARNING | Line exceeds 80 characters; contains 82 characters
    -----------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/roberttabigue/Projects/drupalorgissues/docroot/modules/contrib/uikit_image_formatter/uikit_image_formatter.theme.inc
    ---------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    ---------------------------------------------------------------------------------------------------------------------------------
     130 | WARNING | Line exceeds 80 characters; contains 85 characters
     217 | WARNING | Line exceeds 80 characters; contains 81 characters
    ---------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/roberttabigue/Projects/drupalorgissues/docroot/modules/contrib/uikit_image_formatter/src/Plugin/Field/FieldFormatter/UikitSlideshow.php
    ----------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    ----------------------------------------------------------------------------------------------------------------------------------------------------
     122 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     319 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
    ----------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/roberttabigue/Projects/drupalorgissues/docroot/modules/contrib/uikit_image_formatter/src/Plugin/Field/FieldFormatter/UikitSlider.php
    -------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    -------------------------------------------------------------------------------------------------------------------------------------------------
     130 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
     289 | WARNING | Only string literals should be passed to t() where possible
     362 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
    -------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/roberttabigue/Projects/drupalorgissues/docroot/modules/contrib/uikit_image_formatter/src/Plugin/Field/FieldFormatter/UikitLightbox.php
    ---------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------------------------
     126 | WARNING | Only string literals should be passed to t() where possible
    ---------------------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 495ms; Memory: 14MB

    I've created a new patch to resolve the PHPCS errors above.

    Please review the attached Patch file.

    I'm moving this now to Needs review.

    Thank you.

  • First commit to issue fork.
    • Mitsuko committed 8449b0fb on 8.x-1.x
      Revert "Issue #3372831 by sidharth_soman, roberttabigue: Fix the errors/...
  • Status changed to Fixed over 1 year ago
  • 🇫🇷France mitsuko

    Thank you both for the cleanup...

  • Status changed to Fixed over 1 year ago
Production build 0.71.5 2024