Adhere to coding standards

Created on 11 February 2025, about 2 months ago

Problem/Motivation

We have a few coding standards violations that are detected by PHP_CodeSniffer. Let's fix these and set allow_failures: false for the phpcs job in .gitlab-ci.yml.

$ vendor/bin/phpcs -s $_WEB_ROOT/modules/custom --report-junit=junit.xml --report-full --report-summary --report-source $_PHPCS_EXTRA
FILE: /builds/project/graphql_webform/web/modules/custom/graphql_webform/tests/src/Unit/WebformElementDisplayOnTest.php
------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------
  8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Tests\UnitTestCase.
    |       |     (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
 32 | ERROR | [ ] Public method name "WebformElementDisplayOnTest::testToGraphQLEnumValue" is not in lowerCamel format
    |       |     (Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps)
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------
FILE: /builds/project/graphql_webform/web/modules/custom/graphql_webform/src/Enum/WebformElementDisplayOn.php
------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------
 41 | ERROR | Public method name "WebformElementDisplayOn::toGraphQLEnumValue" is not in lowerCamel format
    |       | (Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps)
------------------------------------------------------------------------------------------------------------------------
Time: 765ms; Memory: 10MB
PHP CODE SNIFFER REPORT SUMMARY
------------------------------------------------------------------------------------------------------------------------
FILE                                                                                                    ERRORS  WARNINGS
------------------------------------------------------------------------------------------------------------------------
...lds/project/graphql_webform/web/modules/custom/graphql_webform/src/Enum/WebformElementDisplayOn.php  1       0
...t/graphql_webform/web/modules/custom/graphql_webform/tests/src/Unit/WebformElementDisplayOnTest.php  2       0
------------------------------------------------------------------------------------------------------------------------
A TOTAL OF 3 ERRORS AND 0 WARNINGS WERE FOUND IN 36 FILES
------------------------------------------------------------------------------------------------------------------------
📌 Task
Status

Active

Version

2.0

Component

Code

Created by

🇧🇬Bulgaria pfrenssen Sofia

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024