Fix the issues reported by phpcs

Created on 14 April 2023, over 1 year ago
Updated 26 April 2023, over 1 year ago

Problem/Motivation

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/youtube_plus/config/optional/youtube_plus.settings.yml
------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------
2 | ERROR | [x] Expected 1 newline at end of file; 0 found
------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/youtube_plus/youtube_plus.module
---------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
9 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
---------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/youtube_plus/youtube_plus.services.yml
--------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------
4 | ERROR | [x] Expected 1 newline at end of file; 2 found
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/youtube_plus/youtube_plus.links.menu.yml
----------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------
5 | ERROR | [x] Expected 1 newline at end of file; 2 found
----------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/youtube_plus/youtube_plus.install
----------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
----------------------------------------------------------------------------------
6 | ERROR | [x] There must be exactly one blank line after the file comment
12 | ERROR | [x] Expected 1 blank line before function; 2 found
33 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
----------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/youtube_plus/src/Form/SettingsForm.php
---------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
---------------------------------------------------------------------------------------------
25 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
74 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/youtube_plus/src/Form/ChannelForm.php
---------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
---------------------------------------------------------------------------------------------
44 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
67 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/youtube_plus/src/Controller/YouTubePlusImport.php
---------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
---------------------------------------------------------------------------------------------
17 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
25 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/youtube_plus/src/YouTubePlusService.php
-----------------------------------------------------------------------------------------
FOUND 25 ERRORS AFFECTING 19 LINES
-----------------------------------------------------------------------------------------
113 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
113 | ERROR | [x] Expected 1 space after IF keyword; 0 found
113 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
114 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
115 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
116 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
333 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
333 | ERROR | [x] Object operator not indented correctly; expected 6 spaces but found 4
334 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
335 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
358 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
358 | ERROR | [x] Object operator not indented correctly; expected 6 spaces but found 4
359 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
360 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
367 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
367 | ERROR | [x] Object operator not indented correctly; expected 6 spaces but found 4
368 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
369 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
376 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
376 | ERROR | [x] Object operator not indented correctly; expected 6 spaces but found 4
377 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
378 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
391 | ERROR | [ ] Missing parameter type
418 | ERROR | [ ] Missing parameter type
442 | ERROR | [ ] Missing parameter type
-----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 22 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------

Time: 2.99 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/youtube_plus/

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

Not all content is available!

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

Production build 0.71.5 2024