Fix the issues reported by phpcs

Created on 8 July 2024, 5 months ago
Updated 31 July 2024, 4 months ago

Problem/Motivation

There is a files need to fixed with coding standards.
Here is the command : -
vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig web/modules/contrib/youtubeintegrate/

Command returns the following warnings/errors, which should be fixed.

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/youtubeintegrate/youtube_integration.module
--------------------------------------------------------------------------------------------------------
FOUND 23 ERRORS AND 7 WARNINGS AFFECTING 30 LINES
--------------------------------------------------------------------------------------------------------
3 | ERROR | Missing short description in doc comment
31 | ERROR | Comment indentation error, expected only 1 spaces
33 | ERROR | Comment indentation error, expected only 1 spaces
37 | ERROR | Comment indentation error, expected only 5 spaces
41 | ERROR | Comment indentation error, expected only 1 spaces
44 | ERROR | Comment indentation error, expected only 5 spaces
50 | ERROR | Comment indentation error, expected only 1 spaces
53 | ERROR | Comment indentation error, expected only 1 spaces
56 | ERROR | Comment indentation error, expected only 1 spaces
58 | ERROR | Comment indentation error, expected only 1 spaces
60 | ERROR | Comment indentation error, expected only 1 spaces
61 | ERROR | Comment indentation error, expected only 3 spaces
62 | WARNING | Line exceeds 80 characters; contains 150 characters
65 | ERROR | Comment indentation error, expected only 1 spaces
66 | ERROR | Comment indentation error, expected only 3 spaces
73 | ERROR | Comment indentation error, expected only 1 spaces
76 | ERROR | Comment indentation error, expected only 1 spaces
79 | ERROR | Comment indentation error, expected only 1 spaces
81 | ERROR | Comment indentation error, expected only 1 spaces
85 | ERROR | Comment indentation error, expected only 1 spaces
86 | ERROR | Comment indentation error, expected only 3 spaces
87 | ERROR | Comment indentation error, expected only 5 spaces
91 | ERROR | Comment indentation error, expected only 1 spaces
92 | WARNING | Line exceeds 80 characters; contains 95 characters
96 | WARNING | There must be no blank line following an inline comment
144 | ERROR | Comment indentation error, expected only 1 spaces
145 | WARNING | Line exceeds 80 characters; contains 116 characters
146 | WARNING | There must be no blank line following an inline comment
182 | WARNING | Line exceeds 80 characters; contains 86 characters
208 | WARNING | Line exceeds 80 characters; contains 83 characters
--------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/youtubeintegrate/youtube_integration.info.yml
-------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------
1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
-------------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/youtubeintegrate/src/Entity/YouTubePlaylistEntity.php
------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------
25 | WARNING | Line exceeds 80 characters; contains 100 characters
------------------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/youtubeintegrate/src/YouTubeAPI.php
------------------------------------------------------------------------------------------------------
FOUND 14 ERRORS AND 12 WARNINGS AFFECTING 26 LINES
------------------------------------------------------------------------------------------------------
20 | ERROR | Parameter $configFactory is not described in comment
23 | ERROR | Doc comment for parameter $apiKey does not match actual variable name $configFactory
49 | ERROR | Comment indentation error, expected only 1 spaces
59 | ERROR | Doc comment is empty
100 | ERROR | Doc comment is empty
125 | ERROR | Comment indentation error, expected only 1 spaces
128 | WARNING | Line exceeds 80 characters; contains 98 characters
130 | ERROR | Comment indentation error, expected only 3 spaces
134 | ERROR | Comment indentation error, expected only 1 spaces
137 | ERROR | Comment indentation error, expected only 3 spaces
138 | ERROR | Comment indentation error, expected only 7 spaces
141 | WARNING | Line exceeds 80 characters; contains 103 characters
143 | WARNING | Line exceeds 80 characters; contains 98 characters
146 | WARNING | Line exceeds 80 characters; contains 190 characters
147 | WARNING | Line exceeds 80 characters; contains 118 characters
151 | ERROR | Comment indentation error, expected only 7 spaces
152 | WARNING | Line exceeds 80 characters; contains 90 characters
153 | WARNING | Line exceeds 80 characters; contains 94 characters
156 | WARNING | Line exceeds 80 characters; contains 216 characters
158 | ERROR | Comment indentation error, expected only 11 spaces
161 | WARNING | Line exceeds 80 characters; contains 90 characters
167 | ERROR | Comment indentation error, expected only 7 spaces
169 | WARNING | Line exceeds 80 characters; contains 81 characters
175 | WARNING | There must be no blank line following an inline comment
178 | ERROR | Doc comment short description must start with a capital letter
185 | WARNING | Line exceeds 80 characters; contains 95 characters
------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/youtubeintegrate/src/Controller/YouTubeIntegrationController.php
-----------------------------------------------------------------------------------------------------------------------------
FOUND 8 ERRORS AND 4 WARNINGS AFFECTING 10 LINES
-----------------------------------------------------------------------------------------------------------------------------
77 | ERROR | Doc comment is empty
131 | ERROR | Doc comment is empty
138 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
162 | ERROR | Doc comment is empty
189 | ERROR | Comment indentation error, expected only 1 spaces
191 | WARNING | Line exceeds 80 characters; contains 85 characters
191 | ERROR | Comment indentation error, expected only 1 spaces
195 | WARNING | There must be no blank line following an inline comment
198 | ERROR | Doc comment short description must start with a capital letter
198 | ERROR | Doc comment short description must end with a full stop
215 | WARNING | Line exceeds 80 characters; contains 160 characters
232 | ERROR | Doc comment is empty
-----------------------------------------------------------------------------------------------------------------------------

