Drupal Coding Standards Issues | phpcs

Created on 10 January 2023, over 1 year ago
Updated 24 January 2023, over 1 year ago

Problem/Motivation

Getting following error/warnings
FILE: /var/www/html/modules/contrib/spamaway/spamaway.install
------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 2 WARNINGS AFFECTING 6 LINES
------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
66 | WARNING | [x] A comma should follow the last multiline array item. Found: 'field_name'
67 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
73 | ERROR | [x] Missing function doc comment
76 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
89 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/spamaway/src/Plugin/WebformHandler/AntiSpamHandler.php
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 39 ERRORS AND 13 WARNINGS AFFECTING 47 LINES
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
13 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
15 | WARNING | [ ] Line exceeds 80 characters; contains 98 characters
31 | ERROR | [ ] Missing short description in doc comment
32 | ERROR | [x] Do not append variable name "$connection" to the type declaration in a member variable comment
74 | WARNING | [ ] Avoid backslash escaping in translatable strings when possible, use "" quotes instead
76 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
84 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
93 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
102 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
110 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
119 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
127 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
135 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
142 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
150 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
184 | WARNING | [x] A comma should follow the last multiline array item. Found: )
199 | WARNING | [x] A comma should follow the last multiline array item. Found: $value
218 | ERROR | [ ] Parameter $string is not described in comment
221 | ERROR | [ ] Missing parameter comment
222 | ERROR | [ ] Missing parameter comment
222 | ERROR | [ ] Doc comment for parameter $array does not match actual variable name $string
224 | ERROR | [ ] Description for the @return value is missing
233 | ERROR | [ ] Description for the @return value is missing
245 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
256 | ERROR | [x] Missing function doc comment
260 | ERROR | [x] Missing function doc comment
264 | ERROR | [x] Missing function doc comment
268 | ERROR | [x] Missing function doc comment
269 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
289 | ERROR | [x] No space found before comment text; expected "// return;" but found "//return;"
289 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
292 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
297 | ERROR | [x] No space found before comment text; expected "// //////////////////////////////////////////////////////////////////////////" but found
| | "////////////////////////////////////////////////////////////////////////////"
306 | ERROR | [x] Expected newline after closing brace
312 | ERROR | [x] Missing function doc comment
325 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
342 | ERROR | [x] No space found before comment text; expected "// //////////////////////////////////////////////////////////////////////////" but found
| | "////////////////////////////////////////////////////////////////////////////"
343 | WARNING | [x] There must be no blank line following an inline comment
343 | WARNING | [ ] There must be no blank line following an inline comment
403 | WARNING | [x] A comma should follow the last multiline array item. Found: $precentage
423 | ERROR | [x] No space found before comment text; expected "// //////////////////////////////////////////////////////////////////////////" but found
| | "////////////////////////////////////////////////////////////////////////////"
424 | WARNING | [x] There must be no blank line following an inline comment
424 | WARNING | [ ] There must be no blank line following an inline comment
437 | ERROR | [x] Inline comments must start with a capital letter
440 | ERROR | [x] Inline comments must start with a capital letter
443 | ERROR | [x] Inline comments must start with a capital letter
449 | ERROR | [x] Inline comments must start with a capital letter
458 | ERROR | [x] Expected 1 space before "!="; 0 found
458 | ERROR | [x] Expected 1 space after "!="; 0 found
479 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
487 | ERROR | [x] Missing function doc comment
488 | WARNING | [ ] Line exceeds 80 characters; contains 84 characters
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 39 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Time: 3.31 secs; Memory: 8MB

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/spamaway/

Proposed resolution

Above error/warnings need to be fixed

๐Ÿ› Bug report
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.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024