Problem/Motivation
When running the module code against Drupal coding standards based on Drupal standard, the module shows errors
Steps to reproduce
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,yml modules/contrib/backup_migrate_backbeaver
Report:
FILE: /home/contribution/drupal/web/modules/contrib/backup_migrate_backbeaver/backup_migrate_backbeaver.services.yml
---------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------
12 | ERROR | [x] Expected 1 newline at end of file; 2 found
---------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------
FILE: /home/contribution/drupal/web/modules/contrib/backup_migrate_backbeaver/src/Controller/BackBeaverBackupController.php
----------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------------------------------------------------------------
45 | ERROR | [x] Expected 1 blank line after function; 0 found
46 | ERROR | [x] The closing brace for the class must have an empty line before it
----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------
FILE: /home/contribution/drupal/web/modules/contrib/backup_migrate_backbeaver/src/Routing/BackBeaverRouteSubscriber.php
------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------
22 | ERROR | [x] Expected 1 blank line after function; 0 found
23 | ERROR | [x] The closing brace for the class must have an empty line before it
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------
FILE: /home/contribution/drupal/web/modules/contrib/backup_migrate_backbeaver/src/BackBeaverClient.php
------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 88 ERRORS AND 16 WARNINGS AFFECTING 66 LINES
------------------------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
2 | WARNING | [x] There must be no blank line following an inline comment
2 | WARNING | [ ] There must be no blank line following an inline comment
2 | ERROR | [ ] Namespaced classes, interfaces and traits should not begin with a file doc comment
2 | ERROR | [x] No space found before comment text; expected "// Class that connects to the BackBeaver JSON API." but found "//Class that connects to
| | the BackBeaver JSON API."
7 | WARNING | [x] Unused use statement
10 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
12 | ERROR | [x] Missing class doc comment
12 | ERROR | [x] Expected 1 space before opening brace; found 0
13 | ERROR | [ ] Missing short description in doc comment
18 | ERROR | [ ] Missing short description in doc comment
27 | ERROR | [ ] Missing parameter comment
27 | ERROR | [x] Missing parameter type
31 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
36 | ERROR | [x] Doc comment short description must end with a full stop
38 | ERROR | [x] Expected 1 space before opening brace; found 0
39 | ERROR | [x] Expected 1 space before "="; 0 found
39 | ERROR | [x] Expected 1 space after "="; 0 found
50 | ERROR | [x] Doc comment short description must end with a full stop
53 | ERROR | [x] No space found before comment text; expected "// @todo get API key in constructor from entity storage?" but found "//@todo get API key
| | in constructor from entity storage?"
59 | ERROR | [x] Doc comment short description must end with a full stop
60 | ERROR | [x] There must be exactly one blank line before the tags in a doc comment
60 | ERROR | [ ] Description for the @return value is missing
62 | ERROR | [x] Incorrect spacing between argument "$page" and equals sign; expected 1 but found 0
62 | ERROR | [x] Incorrect spacing between default value and equals sign for argument "$page"; expected 1 but found 0
62 | ERROR | [x] Incorrect spacing between argument "$limit" and equals sign; expected 1 but found 0
62 | ERROR | [x] Incorrect spacing between default value and equals sign for argument "$limit"; expected 1 but found 0
62 | ERROR | [x] Incorrect spacing between argument "$sortBy" and equals sign; expected 1 but found 0
62 | ERROR | [x] Incorrect spacing between default value and equals sign for argument "$sortBy"; expected 1 but found 0
62 | ERROR | [x] Incorrect spacing between argument "$orderBy" and equals sign; expected 1 but found 0
62 | ERROR | [x] Incorrect spacing between default value and equals sign for argument "$orderBy"; expected 1 but found 0
63 | ERROR | [x] Expected 1 space after TRY keyword; 0 found
64 | ERROR | [x] Expected one space after the comma, 0 found
65 | ERROR | [x] Array indentation error, expected 8 spaces but found 10
65 | ERROR | [x] Expected 1 space after "=>"; 0 found
65 | ERROR | [x] Comma not allowed after last value in single-line array declaration
65 | ERROR | [x] There should be no white space before a closing "]"
66 | ERROR | [x] Array indentation error, expected 8 spaces but found 10
72 | ERROR | [x] Array closing indentation error, expected 6 spaces but found 8
73 | ERROR | [x] Expected 1 space after IF keyword; 0 found
75 | ERROR | [x] Expected 1 space after IF keyword; 0 found
82 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
88 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
89 | WARNING | [ ] '@todo' should match the format '@todo Fix problem X here.'
89 | ERROR | [x] No space found before comment text; expected "// @todo" but found "//@todo"
90 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
98 | ERROR | [x] Doc comment short description must end with a full stop
100 | ERROR | [ ] Missing parameter comment
102 | ERROR | [x] Expected "bool" but found "boolean" for function return type
102 | ERROR | [ ] Description for the @return value is missing
105 | ERROR | [x] Expected 1 space after TRY keyword; 0 found
106 | ERROR | [x] Concat operator must be surrounded by a single space
106 | ERROR | [x] There should be no white space after an opening "["
106 | ERROR | [x] Expected 1 space between double arrow and "["; 0 found
106 | ERROR | [x] Expected 1 space after "=>"; 0 found
108 | WARNING | [x] '@todo: check response and return TRUE if file was deleted' should match the format '@todo Fix problem X here.'
108 | ERROR | [x] No space found before comment text; expected "// @todo: check response and return TRUE if file was deleted" but found "//@todo: check
| | response and return TRUE if file was deleted"
109 | ERROR | [x] Expected 1 space after IF keyword; 0 found
112 | ERROR | [x] No space found before comment text; expected "// Something went wrong" but found "//Something went wrong"
112 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
113 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
113 | ERROR | [x] Expected 1 space between double arrow and "$response"; 0 found
113 | ERROR | [x] Expected 1 space after "=>"; 0 found
117 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
123 | ERROR | [x] Doc comment short description must end with a full stop
125 | ERROR | [ ] Missing parameter comment
127 | ERROR | [x] Expected "file" but found "$file" for function return type
127 | ERROR | [ ] Description for the @return value is missing
130 | ERROR | [x] Expected 1 space after TRY keyword; 0 found
131 | ERROR | [x] Concat operator must be surrounded by a single space
132 | ERROR | [x] Expected 1 space after "=>"; 0 found
134 | ERROR | [x] Array closing indentation error, expected 6 spaces but found 8
138 | WARNING | [x] '@todo: error handling' should match the format '@todo Fix problem X here.'
138 | ERROR | [x] No space found before comment text; expected "// @todo: error handling" but found "//@todo: error handling"
140 | WARNING | [ ] Unused variable $responseBodyAsString.
144 | ERROR | [ ] Parameter $fileloc is not described in comment
144 | ERROR | [ ] Parameter $filename is not described in comment
145 | ERROR | [x] Doc comment short description must end with a full stop
147 | ERROR | [ ] Missing parameter comment
147 | ERROR | [ ] Doc comment for parameter $file does not match actual variable name $filename
150 | ERROR | [x] Additional blank lines found at end of doc comment
152 | ERROR | [x] Comments may not appear after statements
152 | ERROR | [x] Inline comments must start with a capital letter
152 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
153 | WARNING | [x] '@todo: replace with Commercial API' should match the format '@todo Fix problem X here.'
153 | ERROR | [x] No space found before comment text; expected "// @todo: replace with Commercial API" but found "//@todo: replace with Commercial API"
155 | ERROR | [x] Comments may not appear after statements
155 | ERROR | [x] No space found before comment text; expected "// STORE THIS ID FOR LATER POSSIBLE RESUME OF REQUEST." but found "//STORE THIS ID FOR
| | LATER POSSIBLE RESUME OF REQUEST."
157 | WARNING | [x] A comma should follow the last multiline array item. Found: apiKey
160 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
164 | WARNING | [ ] Line exceeds 80 characters; contains 122 characters
164 | ERROR | [x] Comments may not appear after statements
166 | ERROR | [x] Expected 1 space after IF keyword; 0 found
166 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
169 | ERROR | [x] Expected 1 space before "="; 0 found
169 | ERROR | [x] Expected 1 space after "="; 0 found
170 | ERROR | [x] Expected 1 space after WHILE keyword; 0 found
174 | ERROR | [x] No space found before comment text; expected "// $client->delete();" but found "//$client->delete();"
175 | ERROR | [x] Expected newline after closing brace
175 | ERROR | [x] Expected 1 space after "|"; 2 found
176 | ERROR | [x] No space found before comment text; expected "// @todo do something with exception" but found "//@todo do something with exception"
177 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
179 | ERROR | [x] Expected 1 blank line after function; 0 found
180 | ERROR | [x] The closing brace for the class must have an empty line before it
------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 82 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------------------------
FILE: /home/contribution/drupal/web/modules/contrib/backup_migrate_backbeaver/src/Destination/BackBeaverDestination.php
------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 78 ERRORS AND 18 WARNINGS AFFECTING 63 LINES
------------------------------------------------------------------------------------------------------------------------------------------------------------
3 | ERROR | [x] There must be one blank line after the namespace declaration
9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is
| | Drupal\backup_migrate\Core\Destination\ListableDestinationInterface.
19 | WARNING | [x] Unused use statement
20 | ERROR | [x] There must be one blank line after the last USE statement; 2 found;
27 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
47 | ERROR | [ ] Missing short description in doc comment
56 | ERROR | [x] Expected 1 blank line before function; 2 found
80 | ERROR | [x] Expected 1 space after IF keyword; 0 found
80 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
81 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
81 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
83 | ERROR | [x] Expected 1 space after ELSE keyword; 0 found
84 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
84 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
97 | WARNING | [ ] Line exceeds 80 characters; contains 88 characters
97 | WARNING | [x] '@todo: Must close file because meta files appear to be left open by backup_migrate' should match the format '@todo Fix problem X
| | here.'
97 | ERROR | [x] No space found before comment text; expected "// @todo: Must close file because meta files appear to be left open by backup_migrate"
| | but found "//@todo: Must close file because meta files appear to be left open by backup_migrate"
98 | WARNING | [x] There must be no blank line following an inline comment
98 | WARNING | [ ] There must be no blank line following an inline comment
98 | ERROR | [x] No space found before comment text; expected "// $file->close();" but found "//$file->close();"
100 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
130 | ERROR | [ ] Parameter $id is not described in comment
133 | ERROR | [ ] Doc comment for parameter $file does not match actual variable name $id
144 | ERROR | [x] Expected 1 space after IF keyword; 0 found
144 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
147 | ERROR | [x] Data types in @var tags need to be fully namespaced
156 | WARNING | [x] A comma should follow the last multiline array item. Found: )
169 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
203 | ERROR | [x] Incorrect spacing between argument "$page" and equals sign; expected 1 but found 0
203 | ERROR | [x] Incorrect spacing between default value and equals sign for argument "$page"; expected 1 but found 0
203 | ERROR | [x] Incorrect spacing between argument "$count" and equals sign; expected 1 but found 0
203 | ERROR | [x] Incorrect spacing between default value and equals sign for argument "$count"; expected 1 but found 0
203 | ERROR | [x] Incorrect spacing between argument "$sortBy" and equals sign; expected 1 but found 0
203 | ERROR | [x] Incorrect spacing between default value and equals sign for argument "$sortBy"; expected 1 but found 0
203 | ERROR | [x] Incorrect spacing between argument "$orderBy" and equals sign; expected 1 but found 0
203 | ERROR | [x] Incorrect spacing between default value and equals sign for argument "$orderBy"; expected 1 but found 0
209 | ERROR | [x] Expected 1 space after IF keyword; 0 found
210 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
210 | ERROR | [x] Concat operator must be surrounded by a single space
210 | ERROR | [x] Concat operator must be surrounded by a single space
212 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
212 | ERROR | [x] Expected 1 space after ELSE keyword; 0 found
213 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 5
213 | ERROR | [x] Expected 1 space after FOREACH keyword; 0 found
213 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
214 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 7
215 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 7
217 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 7
217 | ERROR | [x] No space found before comment text; expected "// Set ID as base64url of filename" but found "//Set ID as base64url of filename"
217 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
218 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 7
219 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 7
220 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 7
221 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 7
222 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 7
223 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 7
225 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 7
226 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 7
227 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 5
228 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
247 | ERROR | [x] Expected 1 space after IF keyword; 0 found
248 | WARNING | [x] '@todo: Check why Backup & Migrate uses count = NULL instead of pager?' should match the format '@todo Fix problem X here.'
248 | ERROR | [x] No space found before comment text; expected "// @todo: Check why Backup & Migrate uses count = NULL instead of pager?" but found
| | "//@todo: Check why Backup & Migrate uses count = NULL instead of pager?"
252 | ERROR | [x] Expected 1 space after ELSE keyword; 0 found
253 | ERROR | [x] Expected 1 space after cast statement; 0 found
256 | ERROR | [x] No space found before comment text; expected "// Match Backup & Migrate sort terminology with BackBeaver API sort keys" but found
| | "//Match Backup & Migrate sort terminology with BackBeaver API sort keys"
256 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
262 | ERROR | [x] Use null coalesce operator instead of ternary operator.
264 | WARNING | [x] '@todo: investigate why Backup & Migrate inversed ASC/DESC order' should match the format '@todo Fix problem X here.'
264 | ERROR | [x] No space found before comment text; expected "// @todo: investigate why Backup & Migrate inversed ASC/DESC order" but found "//@todo:
| | investigate why Backup & Migrate inversed ASC/DESC order"
267 | WARNING | [x] A comma should follow the last multiline array item. Found: 'DESC'
269 | ERROR | [x] Use null coalesce operator instead of ternary operator.
277 | ERROR | [x] Expected 1 blank line after function; 2 found
288 | WARNING | [ ] Line exceeds 80 characters; contains 110 characters
288 | ERROR | [x] No space found before comment text; expected "// Adding markup elements doesn't work, so we will have to implement hook_form_alter and
| | add markup there" but found "//Adding markup elements doesn't work, so we will have to implement hook_form_alter and add markup there"
289 | ERROR | [x] No space found before comment text; expected "// Login/Register button or text" but found "//Login/Register button or text"
289 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
291 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
292 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
293 | WARNING | [ ] Line exceeds 80 characters; contains 150 characters
293 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
296 | ERROR | [x] No space found before comment text; expected "// Site API key" but found "//Site API key"
296 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
300 | ERROR | [x] Space found before comma in argument list
300 | ERROR | [x] Short array syntax must be used to define arrays
309 | ERROR | [x] Line indented incorrectly; expected 3 spaces, found 1
310 | ERROR | [x] Line indented incorrectly; expected 3 spaces, found 1
311 | ERROR | [ ] Private method name "BackBeaverDestination::base64url_encode" is not in lowerCamel format
311 | ERROR | [x] You must use "/**" style comments for a function comment
316 | ERROR | [x] Line indented incorrectly; expected 3 spaces, found 2
318 | ERROR | [ ] Private method name "BackBeaverDestination::base64url_decode" is not in lowerCamel format
318 | ERROR | [x] You must use "/**" style comments for a function comment
319 | ERROR | [x] Short array syntax must be used to define arrays
319 | ERROR | [x] Short array syntax must be used to define arrays
320 | ERROR | [x] Expected 1 blank line after function; 0 found
321 | ERROR | [x] The closing brace for the class must have an empty line before it
------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 80 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------------------------