Fix the issues reported by PHP_CodeSniffer

Created on 24 September 2024, about 2 months ago

Problem/Motivation

FILE: xnttfiles\src\Entity\ExternalFile.php
-------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------
65 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
-------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------

FILE: xnttfiles\src\Plugin\ExternalEntities\StorageClient\FileClientBase.php
----------------------------------------------------------------------------------------------------------
FOUND 12 ERRORS AFFECTING 12 LINES
----------------------------------------------------------------------------------------------------------
165 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
209 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
244 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
425 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
573 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
587 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
609 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
838 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
1330 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
1637 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
1789 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
1807 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 12 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------

FILE: xnttfiles\src\Plugin\ExternalEntities\StorageClient\Files.php
--------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------------------------------------
44 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
82 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
188 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
--------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------

FILE: xnttfiles\xnttfiles.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
-------------------------------------------------------------------------------------------------------------

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 work

Version

1.0

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
  • šŸ‡ŗšŸ‡ø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.

  • šŸ‡µšŸ‡­Philippines cleavinjosh
  • šŸ‡µšŸ‡­Philippines cleavinjosh
  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi @sunil jolapara,

    Thank you for providing an MR. I applied MR!4, it was applied smoothly and fixed most of the phpcs issues.

    These are the remaining issues after I ran phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml:

    āžœ  xnttfiles git:(1.0.x) curl https://git.drupalcode.org/project/xnttfiles/-/merge_requests/4.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  5780    0  5780    0     0  13178      0 --:--:-- --:--:-- --:--:-- 13196
    patching file src/Entity/ExternalFile.php
    patching file src/Plugin/ExternalEntities/StorageClient/FileClientBase.php
    patching file src/Plugin/ExternalEntities/StorageClient/Files.php
    āžœ  xnttfiles git:(1.0.x) āœ— ..
    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml xnttfiles
    
    FILE: /Users/interns/Demo-site/drupal_11_test/install-dir/drupal_11_test_site/web/modules/contrib/xnttfiles/xnttfiles.module
    ----------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
    ----------------------------------------------------------------------------------------------------------------------------
     314 | WARNING | Unused variable $m.
     430 | WARNING | Unused variable $integer_field_options.
     431 | WARNING | Unused variable $date_field_options.
     432 | WARNING | Unused variable $lang_field_options.
     435 | WARNING | Unused variable $uuid_field_options.
    ----------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal_11_test/install-dir/drupal_11_test_site/web/modules/contrib/xnttfiles/src/Plugin/ExternalEntities/StorageClient/FileClientBase.php
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     246 | WARNING | Unused variable $value.
     663 | WARNING | Variable $entity_id inside unset call is undefined.
     859 | WARNING | Unused variable $id.
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 811ms; Memory: 20MB
    
    āžœ  contrib git:(main) āœ—

    Thank you.

  • Pipeline finished with Failed
    8 days ago
    Total: 136s
    #338476
  • šŸ‡µšŸ‡­Philippines cleavinjosh

    cleavinjosh ā†’ changed the visibility of the branch 3476372-phpcs-issues to hidden.

  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi,

    This is the remaining issue.

    ILE: /Users/interns/Demo-site/drupal_11_test/install-dir/drupal_11_test_site/web/modules/contrib/xnttfiles/src/Plugin/ExternalEntities/StorageClient/FileClientBase.php
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     662 | WARNING | Variable $entity_id inside unset call is undefined.
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 789ms; Memory: 20MB
    
    āžœ  contrib git:(main) āœ—

    Please check and advise.
    Thank you.

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    The issue summary must still be updated: The .info.yml file does not contain any of the reported lines.

  • šŸ‡µšŸ‡­Philippines cleavinjosh
  • šŸ‡µšŸ‡­Philippines cleavinjosh
Production build 0.71.5 2024