Fix the errors/warnings reported by Php Code_Sniffer

Created on 7 July 2023, 12 months ago

Problem/Motivation

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

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\protect_form_flood_control\protect_form_flood_control\css\admin.css
-------------------------------------------------------------------------------------------------------------------------------
FOUND 9 ERRORS AFFECTING 9 LINES
-------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
5 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
7 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
9 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
11 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
19 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
20 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
27 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
28 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
-------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\protect_form_flood_control\protect_form_flood_control\protect_form_flood_control.links.menu.yml
-----------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------------------------
6 | 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\protect_form_flood_control\protect_form_flood_control\protect_form_flood_control.module
---------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
38 | ERROR | [x] There must be exactly one blank line before the tags in a doc comment
---------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\protect_form_flood_control\protect_form_flood_control\README.txt
----------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------
66 | WARNING | Line exceeds 80 characters; contains 82 characters
----------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\protect_form_flood_control\protect_form_flood_control\src\Form\ProtectFormFloodControlSettings.php
--------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 17 ERRORS AND 2 WARNINGS AFFECTING 17 LINES
--------------------------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
14 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
142 | ERROR | [ ] The array declaration extends to column 82 (the limit is 80). The array content should be split up over multiple lines
153 | ERROR | [ ] The array declaration extends to column 82 (the limit is 80). The array content should be split up over multiple lines
170 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
224 | ERROR | [ ] Missing parameter comment
224 | ERROR | [ ] Missing parameter type
244 | ERROR | [ ] Missing parameter comment
244 | ERROR | [ ] Missing parameter type
245 | ERROR | [ ] Missing parameter comment
246 | ERROR | [ ] Missing parameter comment
248 | ERROR | [ ] Description for the @return value is missing
287 | ERROR | [ ] Missing parameter comment
288 | ERROR | [ ] Missing parameter comment
290 | ERROR | [x] Additional blank lines found at end of doc comment
312 | ERROR | [ ] Missing parameter comment
313 | ERROR | [ ] Missing parameter comment
315 | ERROR | [ ] Description for the @return value is missing
344 | ERROR | [ ] Description for the @return value is missing
--------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\protect_form_flood_control\protect_form_flood_control\src\Manager.php
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AND 2 WARNINGS AFFECTING 7 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
20 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
118 | ERROR | [x] Expected 1 blank line before function; 2 found
188 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
266 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
280 | ERROR | [ ] Public method name "Manager::displayFormID" is not in lowerCamel format
287 | ERROR | [ ] The array declaration extends to column 135 (the limit is 80). The array content should be split up over multiple lines
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\protect_form_flood_control\protect_form_flood_control\src\ManagerInterface.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AND 1 WARNING AFFECTING 7 LINES
------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
9 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
153 | ERROR | [x] Separate the @param and @return sections by a blank line.
163 | ERROR | [ ] Missing parameter type
166 | ERROR | [ ] Public method name "ManagerInterface::displayFormID" is not in lowerCamel format
269 | ERROR | [x] Expected 1 blank line after function; 0 found
270 | ERROR | [x] The closing brace for the interface must have an empty line before it
------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\protect_form_flood_control\protect_form_flood_control\tests\src\Functional\ProtectFormFloodControlFormTest.php
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
55 | ERROR | [ ] The array declaration extends to column 90 (the limit is 80). The array content should be split up over multiple lines
186 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Time: 2.54 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

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
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update 12 months ago
    Composer require failure
  • @sidharth_soman opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review 12 months ago
  • 🇮🇳India sidharth_soman Bangalore

    I've solved mostly all the issues, but there are a few remaining to do with the 'line exceeds 80 characters' error and naming conventions for the functions. Leaving those as it is for the maintainer to decide what standard suits them.

    Please review the MR

Production build 0.69.0 2024