Fix the issues reported by PHP_CodeSniffer

Created on 19 September 2024, 2 months ago

Problem/Motivation

FILE: menu_normalizer\menu_normalizer.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: menu_normalizer\tests\src\Unit\MenuLinkNormalizerTest.php
--------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------
48 | WARNING | [x] A comma should follow the last multiline array item. Found: 0
--------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------

FILE: menu_normalizer\tests\src\Unit\MenuLinkTreeNormalizerTest.php
------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------
6 | WARNING | [x] Unused use statement
------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------

FILE: menu_normalizer\tests\src\Unit\MenuNormalizerTestBase.php
--------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------
7 | WARNING | [x] Unused use statement
--------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------

Steps to reproduce

Run phpcs command to get the drupal coding standard issues.

Proposed resolution

Many of the issues can be fixed by running the phpcbf command. For the remaining ones, we will need to manually address and then commit these changes before pushing them.

📌 Task
Status

Needs review

Version

2.1

Component

Code

Created by

🇺🇸United States sunil jolapara 3265 Summitrun Drive, Independence, KY, 41051

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

Merge Requests

Comments & Activities

  • Issue created by @sunil jolapara
  • Pipeline finished with Success
    2 months ago
    Total: 248s
    #286921
  • Status changed to Needs review 2 months ago
  • 🇺🇸United States sunil jolapara 3265 Summitrun Drive, Independence, KY, 41051
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    The issue summary for PHP_CodeSniffer issues should always show the report given from PHP_CodeSniffer and the arguments passed to phpcs.

    Furthermore, since GitLab CI is now enabled for all the projects, GitLab CI should be used to get PHP_CodeSniffer errors/warnings.

  • Pipeline finished with Failed
    30 days ago
    Total: 184s
    #319409
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    avpaderno → changed the visibility of the branch 3475452-gitlab-ci-reports to hidden.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • First commit to issue fork.
  • 🇵🇭Philippines cleavinjosh
  • 🇵🇭Philippines cleavinjosh

    Hi,

    Gitlab CI found no phpcs errors

    However, I am seeing errors when I ran phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml on terminal:

    ➜  contrib git:(main) ✗ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml menu_normalizer
    
    FILE: /Users/interns/Demo-site/drupal_11_test/install-dir/drupal_11_test_site/web/modules/contrib/menu_normalizer/tests/src/Unit/MenuLinkTreeNormalizerTest.php
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------
     7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\menu_normalizer\Normalizer\MenuLinkTreeNormalizer.
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal_11_test/install-dir/drupal_11_test_site/web/modules/contrib/menu_normalizer/tests/src/Unit/MenuLinkNormalizerTest.php
    -----------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------------------------------------
     7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\menu_normalizer\Normalizer\MenuLinkNormalizer.
    -----------------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 214ms; Memory: 10MB

    Fixing it in the terminal will cause the error to appear in the Gitlab CI and vice versa.

    Please check and advise.
    Thank you.

  • 🇵🇭Philippines cleavinjosh
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    It depends from the PHP_CodeSniffer settings. If GitLab CI does not report errors/warnings, nothing should be changed.

Production build 0.71.5 2024