Fix the issues reported by PHP_CodeSniffer

Created on 30 September 2024, 3 months ago

Problem/Motivation

FILE: xnttxml\src\Plugin\ExternalEntities\StorageClient\XmlFiles.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AND 4 WARNINGS AFFECTING 6 LINES
--------------------------------------------------------------------------------
37 | ERROR | [x] Multi-line function declarations must have a trailing
| | comma after the last parameter
65 | ERROR | [x] Multi-line function declarations must have a trailing
| | comma after the last parameter
104 | WARNING | [x] '@todo: use setting tag name to get the value.' should
| | match the format '@todo Fix problem X here.'
147 | WARNING | [x] '@todo: use a setting to define root tag element.' should
| | match the format '@todo Fix problem X here.'
163 | WARNING | [x] '@todo: use a setting to define entity tag element.'
| | should match the format '@todo Fix problem X here.'
174 | WARNING | [x] '@todo: use a setting to define entity tag element.'
| | should match the format '@todo Fix problem X here.'
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: xnttxml\xnttxml.install
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
----------------------------------------------------------------------
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 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
  • Pipeline finished with Success
    3 months ago
    #297049
  • šŸ‡ŗšŸ‡ø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.

  • First commit to issue fork.
  • šŸ‡µšŸ‡­Philippines cleavinjosh
  • šŸ‡µšŸ‡­Philippines cleavinjosh
  • Pipeline finished with Failed
    11 days ago
    Total: 143s
    #365427
  • šŸ‡µšŸ‡­Philippines cleavinjosh

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

  • Pipeline finished with Failed
    11 days ago
    Total: 107s
    #365473
  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi,

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

    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml xnttxml
    
    FILE: /Users/interns/Demo-site/drupal_11_test/install-dir/drupal_11_test_site/web/modules/contrib/xnttxml/src/Plugin/ExternalEntities/StorageClient/XmlFiles.php
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------
      38 | ERROR   | [x] Multi-line function declarations must have a trailing comma after the last parameter
     150 | WARNING | [ ] Unused variable $id.
     151 | WARNING | [ ] Unused variable $entity_xml.
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 202ms; Memory: 10MB
    
    āžœ  contrib git:(main) āœ—
  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi,

    Please review, check, and advise on MR!3.

    Thank you.

  • Pipeline finished with Failed
    11 days ago
    Total: 121s
    #365479
  • šŸ‡«šŸ‡·France guignonv

    Thanks. The pipeline is not passing. Could you turn "^3.0@beta1" into "^3.0@beta" to see if it is better? I made a mistake by adding the beta version. I also saw some misspelling I made reported by the pipeline, could you have a look as well?

    Also, why adding ".gitlab-ci.yml"? Could you explain in simple words what new features it brings to me? I did not use CI here and I was fine but I'm open to changes as long as I got good arguments.

    I appreciate your work but reviewing issues that just bring cosmetic changes takes time and sometimes, it's faster for me to just use the code sniffer on my dev environment and do the changes by myself. This module is at a beta stage and not my priority at the moment. I may not have processed it through the latest version of PHP CS but I will for next release. To accept those changes, I really need to feel like it saves me time and helps me. So, while the time you spent is appreciated, it might not be the most efficient way to help improving this module. No offense behind that, it's just that you may not guess it if I don't tell you.

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

    Also, why adding ".gitlab-ci.yml"?

    That is the file that enable GitLab CI, which reports PHP_CodeSniffer warnings/errors, among other things.

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

    In other words, that file is necessary to verify that the reported PHP_CodeSniffer errors/warnings are the correct ones to fix. phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml would report more issues than GitLab CI, which also means more issues than the ones that should be fixed.

  • šŸ‡«šŸ‡·France guignonv

    Noted! Thanks @avpaderno! :)

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

    You are welcome!

Production build 0.71.5 2024