Drupal Coding Standards Issues | phpcs

Created on 10 February 2023, over 1 year ago
Updated 14 February 2023, over 1 year ago

Problem/Motivation

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/multi_domain_login/css/multi_domain_login.css
---------------------------------------------------------------------------------
FOUND 28 ERRORS AFFECTING 25 LINES
---------------------------------------------------------------------------------
2 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
3 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
4 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
5 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
6 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
7 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
8 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
9 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
10 | ERROR | [x] Blank lines are not allowed in class definitions
11 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
12 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
13 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
14 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
15 | ERROR | [x] Blank lines are not allowed in class definitions
16 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
17 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
21 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
25 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
26 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
27 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
31 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
32 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
36 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
36 | ERROR | [x] Expected 1 space after colon in style definition; 2 found
40 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
40 | ERROR | [x] Expected 1 space after colon in style definition; 2 found
44 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
44 | ERROR | [x] Expected 1 space after colon in style definition; 2 found
---------------------------------------------------------------------------------
PHPCBF CAN FIX THE 28 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/multi_domain_login/multi_domain_login.info.yml
-----------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
-----------------------------------------------------------------------------------------------------------
1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
8 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
9 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
-----------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/multi_domain_login/multi_domain_login.install
---------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
---------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/multi_domain_login/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 6 WARNINGS AFFECTING 6 LINES
----------------------------------------------------------------------
3 | WARNING | Line exceeds 80 characters; contains 116 characters
4 | WARNING | Line exceeds 80 characters; contains 116 characters
10 | WARNING | Line exceeds 80 characters; contains 114 characters
11 | WARNING | Line exceeds 80 characters; contains 86 characters
13 | WARNING | Line exceeds 80 characters; contains 114 characters
38 | WARNING | Line exceeds 80 characters; contains 104 characters
----------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/multi_domain_login/multi_domain_login.module
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 13 ERRORS AND 3 WARNINGS AFFECTING 9 LINES
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
31 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements hook_foo_BAR_ID_bar() for
| | xyz-bar.html.twig.", "* Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates."
31 | ERROR | [x] Function comment short description must start with exactly one space
32 | ERROR | [x] There must be exactly one blank line before the tags in a doc comment
32 | ERROR | [ ] Missing parameter comment
32 | ERROR | [ ] Missing parameter type
33 | ERROR | [ ] Missing parameter comment
33 | ERROR | [ ] Missing parameter type
34 | ERROR | [ ] Missing parameter comment
34 | ERROR | [ ] Missing parameter type
35 | ERROR | [ ] Missing parameter comment
35 | ERROR | [ ] Missing parameter type
36 | ERROR | [x] Separate the @param and @return sections by a blank line.
36 | ERROR | [ ] Description for the @return value is missing
44 | WARNING | [x] A comma should follow the last multiline array item. Found: ''
45 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/multi_domain_login/src/Form/MultiDomainLoginForm.php
---------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 7 WARNINGS AFFECTING 9 LINES
---------------------------------------------------------------------------------------------
8 | ERROR | [x] Missing class doc comment
36 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
43 | WARNING | [x] A comma should follow the last multiline array item. Found: ''
50 | WARNING | [x] A comma should follow the last multiline array item. Found: )
57 | WARNING | [x] A comma should follow the last multiline array item. Found: )
64 | WARNING | [x] A comma should follow the last multiline array item. Found: )
71 | WARNING | [x] A comma should follow the last multiline array item. Found: )
77 | WARNING | [x] A comma should follow the last multiline array item. Found: )
84 | WARNING | [x] A comma should follow the last multiline array item. Found: )
---------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/multi_domain_login/src/Controller/MultiDomainLoginController.php
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 24 ERRORS AND 22 WARNINGS AFFECTING 45 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
8 | WARNING | [x] Unused use statement
13 | WARNING | [x] Unused use statement
15 | WARNING | [x] Unused use statement
18 | WARNING | [x] Unused use statement
19 | WARNING | [x] Unused use statement
43 | WARNING | [ ] Line exceeds 80 characters; contains 89 characters
54 | ERROR | [x] Additional blank lines found at end of doc comment
70 | ERROR | [x] Additional blank lines found at end of doc comment
89 | ERROR | [x] You must use "/**" style comments for a function comment
90 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
95 | ERROR | [x] Equals sign not aligned correctly; expected 1 space but found 2 spaces
96 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
100 | ERROR | [x] Language constructs must be followed by a single space; expected 1 space but found "ยทยท"
103 | WARNING | [ ] Line exceeds 80 characters; contains 96 characters
105 | ERROR | [x] You must use "/**" style comments for a function comment
106 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
115 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
123 | ERROR | [x] You must use "/**" style comments for a function comment
128 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
129 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
137 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
148 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
151 | WARNING | [ ] Line exceeds 80 characters; contains 83 characters
155 | WARNING | [x] There must be no blank line following an inline comment
155 | WARNING | [ ] There must be no blank line following an inline comment
165 | WARNING | [x] A comma should follow the last multiline array item. Found: $hash
167 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
170 | WARNING | [ ] Line exceeds 80 characters; contains 83 characters
175 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
180 | ERROR | [x] Missing function doc comment
197 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
200 | ERROR | [x] Expected 1 blank line after function; 3 found
203 | ERROR | [ ] More than 2 empty lines are not allowed
207 | ERROR | [ ] Description for the @return value is missing
212 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
216 | ERROR | [x] Missing function doc comment
219 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
234 | ERROR | [ ] The array declaration extends to column 121 (the limit is 80). The array content should be split up over multiple lines
238 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
242 | ERROR | [ ] The array declaration extends to column 112 (the limit is 80). The array content should be split up over multiple lines
245 | ERROR | [x] Use "elseif" in place of "else if"
272 | ERROR | [x] Missing function doc comment
279 | ERROR | [x] Missing function doc comment
281 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
287 | ERROR | [x] Expected 1 blank line after function; 0 found
288 | ERROR | [x] The closing brace for the class must have an empty line before it
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 27 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/multi_domain_login/src/EventSubscriber/UserLoginSubscriber.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 13 ERRORS AND 1 WARNING AFFECTING 10 LINES
-------------------------------------------------------------------------------------------------------------------------------------------
16 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
19 | ERROR | [x] The open comment tag must be the only content on the line
19 | ERROR | [ ] Missing short description in doc comment
19 | ERROR | [x] Do not append variable name "$languageManager" to the type declaration in a member variable comment
22 | ERROR | [x] The open comment tag must be the only content on the line
22 | ERROR | [ ] Missing short description in doc comment
22 | ERROR | [x] Do not append variable name "$routeMatch" to the type declaration in a member variable comment
25 | ERROR | [ ] Missing short description in doc comment
26 | ERROR | [x] Do not append variable name "$requestStack" to the type declaration in a member variable comment
30 | ERROR | [ ] Parameter $requestStack is not described in comment
33 | ERROR | [ ] Missing parameter comment
34 | ERROR | [ ] Missing parameter comment
57 | ERROR | [x] Data types in @param tags need to be fully namespaced
64 | ERROR | [ ] The array declaration extends to column 98 (the limit is 80). The array content should be split up over multiple lines
-------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------

Time: 2.03 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/multi_domain_login/

Proposed resolution

Above error/warnings need to be fixed.

๐Ÿ“Œ Task
Status

Fixed

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