Fix the issues reported by phpcs

Created on 21 February 2024, 4 months ago

Problem/Motivation

There is a files need to fixed with coding standards.
Here is the command : -
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,twig modules/contrib/breadcrumbs_field/

Result : -

FILE: /home/chandansha/docker/testd10/web/modules/custom/breadcrumbs_field/breadcrumbs_field.module
---------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------
 55 | ERROR | [x] Expected 1 newline at end of file; 3 found
---------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------


FILE: /home/chandansha/docker/testd10/web/modules/custom/breadcrumbs_field/README.md
------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------
 3 | WARNING | Line exceeds 80 characters; contains 126 characters
 4 | WARNING | Line exceeds 80 characters; contains 97 characters
------------------------------------------------------------------------------------


FILE: /home/chandansha/docker/testd10/web/modules/custom/breadcrumbs_field/src/Form/SettingsForm.php
--------------------------------------------------------------------------------------------------------------------------------------
FOUND 16 ERRORS AND 1 WARNING AFFECTING 16 LINES
--------------------------------------------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] The PHP open tag must be followed by exactly one blank line
  5 | WARNING | [x] Unused use statement
  7 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactoryInterface.
 17 | ERROR   | [ ] Missing member variable doc comment
 19 | ERROR   | [x] Missing function doc comment
 20 | ERROR   | [x] Opening brace should be on the same line as the declaration
 25 | ERROR   | [x] Missing function doc comment
 26 | ERROR   | [x] Opening brace should be on the same line as the declaration
 27 | ERROR   | [x] Data types in @var tags need to be fully namespaced
 29 | ERROR   | [x] Data types in @var tags need to be fully namespaced
 31 | ERROR   | [x] Data types in @var tags need to be fully namespaced
 47 | ERROR   | [ ] Missing short description in doc comment
 48 | ERROR   | [ ] Description for the @return value is missing
 48 | ERROR   | [x] Data types in @return tags need to be fully namespaced
 51 | ERROR   | [x] Opening brace should be on the same line as the declaration
 73 | ERROR   | [x] Expected 1 space after "=>"; 0 found
 83 | ERROR   | [x] Expected 1 space after "=>"; 0 found
--------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 14 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/chandansha/docker/testd10/web/modules/custom/breadcrumbs_field/src/Field/BreadcrumbsJsonLdItemList.php
------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------
  7 | WARNING | [x] Unused use statement
 11 | WARNING | [x] Unused use statement
 12 | WARNING | [x] Unused use statement
 12 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal.
 12 | ERROR   | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------


FILE: /home/chandansha/docker/testd10/web/modules/custom/breadcrumbs_field/src/Plugin/Field/FieldType/BreadcrumbsJsonLdItem.php
-------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------------------------------------
  8 | WARNING | [x] Unused use statement
 26 | ERROR   | [x] Expected 1 newline at end of file; 2 found
-------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------


FILE: /home/chandansha/docker/testd10/web/modules/custom/breadcrumbs_field/config/install/breadcrumbs_field.settings.yml
------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------
 3 | ERROR | [x] Expected 1 newline at end of file; 5 found
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------

Time: 100ms; Memory: 10MB

Steps to reproduce

Run PHPCS on breadcrumbs_field module.

Proposed resolution

Fixed the coding standards.

Remaining tasks

Submit the patch either MR .

📌 Task
Status

Needs review

Component

Code

Created by

🇮🇳India Prem Suthar gujrat

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024