Coding Standards

Created on 29 November 2018, over 5 years ago
Updated 26 February 2024, 4 months ago

Make sure the module follows Drupal coding standards.

Command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml

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

FILE: /home/administrator/Projects/contribution/clamav/clamav.module
--------------------------------------------------------------------------------
FOUND 7 ERRORS AND 1 WARNING AFFECTING 8 LINES
--------------------------------------------------------------------------------
  1 | ERROR   | [x] The PHP open tag must be followed by exactly one blank line
  8 | WARNING | [x] Unused use statement
 24 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced
    |         |     with use statements
 25 | ERROR   | [x] Short array syntax must be used to define arrays
 38 | ERROR   | [x] Short array syntax must be used to define arrays
 50 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks,
    |         |     question marks, colons, or closing parentheses
 59 | ERROR   | [x] Equals sign not aligned with surrounding assignments;
    |         |     expected 1 space but found 2 spaces
 60 | ERROR   | [x] Short array syntax must be used to define arrays
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: /home/administrator/Projects/contribution/clamav/clamav.install
--------------------------------------------------------------------------------
FOUND 8 ERRORS AND 2 WARNINGS AFFECTING 9 LINES
--------------------------------------------------------------------------------
  9 | ERROR   | [x] There must be one blank line after the last USE statement;
    |         |     2 found;
 15 | ERROR   | [x] Expected 1 blank line before function; 2 found
 16 | ERROR   | [x] Short array syntax must be used to define arrays
 17 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks,
    |         |     question marks, colons, or closing parentheses
 19 | ERROR   | [x] Calling class constructors must always include parentheses
 23 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced
    |         |     with use statements
 27 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced
    |         |     with use statements
 31 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced
    |         |     with use statements
 61 | WARNING | [x] '@TODO: how to port D7 config to D8?' should match the
    |         |     format '@todo Fix problem X here.'
 61 | WARNING | [ ] There must be no blank line following an inline comment
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: /home/administrator/Projects/contribution/clamav/clamav.api.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 63 | ERROR | [x] list(...) is forbidden, use [...] instead.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: /home/administrator/Projects/contribution/clamav/src/ScannerInterface.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
--------------------------------------------------------------------------------
  6 | WARNING | [x] Unused use statement
 40 | ERROR   | [x] Expected 1 blank line after function; 0 found
 41 | ERROR   | [x] The closing brace for the interface must have an empty line
    |         |     before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...ome/administrator/Projects/contribution/clamav/src/Scanner/DaemonTCPIP.php
--------------------------------------------------------------------------------
FOUND 16 ERRORS AND 4 WARNINGS AFFECTING 10 LINES
--------------------------------------------------------------------------------
 10 | ERROR   | [x] Missing class doc comment
 11 | WARNING | [ ] Property name "$_file" should not be prefixed with an
    |         |     underscore to indicate visibility
 11 | ERROR   | [ ] Missing member variable doc comment
 11 | ERROR   | [ ] Class property $_file should use lowerCamel naming without
    |         |     underscores
 12 | WARNING | [ ] Property name "$_hostname" should not be prefixed with an
    |         |     underscore to indicate visibility
 12 | ERROR   | [ ] Missing member variable doc comment
 12 | ERROR   | [ ] Class property $_hostname should use lowerCamel naming
    |         |     without underscores
 13 | WARNING | [ ] Property name "$_port" should not be prefixed with an
    |         |     underscore to indicate visibility
 13 | ERROR   | [ ] Missing member variable doc comment
 13 | ERROR   | [ ] Class property $_port should use lowerCamel naming without
    |         |     underscores
 14 | WARNING | [ ] Property name "$_virus_name" should not be prefixed with an
    |         |     underscore to indicate visibility
 14 | ERROR   | [ ] Missing member variable doc comment
 14 | ERROR   | [ ] Class property $_virus_name should use lowerCamel naming
    |         |     without underscores
 34 | ERROR   | [x] Short array syntax must be used to define arrays
 34 | ERROR   | [ ] The array declaration extends to column 169 (the limit is
    |         |     80). The array content should be split up over multiple
    |         |     lines
 76 | ERROR   | [ ] Public method name "DaemonTCPIP::virus_name" is not in
    |         |     lowerCamel format
 86 | ERROR   | [x] Short array syntax must be used to define arrays
 86 | ERROR   | [ ] The array declaration extends to column 169 (the limit is
    |         |     80). The array content should be split up over multiple
    |         |     lines
 94 | ERROR   | [x] Expected 1 blank line after function; 0 found
 95 | ERROR   | [x] The closing brace for the class must have an empty line
    |         |     before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...dministrator/Projects/contribution/clamav/src/Scanner/DaemonUnixSocket.php
