Coding Standard Issues

Created on 10 September 2024, 3 months ago
Updated 21 September 2024, 3 months ago

Problem/Motivation

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

FILE: .../web/modules/custom/fontawesome_menu_icons/fontawesome_menu_icons.install
--------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 7 WARNINGS AFFECTING 5 LINES
--------------------------------------------------------------------------------------------------------------------------------------------------------------
13 | WARNING | [ ] Line exceeds 80 characters; contains 109 characters
13 | WARNING | [x] 'TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.' should match the format '@todo
| | Fix problem X here.'
14 | WARNING | [ ] Line exceeds 80 characters; contains 128 characters
21 | WARNING | [ ] Line exceeds 80 characters; contains 111 characters
21 | WARNING | [x] 'TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.' should match the format '@todo
| | Fix problem X here.'
22 | WARNING | [ ] Line exceeds 80 characters; contains 130 characters
25 | WARNING | [x] A comma should follow the last multiline array item. Found: id
--------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: .../web/modules/custom/fontawesome_menu_icons/fontawesome_menu_icons.module
-----------------------------------------------------------------------------------------------------------
FOUND 7 ERRORS AND 4 WARNINGS AFFECTING 9 LINES
-----------------------------------------------------------------------------------------------------------
50 | WARNING | [ ] Avoid backslash escaping in translatable strings when possible, use "" quotes instead
98 | WARNING | [x] There must be no blank line following an inline comment
157 | WARNING | [ ] Avoid backslash escaping in translatable strings when possible, use "" quotes instead
205 | WARNING | [x] There must be no blank line following an inline comment
360 | ERROR | [ ] Missing short description in doc comment
361 | ERROR | [ ] Missing parameter comment
361 | ERROR | [ ] Missing parameter type
377 | ERROR | [ ] Missing short description in doc comment
378 | ERROR | [ ] Missing parameter comment
378 | ERROR | [ ] Missing parameter type
383 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
-----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

šŸ“Œ Task
Status

Needs review

Version

3.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 !5Coding standard issues - #3473387 ā†’ (Open) created by alyaj2a
  • Issue was unassigned.
  • Status changed to Needs review 3 months ago
  • Status changed to Needs work 3 months ago
  • šŸ‡µšŸ‡­Philippines clarkssquared

    I checked MR !5 and there are PHPCS left in the module after applying it.

    āžœ  fontawesome_menu_icons git:(3.x) curl https://git.drupalcode.org/project/fontawesome_menu_icons/-/merge_requests/5.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  5172    0  5172    0     0   9882      0 --:--:-- --:--:-- --:--:-- 10042
    patching file fontawesome_menu_icons.install
    patching file fontawesome_menu_icons.module
    āžœ  fontawesome_menu_icons git:(3.x) āœ— ..
    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml fontawesome_menu_icons
    
    FILE: .../web/modules/contrib/fontawesome_menu_icons/fontawesome_menu_icons.install
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     18 | ERROR | unserialize() is insecure unless allowed classes are limited. Use
        |       | a safe format like JSON or use the allowed_classes option.
    --------------------------------------------------------------------------------
    
    
    FILE: ...l/web/modules/contrib/fontawesome_menu_icons/fontawesome_menu_icons.module
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
    --------------------------------------------------------------------------------
       9 | ERROR   | [x] Use statements should be sorted alphabetically. The first
         |         |     wrong one is Drupal\Core\Routing\RouteMatchInterface.
      80 | WARNING | [ ] #options values usually have to run through t() for
         |         |     translation
     186 | WARNING | [ ] #options values usually have to run through t() for
         |         |     translation
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    Time: 339ms; Memory: 12MB
    
    āžœ  contrib git:(main) āœ— 
    
  • Assigned to amit.rawat777
  • šŸ‡®šŸ‡³India amit.rawat777

    I am working on it

  • Merge request !6Resolve #3473387 "Phpcs fix" ā†’ (Open) created by amit.rawat777
  • Issue was unassigned.
  • Status changed to Needs review 3 months ago
  • šŸ‡®šŸ‡³India amit.rawat777

    I have resolved the remaining issues.

  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi amit,

    I applied your MR !6 but there's still 1 PHPCS issues that remains

    āžœ  fontawesome_menu_icons git:(3.x) curl https://git.drupalcode.org/project/fontawesome_menu_icons/-/merge_requests/6.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  6611    0  6611    0     0   2710      0 --:--:--  0:00:02 --:--:--  2717
    patching file fontawesome_menu_icons.install
    patching file fontawesome_menu_icons.module
    āžœ  fontawesome_menu_icons git:(3.x) āœ— ..
    āžœ  contrib git:(2.1.x) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml fontawesome_menu_icons
    
    FILE: ...al-issues/drupal-contrib/web/modules/contrib/fontawesome_menu_icons/fontawesome_menu_icons.module
    -------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------
     9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is
       |       |     Drupal\Core\Routing\RouteMatchInterface.
    -------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------
    
    Time: 187ms; Memory: 12MB
    
    āžœ  contrib git:(2.1.x) āœ— 
    
    

    Also try to avoid opening a new Merge Request, let's use the existing Merge Request in the issue.

    Thanks

  • First commit to issue fork.
  • šŸ‡µšŸ‡­Philippines clarkssquared

    I applied MR !6 after commit cae62d5d and I confirmed that all PHPCS issues were fixed.

    āžœ  fontawesome_menu_icons git:(3.x) curl https://git.drupalcode.org/project/fontawesome_menu_icons/-/merge_requests/6.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  6772    0  6772    0     0  13477      0 --:--:-- --:--:-- --:--:-- 13653
    patching file fontawesome_menu_icons.install
    patching file fontawesome_menu_icons.module
    āžœ  fontawesome_menu_icons git:(3.x) āœ— ..
    āžœ  contrib git:(2.1.x) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml fontawesome_menu_icons 
    āžœ  contrib git:(2.1.x) āœ— 
Production build 0.71.5 2024