Fix the issues reported by phpcs

Created on 3 July 2024, 5 months ago
Updated 2 August 2024, 4 months ago

Problem/Motivation

command -:
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig web/modules/contrib/field_group/

FILE: /var/www/html/d10/web/modules/contrib/field_group/field_group.info.yml
-------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------
1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
-------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/field_group/templates/field-group-accordion-item.html.twig
------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------
39 | ERROR | [x] Expected 1 newline at end of file; 0 found
------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/field_group/includes/field_ui.inc
-----------------------------------------------------------------------------
FOUND 8 ERRORS AFFECTING 6 LINES
-----------------------------------------------------------------------------
143 | ERROR | [x] Use null coalesce operator instead of ternary operator.
149 | ERROR | [x] Use null coalesce operator instead of ternary operator.
149 | ERROR | [x] Use null coalesce operator instead of ternary operator.
159 | ERROR | [x] Use null coalesce operator instead of ternary operator.
159 | ERROR | [x] Use null coalesce operator instead of ternary operator.
201 | ERROR | [x] Use null coalesce operator instead of ternary operator.
492 | ERROR | [x] Use null coalesce operator instead of ternary operator.
607 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
-----------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/field_group/src/FormatterHelper.php
-------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------
5 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
-------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/field_group/src/Plugin/field_group/FieldGroupFormatter/AccordionItem.php
--------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------
61 | WARNING | Unused variable $key.
--------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/field_group/src/Plugin/field_group/FieldGroupFormatter/HtmlElement.php
-----------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Utility\Html.
-----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/field_group/src/Plugin/Derivative/FieldGroupLocalAction.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------
10 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Plugin\Derivative\DeriverBase.
-----------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/field_group/src/Routing/RouteSubscriber.php
---------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------------
40 | WARNING | Unused variable $defaults.
---------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/field_group/src/Routing/FieldGroupConverter.php
--------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\ParamConverter\ParamConverterInterface.
--------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/field_group/src/Element/HorizontalTabs.php
--------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------
133 | ERROR | [x] Use null coalesce operator instead of ternary operator.
--------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/field_group/src/Form/FieldGroupAddForm.php
----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------
291 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/field_group/src/FieldGroupFormatterPluginManager.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Extension\ModuleHandlerInterface.
42 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
-----------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/field_group/field_group.module
-----------------------------------------------------------------------------
FOUND 1 ERROR AND 5 WARNINGS AFFECTING 5 LINES
-----------------------------------------------------------------------------
74 | WARNING | [ ] Unused variable $route_name.
294 | ERROR | [x] Use null coalesce operator instead of ternary operator.
595 | WARNING | [ ] Unused variable $element.
595 | WARNING | [ ] Unused variable $element.
598 | WARNING | [ ] Unused variable $element.
602 | WARNING | [ ] Unused variable $element.
-----------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/field_group/contrib/field_group_migrate/field_group_migrate.info.yml
----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------
1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
----------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/field_group/contrib/field_group_migrate/src/Plugin/migrate/source/d7/FieldGroup.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------
92 | ERROR | unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the allowed_classes option.
-------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/field_group/contrib/field_group_migrate/src/Plugin/migrate/source/d6/FieldGroup.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------
45 | ERROR | unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the allowed_classes option.
-------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/field_group/tests/modules/field_group_test/field_group_test.info.yml
----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------
1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
----------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/field_group/tests/src/Functional/FieldGroupTestTrait.php
----------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
----------------------------------------------------------------------------------------------------
47 | ERROR | [x] Use null coalesce operator instead of ternary operator.
48 | ERROR | [x] Use null coalesce operator instead of ternary operator.
49 | ERROR | [x] Use null coalesce operator instead of ternary operator.
50 | ERROR | [x] Use null coalesce operator instead of ternary operator.
----------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/field_group/tests/src/Functional/EntityDisplayTest.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------
135 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/field_group/tests/src/Functional/ManageDisplayTest.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
------------------------------------------------------------------------------------------------------------------------------------------
89 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
103 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
123 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
139 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
170 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------

Time: 2.95 secs; Memory: 18MB

Steps to reproduce

Run PHPCS on Config Pages module.

Proposed resolution

Fixed the coding standards.

Remaining tasks

Submit the patch either MR.

📌 Task
Status

Closed: outdated

Version

3.4

Component

Code

Created by

🇮🇳India hetal.solanki

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

Merge Requests

Comments & Activities

  • Issue created by @hetal.solanki
  • Merge request !59coding standard issue → (Open) created by hetal.solanki
  • Pipeline finished with Failed
    5 months ago
    Total: 269s
    #214661
  • Pipeline finished with Failed
    5 months ago
    Total: 266s
    #214681
  • Pipeline finished with Failed
    5 months ago
    #214684
  • Pipeline finished with Failed
    5 months ago
    Total: 234s
    #214700
  • Pipeline finished with Failed
    5 months ago
    Total: 226s
    #214704
  • Issue was unassigned.
  • Status changed to RTBC 5 months ago
  • 🇮🇳India bhaveshdas

    I have tested and cannot find any phpcs issue so I move forward to RTBC

  • Status changed to Closed: outdated 4 months ago
  • 🇧🇪Belgium nils.destoop

    Your merge request seems to be started from an older version, as your merge is trying to re-add files that are removed in current dev version.
    In latest dev version all phpstan, phpcs and cs issues are already fixed.

Production build 0.71.5 2024