Fix issues reported by PHPCS

Created on 11 April 2024, 3 months ago
Updated 30 April 2024, about 2 months ago

Problem/Motivation

See https://git.drupalcode.org/project/domain_access_logo/-/jobs/1303781

FILE: ...odules/custom/domain_access_logo/src/Form/DomainAccessLogoSettingsForm.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 9 | ERROR | [x] Use statements should be sorted alphabetically. The first
   |       |     wrong one is Drupal\Core\Entity\EntityTypeManagerInterface.
   |       |     (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...ccess_logo/web/modules/custom/domain_access_logo/domain_access_logo.module
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 10 | WARNING | [x] Unused use statement
    |         |     (Drupal.Classes.UnusedUseStatement.UnusedUse)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
Time: 147ms; Memory: 6MB
PHP CODE SNIFFER REPORT SUMMARY
--------------------------------------------------------------------------------
FILE                                                            ERRORS  WARNINGS
--------------------------------------------------------------------------------
...modules/custom/domain_access_logo/domain_access_logo.module  0       1
...omain_access_logo/src/Form/DomainAccessLogoSettingsForm.php  1       0
--------------------------------------------------------------------------------
A TOTAL OF 1 ERROR AND 1 WARNING WERE FOUND IN 4 FILES
--------------------------------------------------------------------------------
PHPCBF CAN FIX 2 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
PHP CODE SNIFFER VIOLATION SOURCE SUMMARY
--------------------------------------------------------------------------------
    SOURCE                                                                 COUNT
--------------------------------------------------------------------------------
[x] Drupal.Classes.UnusedUseStatement.UnusedUse                            1
[x] SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.Incorrectl  1
--------------------------------------------------------------------------------
A TOTAL OF 2 SNIFF VIOLATIONS WERE FOUND IN 2 SOURCES
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SOURCES AUTOMATICALLY (2 VIOLATIONS IN TOTAL)
--------------------------------------------------------------------------------

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

šŸ“Œ Task
Status

Fixed

Version

2.0

Component

Code

Created by

šŸ‡§šŸ‡ŖBelgium tim-diels Belgium šŸ‡§šŸ‡Ŗ

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

Merge Requests

Comments & Activities

  • Issue created by @tim-diels
  • Assigned to atul ghate
  • Issue was unassigned.
  • Status changed to Needs review 3 months ago
  • šŸ‡®šŸ‡³India atul ghate

    fixed the issue reported by phpcs please review the attached patch.

  • Status changed to RTBC 2 months ago
  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi

    I applied patch #3 and I confirmed that it fixes all the PHPCS issues

    āžœ  domain_access_logo git:(2.0.x) curl https://www.drupal.org/files/issues/2024-04-12/phpcs-3440266-3.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  2537  100  2537    0     0   4795      0 --:--:-- --:--:-- --:--:--  4964
    patching file domain_access_logo.module
    patching file 'src/Form/DomainAccessLogoSettingsForm.php'
    āžœ  domain_access_logo git:(2.0.x) āœ— ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml domain_access_logo 
    āžœ  contrib git:(master) āœ— 
    
  • šŸ‡§šŸ‡ŖBelgium tim-diels Belgium šŸ‡§šŸ‡Ŗ

    Hey, thanks for the work you've done. Drupal is moving away from the use of patches and expects to work with Merge Requests to contribute to core/modules/themes/...

    And this issue just arose or was discovered from using Gitlab CI.

    So try to use a Merge Request next time as it doesn't take much more time to contribute. The guide can be found https://www.drupal.org/docs/develop/git/using-gitlab-to-contribute-to-dr... ā†’

    And I ask you to read https://www.drupal.org/about/core/blog/drupalci-and-all-patch-testing-wi... ā†’ to have more understanding why the transition is being done.

  • šŸ‡§šŸ‡ŖBelgium tim-diels Belgium šŸ‡§šŸ‡Ŗ
    1. +++ b/src/Form/DomainAccessLogoSettingsForm.php
      @@ -67,10 +67,10 @@ class DomainAccessLogoSettingsForm extends ConfigFormBase {
      -      $container->get('config.factory'),
      -      $container->get('cache_tags.invalidator'),
      -      $container->get('entity_type.manager')
      -    );
      +          $container->get('config.factory'),
      +          $container->get('cache_tags.invalidator'),
      +          $container->get('entity_type.manager')
      +      );
      

      Incorrect indents

    2. +++ b/src/Form/DomainAccessLogoSettingsForm.php
      @@ -110,9 +110,11 @@ class DomainAccessLogoSettingsForm extends ConfigFormBase {
      -            '#description' => $this->t('The logo for this domain/subdomain.<br>Allowed types: @extensions.', [
      -              '@extensions' => $extensions,
      -            ]),
      +            '#description' => $this->t(
      +                'The logo for this domain/subdomain.<br>Allowed types: @extensions.', [
      +                  '@extensions' => $extensions,
      +                ]
      +            ),
      

      Incorrect indents

    @atul_ghate your path introduced more PHPCS

    @clarkssquared if you want to review patches, make sure the review is correct as I can not trust any of them anymore because I see by the eye there are more CS issues. Don't just blindly follow a tool next time to do reviews.

    Therefor I created an issue fork with the code changes that are correct.

    Please let me know you follow up your issue and have understood the above.

  • šŸ‡§šŸ‡ŖBelgium tim-diels Belgium šŸ‡§šŸ‡Ŗ
  • Status changed to Fixed 2 months ago
  • šŸ‡§šŸ‡ŖBelgium tim-diels Belgium šŸ‡§šŸ‡Ŗ
  • šŸ‡®šŸ‡³India atul ghate

    Hi @tim-diels, thank you for sharing this information and for the guidance on using Merge Requests for contributions. I'll make sure to follow the guidelines provided and transition to using Merge Requests in future contributions. I apologize for the PHPCS issues in my patch and will address them in future contributions.

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

Production build 0.69.0 2024