Fix the issues reported by phpcs

Created on 3 July 2023, 12 months ago

Problem/Motivation

C:\xampp\htdocs\backendassignment\web\modules\contrib>phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig block_styles

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\block_styles\block_styles.module
------------------------------------------------------------------------------------------------------------------------
FOUND 33 ERRORS AND 3 WARNINGS AFFECTING 27 LINES
------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
12 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 5
23 | ERROR | [x] There should be no white space after an opening "("
23 | ERROR | [x] There should be no white space before a closing ")"
26 | ERROR | [x] There should be no white space after an opening "("
26 | ERROR | [x] There should be no white space before a closing ")"
27 | WARNING | [ ] Only string literals should be passed to t() where possible
28 | ERROR | [x] Whitespace found at end of line
36 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",,
| | "* Implements hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements hook_foo_BAR_ID_bar()
| | for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates."
37 | ERROR | [x] There must be no blank lines after the function comment
39 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
45 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
56 | WARNING | [ ] Unused variable $attributes.
62 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
62 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
62 | ERROR | [x] Closing brace indented incorrectly; expected 4 spaces, found 3
68 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
68 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
68 | ERROR | [x] Closing brace indented incorrectly; expected 4 spaces, found 3
71 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing
| | parentheses
90 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing
| | parentheses
101 | ERROR | [x] Whitespace found at end of line
112 | ERROR | [x] Whitespace found at end of line
117 | ERROR | [x] Missing function doc comment
121 | ERROR | [x] Missing function doc comment
126 | ERROR | [x] Expected 1 space after IF keyword; 0 found
133 | ERROR | [x] Whitespace found at end of line
137 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
137 | ERROR | [x] Array closing indentation error, expected 4 spaces but found 3
147 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
147 | ERROR | [x] Line indented incorrectly; expected at least 4 spaces, found 1
151 | ERROR | [x] Missing function doc comment
153 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
158 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
167 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 33 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------

FILE: ...cs\backendassignment\web\modules\contrib\block_styles\modules\block_styles_bootstrap\block_styles_bootstrap.module
------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
5 | ERROR | [x] Expected 1 newline at end of file; 2 found
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------

FILE: ...es\contrib\block_styles\modules\block_styles_bootstrap\templates\bootstrap_collapse\block--bootstrap--collapse.css
------------------------------------------------------------------------------------------------------------------------
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: ...es\contrib\block_styles\modules\block_styles_bootstrap\templates\bootstrap_dropdown\block--bootstrap--dropdown.css
------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
13 | ERROR | [x] Expected 1 newline at end of file; 0 found
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------

FILE: ...\modules\contrib\block_styles\modules\block_styles_bootstrap\templates\bootstrap_modal\block--bootstrap--modal.css
------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
8 | ERROR | [x] Expected 1 newline at end of file; 0 found
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------

FILE: ...es\contrib\block_styles\modules\block_styles_bootstrap\templates\bootstrap_modal\block--bootstrap--modal.html.twig
------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------
74 | ERROR | [x] Expected 1 newline at end of file; 0 found
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\block_styles\src\BlockStyleStorage.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\block_styles\src\Entity\BlockStyle.php
--------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 6 LINES
--------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
5 | ERROR | [x] There must be one blank line after the last USE statement; 2 found;
11 | ERROR | [x] Whitespace found at end of line
96 | ERROR | [x] Short array syntax must be used to define arrays
101 | ERROR | [x] Expected 1 blank line after function; 0 found
102 | ERROR | [x] The closing brace for the class must have an empty line before it
--------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\block_styles\src\Entity\BlockStyleInterface.php
-----------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
-----------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
12 | ERROR | [x] Missing function doc comment
14 | ERROR | [x] Missing function doc comment
16 | ERROR | [x] Missing function doc comment
18 | ERROR | [x] Missing function doc comment
-----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------

Time: 1.18 secs; Memory: 6MB

Steps to reproduce

Run the phpcs command on the module.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Needs review

Version

2.0

Component

Code

Created by

🇮🇳India sidharth_soman Bangalore

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @sidharth_soman
  • Status changed to Needs work 12 months ago
  • 🇮🇳India sidharth_soman Bangalore

    Working on solving these.

  • @sidharth_soman opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review 12 months ago
  • 🇮🇳India sidharth_soman Bangalore

    I have fixed all the issues except for those related to filling out documentation, which I think should be ideally done by the maintainers.
    Please review the MR above.

Production build 0.69.0 2024