Coding Standard issues

Created on 5 September 2024, 6 months ago

Problem/Motivation

Drupal Coding standards should be fixed.

phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml .

FILE: .../web/modules/custom/views_load_more/README.md
-------------------------------------------------------------------------------
FOUND 1 ERROR AND 4 WARNINGS AFFECTING 5 LINES
-------------------------------------------------------------------------------
8 | WARNING | [ ] Line exceeds 80 characters; contains 98 characters
9 | WARNING | [ ] Line exceeds 80 characters; contains 112 characters
33 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
38 | WARNING | [ ] Line exceeds 80 characters; contains 114 characters
49 | ERROR | [x] Expected 1 newline at end of file; 0 found
-------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------

FILE: .../web/modules/custom/views_load_more/src/Plugin/views/pager/LoadMore.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 38 ERRORS AND 1 WARNING AFFECTING 36 LINES
-------------------------------------------------------------------------------------------------------------------------
39 | ERROR | [x] Short array syntax must be used to define arrays
39 | ERROR | [ ] The array declaration extends to column 244 (the limit is 80). The array content should be split up
| | over multiple lines
41 | ERROR | [x] Short array syntax must be used to define arrays
50 | ERROR | [x] Short array syntax must be used to define arrays
51 | ERROR | [x] Short array syntax must be used to define arrays
53 | ERROR | [x] Short array syntax must be used to define arrays
54 | ERROR | [x] Short array syntax must be used to define arrays
56 | ERROR | [x] Short array syntax must be used to define arrays
57 | ERROR | [x] Short array syntax must be used to define arrays
68 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing
| | parentheses
73 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing
| | parentheses
77 | ERROR | [x] Short array syntax must be used to define arrays
84 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing
| | parentheses
85 | ERROR | [x] Short array syntax must be used to define arrays
92 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing
| | parentheses
96 | ERROR | [x] Short array syntax must be used to define arrays
100 | ERROR | [x] Expected 1 space after "=>"; 2 found
105 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
108 | ERROR | [x] Short array syntax must be used to define arrays
111 | ERROR | [x] Short array syntax must be used to define arrays
117 | ERROR | [x] Short array syntax must be used to define arrays
120 | ERROR | [x] Short array syntax must be used to define arrays
124 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing
| | parentheses
125 | ERROR | [x] Short array syntax must be used to define arrays
129 | ERROR | [x] Expected 1 space after "=>"; 2 found
133 | ERROR | [x] Short array syntax must be used to define arrays
135 | ERROR | [x] Short array syntax must be used to define arrays
146 | ERROR | [x] Short array syntax must be used to define arrays
148 | ERROR | [x] Short array syntax must be used to define arrays
152 | ERROR | [x] Short array syntax must be used to define arrays
153 | ERROR | [x] Short array syntax must be used to define arrays
154 | ERROR | [x] Short array syntax must be used to define arrays
154 | ERROR | [x] Short array syntax must be used to define arrays
155 | ERROR | [x] Short array syntax must be used to define arrays
155 | ERROR | [x] Short array syntax must be used to define arrays
166 | ERROR | [x] Visibility must be declared on method "render"
167 | ERROR | [x] Short array syntax must be used to define arrays
176 | ERROR | [x] Expected 1 blank line after function; 0 found
177 | ERROR | [x] The closing brace for the class must have an empty line before it
-------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 37 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------

FILE: .../web/modules/custom/views_load_more/src/EventSubscriber/VLMEventSubscriber.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 15 ERRORS AND 3 WARNINGS AFFECTING 16 LINES
-------------------------------------------------------------------------------------------------------------------------
3 | ERROR | [x] There must be one blank line after the namespace declaration
12 | ERROR | [x] Missing class doc comment
18 | ERROR | [x] Short array syntax must be used to define arrays
25 | WARNING | [ ] Line exceeds 80 characters; contains 88 characters
25 | ERROR | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
27 | ERROR | [ ] Missing parameter comment
40 | WARNING | [ ] Line exceeds 80 characters; contains 94 characters
44 | WARNING | [ ] Line exceeds 80 characters; contains 94 characters
45 | ERROR | [x] Use "elseif" in place of "else if"
49 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing
| | parentheses
51 | ERROR | [x] Short array syntax must be used to define arrays
57 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing
| | parentheses
63 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing
| | parentheses
64 | ERROR | [x] Short array syntax must be used to define arrays
64 | ERROR | [ ] The array declaration extends to column 119 (the limit is 80). The array content should be split up
| | over multiple lines
74 | ERROR | [x] Use "elseif" in place of "else if"
83 | ERROR | [x] Expected 1 blank line after function; 0 found
84 | ERROR | [x] The closing brace for the class must have an empty line before it
-------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 12 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------

