Fix the issues reported by PHP_CodeSniffer

Created on 25 September 2024, about 2 months ago

Problem/Motivation

FILE: media_contextual_crop_iwc_adapter\media_contextual_crop_iwc_adapter.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: media_contextual_crop_iwc_adapter\media_contextual_crop_iwc_adapter.module
--------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------
68 | ERROR | [x] Expected 1 space after IF keyword; 0 found
--------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------

FILE: media_contextual_crop_iwc_adapter\src\Plugin\MediaContextualCrop\ImageWidgetCrop.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 5 LINES
-------------------------------------------------------------------------------------------------------------------------
37 | ERROR | [x] The first parameter of a multi-line function declaration must be on the line after the opening bracket
38 | ERROR | [x] Multi-line function declaration not indented correctly; expected 4 spaces but found 36
39 | ERROR | [x] Multi-line function declaration not indented correctly; expected 4 spaces but found 36
40 | ERROR | [x] Multi-line function declaration not indented correctly; expected 4 spaces but found 30
41 | ERROR | [x] Multi-line function declaration not indented correctly; expected 4 spaces but found 30
41 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
-------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 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

2.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
    about 2 months ago
    Total: 145s
    #292269
  • šŸ‡ŗšŸ‡øUnited States sunil jolapara 3265 Summitrun Drive, Independence, KY, 41051
  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi @sunil jolapara,

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

    āžœ  media_contextual_crop_iwc_adapter git:(1.0.x) curl https://git.drupalcode.org/project/media_contextual_crop_iwc_adapter/-/merge_requests/3.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 10203    0 10203    0     0  26520      0 --:--:-- --:--:-- --:--:-- 26501
    patching file .gitlab-ci.yml
    patching file composer.json
    patching file media_contextual_crop_iwc_adapter.info.yml
    patching file media_contextual_crop_iwc_adapter.module
    patching file src/Plugin/MediaContextualCrop/ImageWidgetCrop.php
    āžœ  media_contextual_crop_iwc_adapter git:(1.0.x) āœ— ..
    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml media_contextual_crop_iwc_adapter
    āžœ  contrib git:(main) āœ—

    Thank you.

  • šŸ‡®šŸ‡¹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.

Production build 0.71.5 2024