--------------------------------------------------------------------------------
FOUND 12 ERRORS AND 3 WARNINGS AFFECTING 9 LINES
--------------------------------------------------------------------------------
 10 | ERROR   | [x] Missing class doc comment
 11 | WARNING | [ ] Property name "$_file" should not be prefixed with an
    |         |     underscore to indicate visibility
 11 | ERROR   | [ ] Missing member variable doc comment
 11 | ERROR   | [ ] Class property $_file should use lowerCamel naming without
    |         |     underscores
 12 | WARNING | [ ] Property name "$_unix_socket" should not be prefixed with
    |         |     an underscore to indicate visibility
 12 | ERROR   | [ ] Missing member variable doc comment
 12 | ERROR   | [ ] Class property $_unix_socket should use lowerCamel naming
    |         |     without underscores
 13 | WARNING | [ ] Property name "$_virus_name" should not be prefixed with an
    |         |     underscore to indicate visibility
 13 | ERROR   | [ ] Missing member variable doc comment
 13 | ERROR   | [ ] Class property $_virus_name should use lowerCamel naming
    |         |     without underscores
 32 | ERROR   | [x] Short array syntax must be used to define arrays
 68 | ERROR   | [ ] Public method name "DaemonUnixSocket::virus_name" is not in
    |         |     lowerCamel format
 78 | ERROR   | [x] Short array syntax must be used to define arrays
 86 | ERROR   | [x] Expected 1 blank line after function; 0 found
 87 | ERROR   | [x] The closing brace for the class must have an empty line
    |         |     before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...home/administrator/Projects/contribution/clamav/src/Scanner/Executable.php
--------------------------------------------------------------------------------
FOUND 25 ERRORS AND 13 WARNINGS AFFECTING 18 LINES
--------------------------------------------------------------------------------
 10 | ERROR   | [x] Missing class doc comment
 11 | WARNING | [ ] Property name "$_executable_path" should not be prefixed
    |         |     with an underscore to indicate visibility
 11 | ERROR   | [ ] Missing member variable doc comment
 11 | ERROR   | [ ] Class property $_executable_path should use lowerCamel
    |         |     naming without underscores
 12 | WARNING | [ ] Property name "$_executable_parameters" should not be
    |         |     prefixed with an underscore to indicate visibility
 12 | ERROR   | [ ] Missing member variable doc comment
 12 | ERROR   | [ ] Class property $_executable_parameters should use
    |         |     lowerCamel naming without underscores
 13 | WARNING | [ ] Property name "$_file" should not be prefixed with an
    |         |     underscore to indicate visibility
 13 | ERROR   | [ ] Missing member variable doc comment
 13 | ERROR   | [ ] Class property $_file should use lowerCamel naming without
    |         |     underscores
 14 | WARNING | [ ] Property name "$_virus_name" should not be prefixed with an
    |         |     underscore to indicate visibility
 14 | ERROR   | [ ] Missing member variable doc comment
 14 | ERROR   | [ ] Class property $_virus_name should use lowerCamel naming
    |         |     without underscores
 30 | ERROR   | [x] Short array syntax must be used to define arrays
 34 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
 40 | WARNING | [x] There must be no blank line following an inline comment
 40 | WARNING | [ ] There must be no blank line following an inline comment
 45 | WARNING | [x] There must be no blank line following an inline comment
 45 | WARNING | [ ] There must be no blank line following an inline comment
 52 | ERROR   | [x] Functions must not contain multiple empty lines in a row;
    |         |     found 2 empty lines
 56 | ERROR   | [x] Case breaking statements must be followed by a single blank
    |         |     line
 57 | WARNING | [x] There must be no blank line following an inline comment
 57 | WARNING | [ ] There must be no blank line following an inline comment
 57 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
 57 | ERROR   | [x] Inline comments must start with a capital letter
 57 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks,
    |         |     question marks, colons, or closing parentheses
 60 | ERROR   | [x] Case breaking statements must be followed by a single blank
    |         |     line
 61 | WARNING | [x] There must be no blank line following an inline comment
 61 | WARNING | [ ] There must be no blank line following an inline comment
 61 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
 61 | ERROR   | [x] Inline comments must start with a capital letter
 61 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks,
    |         |     question marks, colons, or closing parentheses
 65 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
 65 | ERROR   | [x] Inline comments must start with a capital letter
 65 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks,
    |         |     question marks, colons, or closing parentheses
 72 | ERROR   | [ ] Public method name "Executable::virus_name" is not in
    |         |     lowerCamel format
 86 | ERROR   | [x] Expected 1 blank line after function; 0 found
 87 | ERROR   | [x] The closing brace for the class must have an empty line
    |         |     before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 20 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...e/administrator/Projects/contribution/clamav/src/Form/ClamAVConfigForm.php