FILE: .../web/modules/custom/views_load_more/src/Ajax/VLMAppendCommand.php
----------------------------------------------------------------------------------------------------------------------
FOUND 8 ERRORS AFFECTING 7 LINES
----------------------------------------------------------------------------------------------------------------------
12 | ERROR | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
39 | ERROR | [x] There must be exactly one blank line before the tags in a doc comment
41 | ERROR | [ ] Missing parameter comment
41 | ERROR | [ ] Missing parameter type
50 | ERROR | [x] Parameter comment must end with a full stop
52 | ERROR | [ ] Type hint "array" missing for $options
54 | ERROR | [x] Short array syntax must be used to define arrays
70 | ERROR | [x] Short array syntax must be used to define arrays
----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------

FILE: .../web/modules/custom/views_load_more/views_load_more.module
-------------------------------------------------------------------------------------------------------------------------
FOUND 10 ERRORS AND 2 WARNINGS AFFECTING 11 LINES
-------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
6 | ERROR | [x] Doc comment short description must be on the first line
12 | WARNING | [ ] Line exceeds 80 characters; contains 84 characters
19 | ERROR | [x] Short array syntax must be used to define arrays
20 | ERROR | [x] Short array syntax must be used to define arrays
21 | ERROR | [x] Short array syntax must be used to define arrays
23 | ERROR | [x] Short array syntax must be used to define arrays
38 | ERROR | [x] Whitespace found at end of line
48 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing
| | parentheses
69 | WARNING | [ ] Hook implementations should not duplicate @param documentation
69 | ERROR | [ ] Missing parameter comment
71 | ERROR | [ ] Type hint "\Drupal\views\ViewExecutable" missing for $view
-------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------

Steps to reproduce

phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml .

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

šŸ“Œ Task
Status

Active

Version

2.0

Component

Code

Created by

šŸ‡µšŸ‡ŖPeru alyaj2a

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @alyaj2a
  • Merge request !11Coding Standard issues - #3472429 ā†’ (Open) created by alyaj2a
  • Status changed to Needs review 6 months ago
  • Status changed to Needs work 6 months ago
  • šŸ‡µšŸ‡­Philippines paraderojether

    Hi alyaj2a,

    I reviewed MR!11, applied it against it Views Load More 2.x-dev, and there is still 1 error remaining after applying the MR.

    views_load_more git:(2.x) curl https://git.drupalcode.org/project/views_load_more/-/merge_requests/11.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 20900    0 20900    0     0  21990      0 --:--:-- --:--:-- --:--:-- 22116
    patching file README.md
    patching file 'src/Ajax/VLMAppendCommand.php'
    patching file 'src/EventSubscriber/VLMEventSubscriber.php'
    patching file 'src/Plugin/views/pager/LoadMore.php'
    patching file views_load_more.module
    āžœ  views_load_more git:(2.x) āœ— cd ..
    āžœ  contrib phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig views_load_more
    
    FILE: /Users/jetherparadero/Contributions/recommended-project/web/modules/contrib/views_load_more/src/EventSubscriber/VLMEventSubscriber.php
    --------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\views\Ajax\ViewAjaxResponse.
    --------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 143ms; Memory: 10MB

    Please check.
    Thank you.

  • šŸ‡µšŸ‡ŖPeru alyaj2a

    Hello paraderojether, I tried testing on the branch 3472429-coding-standard-issues and also on 2.x, but I wasn't able to get the result you're showing. Could you please help me understand what I might be missing? Thank you!

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Pipeline finished with Success
    6 months ago
    Total: 142s
    #276687
  • Pipeline finished with Success
    6 months ago
    Total: 133s
    #276688
  • Pipeline finished with Success
    6 months ago
    Total: 130s
    #276690
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    avpaderno ā†’ changed the visibility of the branch 3472429-gitlab-ci-reports to hidden.

  • Status changed to Needs review 6 months ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Status changed to Needs work about 1 month ago
  • šŸ‡µšŸ‡­Philippines paraderojether

    Hi I reviewed MR!11 and it is not applied cleanly.

    āžœ  views_load_more git:(2.x) curl https://git.drupalcode.org/project/views_load_more/-/merge_requests/11.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 22775    0 22775    0     0  69763      0 --:--:-- --:--:-- --:--:-- 72301
    patching file .gitlab-ci.yml
    patching file README.md
    3 out of 3 hunks failed--saving rejects to README.md.rej
    patching file 'src/Ajax/VLMAppendCommand.php'
    5 out of 5 hunks failed--saving rejects to 'src/Ajax/VLMAppendCommand.php.rej'
    patching file 'src/EventSubscriber/VLMEventSubscriber.php'
    3 out of 4 hunks failed--saving rejects to 'src/EventSubscriber/VLMEventSubscriber.php.rej'
    patching file 'src/Plugin/views/pager/LoadMore.php'
    3 out of 3 hunks failed--saving rejects to 'src/Plugin/views/pager/LoadMore.php.rej'
    patching file views_load_more.module
    4 out of 4 hunks failed--saving rejects to views_load_more.module.rej
    āžœ  views_load_more git:(2.x) āœ—

    Kindly check and advise, please.
    Thank you.

  • šŸ‡ÆšŸ‡µJapan tom konda Kanagawa, Japan

    I think this issue is already solved in šŸ› Drupal coding standards Needs work .

Production build 0.71.5 2024