Fix the issues reported by phpcs

Created on 25 April 2023, about 1 year ago
Updated 3 June 2024, 20 days ago

vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig web/modules/contrib/viewer/

FILE: /var/www/html/vbd7/web/modules/contrib/viewer/src/Controller/CKEditorPreview.php
--------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------------------------
60 | ERROR | [x] Whitespace found at end of line
61 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
110 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
--------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------

FILE: /var/www/html/vbd7/web/modules/contrib/viewer/src/Form/CKEditorDialogForm.php
-------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
-------------------------------------------------------------------------------------------------
5 | WARNING | [x] Unused use statement
6 | WARNING | [x] Unused use statement
94 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
-------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------

FILE: /var/www/html/vbd7/web/modules/contrib/viewer/assets/apexcharts/apexcharts.amd.js.LICENSE.txt
---------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------
8 | WARNING | Line exceeds 80 characters; contains 83 characters
---------------------------------------------------------------------------------------------------

FILE: /var/www/html/vbd7/web/modules/contrib/viewer/assets/chartjs/LICENSE.md
-----------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
-----------------------------------------------------------------------------
5 | WARNING | Line exceeds 80 characters; contains 432 characters
7 | WARNING | Line exceeds 80 characters; contains 126 characters
9 | WARNING | Line exceeds 80 characters; contains 460 characters
-----------------------------------------------------------------------------

Time: 10.69 secs; Memory: 18MB

RUN:

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig web/modules/contrib/viewer/

