Fix the errors/warnings reported by Php_CodeSniffer

Created on 7 July 2023, 12 months ago
Updated 10 July 2023, 12 months ago

Problem/Motivation

PHPCS comes up with the following errors:

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 automated_testing_kit

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\automated_testing_kit\automated_testing_kit.info.yml
----------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------
 6 | 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\automated_testing_kit\automated_testing_kit.module
--------------------------------------------------------------------------------------------------------------
FOUND 13 ERRORS AND 3 WARNINGS AFFECTING 10 LINES
--------------------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] Missing file doc comment
  1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
  3 | WARNING | [x] Unused use statement
 10 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 1
 11 | ERROR   | [x] Expected 2 space(s) before asterisk; 1 found
 12 | ERROR   | [x] Expected 2 space(s) before asterisk; 1 found
 13 | ERROR   | [x] Expected 2 space(s) before asterisk; 1 found
 13 | WARNING | [ ] Hook implementations should not duplicate @param documentation
 13 | ERROR   | [ ] Missing parameter comment
 13 | ERROR   | [ ] Missing parameter type
 14 | ERROR   | [x] Expected 2 space(s) before asterisk; 1 found
 15 | ERROR   | [x] Expected 2 space(s) before asterisk; 1 found
 15 | WARNING | [ ] Hook implementations should not duplicate @return documentation
 15 | ERROR   | [ ] Description for the @return value is missing
 16 | ERROR   | [x] Expected 2 space(s) before asterisk; 1 found
 28 | ERROR   | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 11 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\automated_testing_kit\automated_testing_kit.permissions.yml
-----------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------
 4 | 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\automated_testing_kit\automated_testing_kit.routing.yml
-------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------
 7 | 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\automated_testing_kit\automated_testing_kit.services.yml
--------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------
 6 | 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\automated_testing_kit\README.txt
--------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------------------
  4 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
 13 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
 47 | 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\automated_testing_kit\src\Commands\AutomatedTestingKitCommands.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AND 3 WARNINGS AFFECTING 6 LINES
------------------------------------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
  6 | WARNING | [x] Unused use statement
 24 | WARNING | [ ] Unused variable $file_system.
 24 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 25 | ERROR   | [x] Whitespace found at end of line
 37 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 6
 41 | ERROR   | [x] Expected 1 newline at end of file; 0 found
 41 | 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\automated_testing_kit\src\Controller\AutomatedTestingKitController.php
----------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------------------------------------------------------------------
  1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
 10 | ERROR | [x] There must be one blank line after the last USE statement; 2 found;
----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\automated_testing_kit\src\Form\ConfigurationForm.php
----------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
----------------------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
 57 | WARNING | [ ] Unused variable $configurationForm.
 70 | WARNING | [ ] Possible useless method overriding detected
----------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------

Time: 795ms; 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

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.
  • Issue was unassigned.
  • Status changed to Needs review 12 months ago
  • 🇮🇳India sidharth_soman Bangalore

    I've fixed all the issues except for the 'line exceeds 80 characters' in the README file (keeping it as it is for readability purposes). I've also kept the unused variables as it might prove useful in the future but I'll add another commit if they're not required.

    Please review the MR

  • First commit to issue fork.
  • Assigned to aangel
  • Status changed to Fixed 12 months ago
  • 🇺🇸United States aangel

    Thanks, Sidharth. I kept all except one recommended change (the PHPDoc block, I'd like more of those actually) and merged it.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024