--------------------------------------------------------------------------------
FOUND 54 ERRORS AND 11 WARNINGS AFFECTING 60 LINES
--------------------------------------------------------------------------------
  12 | WARNING | [x] Unused use statement
  39 | ERROR   | [x] Short array syntax must be used to define arrays
  45 | ERROR   | [x] Short array syntax must be used to define arrays
  50 | ERROR   | [x] Short array syntax must be used to define arrays
  53 | ERROR   | [x] Short array syntax must be used to define arrays
  56 | WARNING | [x] A comma should follow the last multiline array item.
     |         |     Found: )
  61 | ERROR   | [x] Functions must not contain multiple empty lines in a row;
     |         |     found 3 empty lines
  63 | ERROR   | [ ] More than 2 empty lines are not allowed
  65 | ERROR   | [x] Short array syntax must be used to define arrays
  69 | ERROR   | [x] Short array syntax must be used to define arrays
  70 | ERROR   | [x] Short array syntax must be used to define arrays
  71 | ERROR   | [x] Short array syntax must be used to define arrays
  75 | ERROR   | [x] Short array syntax must be used to define arrays
  80 | WARNING | [ ] Line exceeds 80 characters; contains 141 characters
  82 | ERROR   | [x] Short array syntax must be used to define arrays
  87 | ERROR   | [x] Short array syntax must be used to define arrays
  89 | ERROR   | [x] Functions must not contain multiple empty lines in a row;
     |         |     found 2 empty lines
  92 | ERROR   | [x] Short array syntax must be used to define arrays
  96 | ERROR   | [x] Short array syntax must be used to define arrays
  97 | ERROR   | [x] Short array syntax must be used to define arrays
  98 | ERROR   | [x] Short array syntax must be used to define arrays
 102 | ERROR   | [x] Short array syntax must be used to define arrays
 107 | WARNING | [ ] Line exceeds 80 characters; contains 142 characters
 109 | ERROR   | [x] Short array syntax must be used to define arrays
 115 | WARNING | [ ] Line exceeds 80 characters; contains 174 characters
 117 | ERROR   | [x] Functions must not contain multiple empty lines in a row;
     |         |     found 2 empty lines
 120 | ERROR   | [x] Short array syntax must be used to define arrays
 124 | ERROR   | [x] Short array syntax must be used to define arrays
 125 | ERROR   | [x] Short array syntax must be used to define arrays
 126 | ERROR   | [x] Short array syntax must be used to define arrays
 130 | ERROR   | [x] Short array syntax must be used to define arrays
 135 | WARNING | [ ] Line exceeds 80 characters; contains 161 characters
 138 | ERROR   | [x] Short array syntax must be used to define arrays
 143 | ERROR   | [x] Short array syntax must be used to define arrays
 146 | ERROR   | [x] Short array syntax must be used to define arrays
 152 | ERROR   | [x] Functions must not contain multiple empty lines in a row;
     |         |     found 2 empty lines
 155 | ERROR   | [x] Short array syntax must be used to define arrays
 160 | ERROR   | [x] Short array syntax must be used to define arrays
 160 | WARNING | [ ] t() calls should be avoided in classes, use
     |         |     \Drupal\Core\StringTranslation\StringTranslationTrait and
     |         |     $this->t() instead
 167 | ERROR   | [x] Short array syntax must be used to define arrays
 175 | ERROR   | [x] Short array syntax must be used to define arrays
 182 | ERROR   | [x] Functions must not contain multiple empty lines in a row;
     |         |     found 2 empty lines
 184 | ERROR   | [x] Short array syntax must be used to define arrays
 189 | ERROR   | [x] Short array syntax must be used to define arrays
 202 | WARNING | [ ] Possible useless method overriding detected
 208 | WARNING | [x] There must be no blank line following an inline comment
 208 | WARNING | [ ] There must be no blank line following an inline comment
 209 | ERROR   | [x] Whitespace found at end of line
 221 | ERROR   | [x] Short array syntax must be used to define arrays
 222 | ERROR   | [x] Equals sign not aligned with surrounding assignments;
     |         |     expected 1 space but found 2 spaces
 224 | ERROR   | [x] Short array syntax must be used to define arrays
 226 | ERROR   | [x] Expected 1 space after comma in argument list; 2 found
 226 | ERROR   | [x] Expected one space after the comma, 2 found
 252 | ERROR   | [ ] Doc comment short description must be on a single line,
     |         |     further text should be a separate paragraph
 262 | ERROR   | [ ] Public method name
     |         |     "ClamAVConfigForm::scheme_wrappers_available" is not in
     |         |     lowerCamel format
 263 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
     |         |     injection instead
 278 | ERROR   | [x] Short array syntax must be used to define arrays
 287 | ERROR   | [ ] Doc comment short description must be on a single line,
     |         |     further text should be a separate paragraph
 297 | ERROR   | [ ] Public method name
     |         |     "ClamAVConfigForm::scheme_wrappers_to_scan" is not in
     |         |     lowerCamel format
 308 | ERROR   | [x] Short array syntax must be used to define arrays
 308 | ERROR   | [ ] The array declaration extends to column 86 (the limit is
     |         |     80). The array content should be split up over multiple
     |         |     lines
 323 | ERROR   | [ ] Type hint "array" missing for $schemes_to_scan
 323 | ERROR   | [ ] Public method name
     |         |     "ClamAVConfigForm::get_overridden_schemes" is not in
     |         |     lowerCamel format
 334 | ERROR   | [x] Expected 1 blank line after function; 0 found
 335 | ERROR   | [x] The closing brace for the class must have an empty line
     |         |     before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 49 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: /home/administrator/Projects/contribution/clamav/src/Scanner.php