๐Ÿ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia dineshkumarbollu

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @dineshkumarbollu
  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines clarkssquared

    Hi dineshkumarbollu,

    I applied your patch#2 to the "viewer" module against version 1.0.1-beta1 and noticed that there are still remaining PHPCS issues being flagged.

    Please look at the screenshot attached for your reference

    Please review and advise,
    Thanks

  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia mrinalini9 New Delhi

    Updated patch #2 by addressing #3, please review it.

    Thanks!

  • Status changed to Needs work 6 months ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines clarkssquared

    Hi

    I applied patch #4 and I noticed that the patch didin't apply properly due to some files are being rejected, and there are still many PHPCS issues being flagged in my terminal.

    โžœ  viewer git:(master) โœ— curl https://www.drupal.org/files/issues/2023-04-26/codingstandards-3356240-4.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  8351  100  8351    0     0  17988      0 --:--:-- --:--:-- --:--:-- 18434
    patching file 'assets/apexcharts/apexcharts.amd.js.LICENSE.txt'
    patching file 'assets/chartjs/LICENSE.md'
    patching file 'src/Controller/CKEditorPreview.php'
    4 out of 5 hunks failed--saving rejects to 'src/Controller/CKEditorPreview.php.rej'
    patching file 'src/Form/CKEditorDialogForm.php'
    2 out of 3 hunks failed--saving rejects to 'src/Form/CKEditorDialogForm.php.rej'
    patching file 'src/Form/Source/ImportForm.php'
    patching file 'src/Form/Source/SourceForm.php'
    โžœ  viewer git:(master) โœ— ..
    โžœ  contrib git:(master) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml viewer
    
    FILE: /Users/clarksubing-subing/Projects/d9/d9-local/web/modules/contrib/viewer/viewer.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: /Users/clarksubing-subing/Projects/d9/d9-local/web/modules/contrib/viewer/src/Form/CKEditorDialogForm.php
    --------------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
    --------------------------------------------------------------------------------------------------------------------------
      6 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Ajax\AjaxResponse.
     10 | WARNING | [x] Unused use statement
     11 | WARNING | [x] Unused use statement
     19 | ERROR   | [x] Whitespace found at end of line
    --------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/clarksubing-subing/Projects/d9/d9-local/web/modules/contrib/viewer/src/Form/Source/SourceForm.php
    --------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    --------------------------------------------------------------------------------------------------------------
     53 | ERROR | [x] Array indentation error, expected 10 spaces but found 8
     54 | ERROR | [x] Array indentation error, expected 10 spaces but found 8
    --------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/clarksubing-subing/Projects/d9/d9-local/web/modules/contrib/viewer/src/Form/Source/BaseForm.php
    ---------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------------
     8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Entity\EntityTypeManagerInterface.
    ---------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/clarksubing-subing/Projects/d9/d9-local/web/modules/contrib/viewer/src/Form/Source/ImportForm.php
    --------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    --------------------------------------------------------------------------------------------------------------
    

    I didin't include the other issues because it's too many

  • Assigned to nitin_lama
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama

    Providing updated patch for 1.0.x

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama

    Please review.

  • Issue was unassigned.
  • Status changed to Needs review 6 months ago
  • Hi . the patch #7 applied cleanly, but few warnings are still present.

    $ vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig viewer/

    FILE: /home/sites/contributions/viewer/assets/chartjs/LICENSE.md
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    ----------------------------------------------------------------------
    5 | WARNING | Line exceeds 80 characters; contains 432 characters
    7 | WARNING | Line exceeds 80 characters; contains 126 characters
    9 | WARNING | Line exceeds 80 characters; contains 460 characters
    ----------------------------------------------------------------------

    FILE: /home/sites/contributions/viewer/assets/apexcharts/apexcharts.amd.js.LICENSE.txt
    --------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------------
    8 | WARNING | Line exceeds 80 characters; contains 83 characters
    --------------------------------------------------------------------------------------

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Preethy_ray

    Hi,
    Above Patch applied cleanly, but found few warnings.

    
    FILE: /viewer/assets/chartjs/LICENSE.md
    --------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    --------------------------------------------------------------------------------------------
     5 | WARNING | Line exceeds 80 characters; contains 432 characters
     7 | WARNING | Line exceeds 80 characters; contains 126 characters
     9 | WARNING | Line exceeds 80 characters; contains 460 characters
    --------------------------------------------------------------------------------------------
    
    
    FILE: /viewer/assets/apexcharts/apexcharts.amd.js.LICENSE.txt
    ------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------
     8 | WARNING | Line exceeds 80 characters; contains 83 characters
    ------------------------------------------------------------------------------------------------------------------
    
  • First commit to issue fork.
  • Merge request !3fix all phpcs issue and created MR โ†’ (Open) created by Chandansha
  • Status changed to Needs work about 1 month ago
  • Hi @Chandansha,

    I applied MR!3 and found these issues:

    FILE: ...terns/Demo-site/drupal-orgissue/web/modules/contrib/viewer/viewer.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: ...-orgissue/web/modules/contrib/viewer/src/Plugin/CKEditor5Plugin/Viewer.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: .../Demo-site/drupal-orgissue/web/modules/contrib/viewer/src/ViewerModule.php
    --------------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 2 LINES
    --------------------------------------------------------------------------------
     60 | ERROR | [x] The first parameter of a multi-line function declaration must
        |       |     be on the line after the opening bracket
     64 | ERROR | [x] Multi-line function declarations must have a trailing comma
        |       |     after the last parameter
     64 | ERROR | [x] The closing parenthesis of a multi-line function declaration
        |       |     must be on a new line
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    Time: 5.23 secs; Memory: 16MB

    Will change status to 'Needs work'
    Thank you.

  • Arijit Acharya โ†’ made their first commit to this issueโ€™s fork.

  • I applied the MR!3 and addressed some of the issues flagged by PHPCS. However, no issues were detected in the 'viewer.info.yml' file. Below, I have listed the errors encountered. Additionally, I have raised an MR to resolve these issues. Please review and merge.

    FILE: ...modules/custom/viewer-3356240/src/Controller/CKEditorPreview.php
    ----------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    ----------------------------------------------------------------------
      7 | ERROR | [x] Use statements should be sorted alphabetically. The
        |       |     first wrong one is
        |       |     Drupal\Core\Entity\EntityTypeManagerInterface.
     71 | ERROR | [x] Whitespace found at end of line
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
    
    FILE: ...ules/custom/viewer-3356240/src/Plugin/CKEditor5Plugin/Viewer.php
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
     3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
    
    FILE: ...eb/modules/custom/viewer-3356240/src/Form/CKEditorDialogForm.php
    ----------------------------------------------------------------------
    FOUND 2 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
    ----------------------------------------------------------------------
      6 | ERROR   | [x] Use statements should be sorted alphabetically.
        |         |     The first wrong one is
        |         |     Drupal\Core\Ajax\AjaxResponse.
     10 | WARNING | [x] Unused use statement
     11 | WARNING | [x] Unused use statement
     19 | ERROR   | [x] Whitespace found at end of line
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
    
    FILE: /app/web/modules/custom/viewer-3356240/src/ViewerModule.php
    ----------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 2 LINES
    ----------------------------------------------------------------------
     60 | ERROR | [x] The first parameter of a multi-line function
        |       |     declaration must be on the line after the opening
        |       |     bracket
     64 | ERROR | [x] Multi-line function declarations must have a
        |       |     trailing comma after the last parameter
     64 | ERROR | [x] The closing parenthesis of a multi-line function
        |       |     declaration must be on a new line
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
  • Status changed to Needs review 20 days ago
Production build 0.69.0 2024