Fix the errors/warnings reported by Php_CodeSniffer

Created on 5 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 menu_position

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\menu_position\CHANGELOG.txt
---------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 10 WARNINGS AFFECTING 10 LINES
---------------------------------------------------------------------------------------
  7 | WARNING | Line exceeds 80 characters; contains 87 characters
 11 | WARNING | Line exceeds 80 characters; contains 102 characters
 17 | WARNING | Line exceeds 80 characters; contains 99 characters
 28 | WARNING | Line exceeds 80 characters; contains 87 characters
 36 | WARNING | Line exceeds 80 characters; contains 100 characters
 38 | WARNING | Line exceeds 80 characters; contains 90 characters
 40 | WARNING | Line exceeds 80 characters; contains 99 characters
 41 | WARNING | Line exceeds 80 characters; contains 135 characters
 42 | WARNING | Line exceeds 80 characters; contains 101 characters
 43 | WARNING | Line exceeds 80 characters; contains 87 characters
---------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\menu_position\menu_position.install
-----------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------
 1 | ERROR | [x] Missing file doc comment
 1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
 8 | ERROR | [x] Object operator not indented correctly; expected 4 spaces but found 13
-----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\menu_position\menu_position.module
----------------------------------------------------------------------------------------------
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\menu_position\menu_position.post_update.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\menu_position\src\Controller\MenuPositionRuleListBuilder.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\menu_position\src\Entity\MenuPositionRule.php
-----------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------
   1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
 271 | ERROR | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
-----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\menu_position\src\Form\MenuPositionRuleDeleteForm.php
-----------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-----------------------------------------------------------------------------------------------------------------
  1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
 23 | ERROR | [ ] Class property $menu_link_manager should use lowerCamel naming without underscores
 30 | ERROR | [ ] Class property $route_builder should use lowerCamel naming without underscores
-----------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\menu_position\src\Form\MenuPositionRuleForm.php
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 10 ERRORS AND 3 WARNINGS AFFECTING 11 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
  28 | ERROR   | [ ] Class property $entity_type_manager should use lowerCamel naming without underscores
  35 | ERROR   | [ ] Class property $menu_parent_form_selector should use lowerCamel naming without underscores
  42 | ERROR   | [ ] Class property $menu_link_manager should use lowerCamel naming without underscores
  49 | ERROR   | [ ] Class property $condition_plugin_manager should use lowerCamel naming without underscores
  56 | ERROR   | [ ] Class property $context_repository should use lowerCamel naming without underscores
  63 | ERROR   | [ ] Class property $route_builder should use lowerCamel naming without underscores
 249 | ERROR   | [x] list(...) is forbidden, use [...] instead.
 249 | WARNING | [ ] Unused variable $menu_name.
 249 | ERROR   | [ ] The array declaration extends to column 113 (the limit is 80). The array content should be split up over multiple lines
 290 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
 302 | WARNING | [ ] Unused variable $menu_link.
 316 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\menu_position\src\Form\MenuPositionRuleOrderForm.php
----------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 3 WARNINGS AFFECTING 6 LINES
----------------------------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
  19 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
  34 | ERROR   | [ ] Class property $menu_link_manager should use lowerCamel naming without underscores
  41 | ERROR   | [ ] Class property $route_builder should use lowerCamel naming without underscores
 110 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
 111 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\menu_position\src\Form\MenuPositionSettings.php
---------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
---------------------------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
 15 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
 23 | ERROR   | [ ] Class property $route_builder should use lowerCamel naming without underscores
---------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\menu_position\src\Menu\MenuPositionActiveTrail.php
--------------------------------------------------------------------------------------------------------------
FOUND 15 ERRORS AND 1 WARNING AFFECTING 16 LINES
--------------------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
   9 | WARNING | [x] Unused use statement
  29 | ERROR   | [x] Data types in @var tags need to be fully namespaced
  36 | ERROR   | [x] Data types in @var tags need to be fully namespaced
  43 | ERROR   | [x] Data types in @var tags need to be fully namespaced
  50 | ERROR   | [x] Data types in @var tags need to be fully namespaced
  57 | ERROR   | [x] Data types in @var tags need to be fully namespaced
  64 | ERROR   | [x] Data types in @param tags need to be fully namespaced
  66 | ERROR   | [x] Data types in @param tags need to be fully namespaced
  68 | ERROR   | [x] Data types in @param tags need to be fully namespaced
  70 | ERROR   | [x] Data types in @param tags need to be fully namespaced
  72 | ERROR   | [x] Data types in @param tags need to be fully namespaced
  74 | ERROR   | [x] Data types in @param tags need to be fully namespaced
  76 | ERROR   | [x] Data types in @param tags need to be fully namespaced
 211 | ERROR   | [x] Expected 1 blank line after function; 0 found
 212 | ERROR   | [x] The closing brace for the class must have an empty line before it
--------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 16 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\menu_position\src\MenuPositionRuleInterface.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\menu_position\src\Plugin\Derivative\MenuPositionLink.php
--------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
--------------------------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
 33 | ERROR   | [ ] Class property $config_factory should use lowerCamel naming without underscores
 68 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
 69 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
--------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\menu_position\src\Plugin\Menu\MenuPositionLink.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
--------------------------------------------------------------------------------------------------------------

Time: 3.44 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
  • @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 errors apart from those about filling out/editing documentation and variable naming conventions. Might be better to leave those out for the maintainers to change as seen fit.

    Please review the MR

Production build 0.69.0 2024