Fix the issues reported by PHP_CodeSniffer

Created on 27 September 2024, about 2 months ago

Problem/Motivation

FILE: modules\masonry_view_style\masonry_view_style.module
----------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
----------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
9 | ERROR | [x] You must use "/**" style comments for a function comment
16 | ERROR | [x] Short array syntax must be used to define arrays
----------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------

FILE: modules\masonry_view_style\README.txt
------------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 3 LINES
------------------------------------------------------------------------
1 | WARNING | [ ] Line exceeds 80 characters; contains 127 characters
3 | WARNING | [ ] Line exceeds 80 characters; contains 100 characters
23 | WARNING | [ ] Line exceeds 80 characters; contains 140 characters
23 | ERROR | [x] Expected 1 newline at end of file; 0 found
------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------

FILE: modules\masonry_view_style\src\Plugin\views\style\Masonry.php
-------------------------------------------------------------------------------------------
FOUND 10 ERRORS AND 1 WARNING AFFECTING 11 LINES
-------------------------------------------------------------------------------------------
5 | WARNING | [x] Unused use statement
9 | ERROR | [x] Doc comment short description must end with a full stop
23 | ERROR | [x] Expected 3 space(s) before asterisk; 4 found
24 | ERROR | [x] Expected 3 space(s) before asterisk; 4 found
25 | ERROR | [x] Expected 3 space(s) before asterisk; 4 found
26 | ERROR | [x] Expected 3 space(s) before asterisk; 4 found
30 | ERROR | [x] Expected 3 space(s) before asterisk; 4 found
31 | ERROR | [x] Expected 3 space(s) before asterisk; 4 found
32 | ERROR | [x] Expected 3 space(s) before asterisk; 4 found
33 | ERROR | [x] Expected 3 space(s) before asterisk; 4 found
35 | ERROR | [x] The closing brace for the class must have an empty line before it
-------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 11 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
  • šŸ‡ŗšŸ‡ø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!2, it was applied smoothly and fixed most of the phpcs issues.

    āžœ  masonry_view_style git:(8.x-1.x) curl https://git.drupalcode.org/project/masonry_view_style/-/merge_requests/2.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  3308    0  3308    0     0   7665      0 --:--:-- --:--:-- --:--:--  7675
    patching file README.txt
    patching file masonry_view_style.module
    patching file src/Plugin/views/style/Masonry.php
    āžœ  masonry_view_style git:(8.x-1.x) āœ— ..
    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml masonry_view_style
    
    FILE: /Users/interns/Demo-site/drupal_11_test/install-dir/drupal_11_test_site/web/modules/contrib/masonry_view_style/masonry_view_style.info.yml
    ------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------------------------
     7 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
    ------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal_11_test/install-dir/drupal_11_test_site/web/modules/contrib/masonry_view_style/masonry_view_style.module
    ----------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------------------------------------
     18 | WARNING | Unused variable $options.
    ----------------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 165ms; Memory: 10MB
    
    āžœ  contrib git:(main) āœ—

    Thank you.

  • šŸ‡µšŸ‡­Philippines cleavinjosh

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

  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi,

    Please review MR!2, no issues were found in Gitlab CI after the changes while there are still issues found in local.

    Please check and advise.
    Thank you.

  • Pipeline finished with Success
    6 days ago
    Total: 2450s
    #339738
  • Pipeline finished with Success
    6 days ago
    Total: 3848s
    #339726
Production build 0.71.5 2024