Drupal Coding Standards Issues | phpcs

Created on 17 February 2023, over 1 year ago

Problem/Motivation

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/add_content_modal/add_content_modal.module
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 18 ERRORS AND 3 WARNINGS AFFECTING 16 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
63 | WARNING | [ ] Line exceeds 80 characters; contains 83 characters
65 | WARNING | [ ] Line exceeds 80 characters; contains 112 characters
65 | ERROR | [ ] Comment indentation error, expected only 1 spaces
72 | ERROR | [ ] Missing parameter comment
73 | ERROR | [ ] Missing parameter comment
75 | ERROR | [ ] Description for the @return value is missing
77 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
81 | ERROR | [x] Space found before square bracket; expected "][" but found "] ["
155 | WARNING | [x] A comma should follow the last multiline array item. Found: 'entity.node.canonical'
236 | ERROR | [x] Each PHP statement must be on a line by itself
244 | ERROR | [ ] Missing parameter comment
244 | ERROR | [ ] Missing parameter type
246 | ERROR | [ ] @return doc comment specified, but function has no return statement
246 | ERROR | [ ] Description for the @return value is missing
263 | ERROR | [x] Array indentation error, expected 8 spaces but found 9
312 | ERROR | [ ] Missing parameter comment
312 | ERROR | [ ] Missing parameter type
313 | ERROR | [ ] Missing parameter comment
313 | ERROR | [ ] Missing parameter type
315 | ERROR | [ ] Description for the @return value is missing
317 | ERROR | [ ] Invalid function name, expected _add_content_modal_process_node_x_form but found _add_content_modal_process_node_X_form
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/add_content_modal/src/Form/SettingsForm.php
-----------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 15 ERRORS AND 3 WARNINGS AFFECTING 12 LINES
-----------------------------------------------------------------------------------------------------------------------------------------------------------
74 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
74 | ERROR | [x] 4 spaces found before inline comment; expected "// $form['allowed_operations'] = [" but found "// $form['allowed_operations'] = ["
75 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
75 | ERROR | [ ] Comment indentation error, expected only 4 spaces
76 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
77 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
78 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
78 | ERROR | [ ] Comment indentation error, expected only 6 spaces
79 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
80 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
81 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
82 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
83 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
84 | WARNING | [x] There must be no blank line following an inline comment
84 | WARNING | [ ] There must be no blank line following an inline comment
84 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
134 | WARNING | [ ] Line exceeds 80 characters; contains 95 characters
134 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
-----------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 14 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/add_content_modal/src/Controller/ModalController.php
----------------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
----------------------------------------------------------------------------------------
7 | ERROR | [x] Doc comment short description must end with a full stop
10 | ERROR | [x] PHP keywords must be lowercase; expected "use" but found "Use"
14 | ERROR | [x] Missing class doc comment
19 | ERROR | [ ] Description for the @return value is missing
21 | ERROR | [x] Expected 1 space before opening brace; found 0
----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/add_content_modal/src/Controller/DialogController.php
-----------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-----------------------------------------------------------------------------------------
7 | ERROR | [x] Doc comment short description must end with a full stop
16 | ERROR | [x] Missing class doc comment
21 | ERROR | [ ] Description for the @return value is missing
-----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------

Time: 1.21 secs; Memory: 6MB

Steps to reproduce

Run following command

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

Proposed resolution

Above error/warnings need to be fixed.

๐Ÿ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia samit.310@gmail.com

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

Comments & Activities

Production build 0.69.0 2024