Time: 218ms; Memory: 12MB

Steps to reproduce

Proposed resolution

Remaining tasks

Create MR/ Patch For This Issue.

User interface changes

API changes

Data model changes

๐Ÿ“Œ Task
Status

RTBC

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia prem suthar Ahemdabad- Gujrat , Jodhpur - Rajsthan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @prem suthar
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia abhiyanshu_rawat

    Resolved all the PHPCS errors and warnings for the requested files.
    There was a 404 Page Not Found error when creating the branch.
    Attaching the patch for the same. Thanks.

  • Status changed to Needs review 5 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia prem suthar Ahemdabad- Gujrat , Jodhpur - Rajsthan
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dev2.addweb

    nilesh.addweb โ†’ made their first commit to this issueโ€™s fork.

  • Merge request !1#3459852 fixed phpcs issues. โ†’ (Open) created by Unnamed author
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dev2.addweb

    I have created branch and pushed changes from patch #2. Please review MR !1

  • Status changed to RTBC 4 months ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines paraderojether

    Hi

    I reviewed MR!1, applied it against Youtube Integration 1.0.1 and confirmed it fixes the issues reported by phpcs.

    โžœ  youtubeintegrate git:(main) โœ— curl https://git.drupalcode.org/project/youtubeintegrate/-/merge_requests/1.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 47286    0 47286    0     0  85015      0 --:--:-- --:--:-- --:--:-- 86131
    patching file 'css/youtube.css'
    patching file 'src/Controller/YouTubeIntegrationController.php'
    patching file 'src/Entity/YouTubePlaylistEntity.php'
    patching file 'src/YouTubeAPI.php'
    patching file 'templates/youtube-integration-playlist-item.html.twig'
    patching file 'templates/youtube-integration-playlists.html.twig'
    patching file youtube_integration.links.menu.yml
    patching file youtube_integration.module
    patching file youtube_integration.routing.yml
    โžœ  youtubeintegrate git:(main) โœ— cd ..
    โžœ  contrib git:(main) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig youtubeintegrate
    โžœ  contrib git:(main) โœ—
    

    Moving this to RTBC.
    Thank you.

Production build 0.71.5 2024