Fix the issues reported by phpcs

Created on 16 February 2023, almost 2 years ago

Problem/Motivation

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/youtube_duration/youtube_duration.module
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 10 ERRORS AND 19 WARNINGS AFFECTING 25 LINES
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
6 | WARNING | [x] Unused use statement
7 | WARNING | [x] Unused use statement
8 | WARNING | [x] Unused use statement
8 | ERROR | [x] There must be one blank line after the last USE statement; 2 found;
12 | 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."
13 | ERROR | [ ] Doc comment short description must end with a full stop
13 | ERROR | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
15 | ERROR | [x] Expected 1 blank line before function; 2 found
16 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
18 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
20 | WARNING | [ ] Unused variable $pluginConfiguration.
22 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
35 | WARNING | [x] A comma should follow the last multiline array item. Found: 'additional_settings'
49 | 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: ]
51 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
58 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
59 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
60 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
68 | ERROR | [x] Doc comment short description must start with a capital letter
68 | ERROR | [x] Doc comment short description must end with a full stop
83 | 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."
84 | ERROR | [ ] Doc comment short description must end with a full stop
84 | ERROR | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
87 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
89 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
90 | ERROR | [x] Expected 1 space after "="; 0 found
92 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 22 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/youtube_duration/src/Service/YoutubeDurationGetterService.php
------------------------------------------------------------------------------------------------------------
FOUND 48 ERRORS AFFECTING 40 LINES
------------------------------------------------------------------------------------------------------------
16 | ERROR | [x] Missing class doc comment
20 | ERROR | [ ] Missing short description in doc comment
25 | ERROR | [ ] Missing short description in doc comment
30 | ERROR | [ ] Missing short description in doc comment
35 | ERROR | [ ] Missing short description in doc comment
40 | ERROR | [ ] Missing short description in doc comment
45 | ERROR | [ ] Missing short description in doc comment
51 | ERROR | [ ] Missing short description in doc comment
52 | ERROR | [x] Data types in @var tags need to be fully namespaced
56 | ERROR | [ ] Missing short description in doc comment
61 | ERROR | [ ] Missing short description in doc comment
62 | ERROR | [x] Expected "bool|string" but found "bool | string" for @var tag in member variable comment
67 | ERROR | [ ] Missing short description in doc comment
72 | ERROR | [ ] Missing short description in doc comment
77 | ERROR | [ ] Missing short description in doc comment
82 | ERROR | [ ] Missing short description in doc comment
87 | ERROR | [ ] Missing short description in doc comment
92 | ERROR | [ ] Missing short description in doc comment
97 | ERROR | [ ] Parameter $url_resolver is not described in comment
100 | ERROR | [ ] Missing parameter comment
101 | ERROR | [ ] Missing parameter comment
102 | ERROR | [ ] Missing parameter comment
112 | ERROR | [x] Doc comment short description must start with a capital letter
112 | ERROR | [x] Doc comment short description must end with a full stop
114 | ERROR | [ ] Missing parameter comment
115 | ERROR | [ ] Missing parameter comment
144 | ERROR | [x] Doc comment short description must start with a capital letter
144 | ERROR | [x] Doc comment short description must end with a full stop
146 | ERROR | [ ] Missing parameter comment
157 | ERROR | [x] Doc comment short description must start with a capital letter
157 | ERROR | [x] Doc comment short description must end with a full stop
159 | ERROR | [x] Doc comment long description must start with a capital letter
161 | ERROR | [ ] Description for the @return value is missing
168 | ERROR | [x] Doc comment short description must start with a capital letter
168 | ERROR | [x] Doc comment short description must end with a full stop
170 | ERROR | [ ] Description for the @return value is missing
177 | ERROR | [x] Doc comment short description must start with a capital letter
177 | ERROR | [x] Doc comment short description must end with a full stop
179 | ERROR | [ ] Description for the @return value must be on the next line
186 | ERROR | [x] Doc comment short description must start with a capital letter
186 | ERROR | [x] Doc comment short description must end with a full stop
193 | ERROR | [x] Expected newline after closing brace
199 | ERROR | [x] Use null coalesce operator instead of ternary operator.
204 | ERROR | [x] Doc comment short description must start with a capital letter
204 | ERROR | [x] Doc comment short description must end with a full stop
220 | ERROR | [x] Doc comment short description must start with a capital letter
220 | ERROR | [x] Doc comment short description must end with a full stop
222 | ERROR | [ ] Description for the @return value is missing
------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 22 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------

Time: 3.66 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/youtube_duration/

Proposed resolution

Above error/warnings need to be fixed.

📌 Task
Status

RTBC

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.71.5 2024