--------------------------------------------------------------------------------
FOUND 33 ERRORS AND 12 WARNINGS AFFECTING 40 LINES
--------------------------------------------------------------------------------
   5 | WARNING | [x] Unused use statement
   8 | WARNING | [x] Unused use statement
  30 | ERROR   | [x] You must use "/**" style comments for a member variable
     |         |     comment
  33 | ERROR   | [x] You must use "/**" style comments for a member variable
     |         |     comment
  41 | ERROR   | [ ] Unknown type hint "\Drupal\clamav\Config" found for
     |         |     $config
  41 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced
     |         |     with use statements
  46 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced
     |         |     with use statements
  50 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced
     |         |     with use statements
  54 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced
     |         |     with use statements
  62 | ERROR   | [x] Expected "bool" but found "boolean" for function return
     |         |     type
  72 | ERROR   | [x] Expected "bool" but found "boolean" for function return
     |         |     type
  73 | ERROR   | [x] Return comment indentation must be 3 spaces, found 4
     |         |     spaces
  82 | ERROR   | [x] Expected "bool" but found "boolean" for function return
     |         |     type
  83 | ERROR   | [x] Return comment indentation must be 3 spaces, found 4
     |         |     spaces
  87 | ERROR   | [x] Expected 1 blank line after function; 2 found
  97 | ERROR   | [x] Doc comment long description must end with a full stop
 102 | ERROR   | [x] Trailing punctuation for @see references is not allowed.
 104 | ERROR   | [x] Expected "bool" but found "boolean" for function return
     |         |     type
 105 | ERROR   | [x] Return comment indentation must be 3 spaces, found 4
     |         |     spaces
 109 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 110 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
 110 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
     |         |     injection instead
 111 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 112 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 113 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
 113 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
     |         |     injection instead
 114 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 121 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
     |         |     injection instead
 122 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
     |         |     injection instead
 124 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 10
 126 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 10
 127 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
 127 | ERROR   | [x] Closing brace indented incorrectly; expected 6 spaces,
     |         |     found 8
 131 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
     |         |     injection instead
 132 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
     |         |     injection instead
 132 | ERROR   | [x] Short array syntax must be used to define arrays
 140 | ERROR   | [x] Expected 1 blank line after function; 2 found
 168 | ERROR   | [x] Short array syntax must be used to define arrays
 177 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
     |         |     injection instead
 184 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
     |         |     injection instead
 192 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
     |         |     injection instead
 196 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
     |         |     injection instead
 220 | ERROR   | [x] Expected "bool" but found "boolean" for function return
     |         |     type
 239 | ERROR   | [x] Expected 1 blank line after function; 0 found
 240 | ERROR   | [x] The closing brace for the class must have an empty line
     |         |     before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 34 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: /home/administrator/Projects/contribution/clamav/src/Config.php
--------------------------------------------------------------------------------
FOUND 17 ERRORS AND 2 WARNINGS AFFECTING 13 LINES
--------------------------------------------------------------------------------
  3 | ERROR   | [x] There must be one blank line after the namespace
    |         |     declaration
  6 | ERROR   | [x] Missing class doc comment
  6 | ERROR   | [x] Expected 1 space after class name; 2 found
  6 | ERROR   | [x] Expected 1 space before opening brace; found 2
 15 | WARNING | [ ] Property name "$_config" should not be prefixed with an
    |         |     underscore to indicate visibility
 15 | ERROR   | [x] You must use "/**" style comments for a member variable
    |         |     comment
 15 | ERROR   | [ ] Class property $_config should use lowerCamel naming
    |         |     without underscores
 23 | ERROR   | [x] Expected 1 blank line before function; 2 found
 24 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
    |         |     injection instead
 28 | ERROR   | [x] You must use "/**" style comments for a function comment
 30 | ERROR   | [x] Expected 1 blank line after function; 0 found
 31 | ERROR   | [x] Missing function doc comment
 31 | ERROR   | [ ] Public method name "Config::scan_mode" is not in lowerCamel
    |         |     format
 33 | ERROR   | [x] Expected 1 blank line after function; 0 found
 34 | ERROR   | [x] Missing function doc comment
 34 | ERROR   | [ ] Public method name "Config::outage_action" is not in
    |         |     lowerCamel format
 36 | ERROR   | [x] Expected 1 blank line after function; 0 found
 37 | ERROR   | [x] Missing function doc comment
 41 | ERROR   | [x] Missing function doc comment
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 14 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 132ms; Memory: 12MB
📌 Task
Status

Closed: won't fix

Version

2.0

Component

Code

Created by

🇧🇷Brazil leopaccanaro

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

Merge Requests

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