Fix the issues reported by phpcs

Created on 23 May 2023, over 1 year ago
Updated 29 January 2024, 10 months ago

Problem/Motivation

FILE: ...l/contribution/drupal10/web/modules/contrib/youtube_cookies/js/onetrust.js
--------------------------------------------------------------------------------
FOUND 7 ERRORS AFFECTING 7 LINES
--------------------------------------------------------------------------------
18 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
25 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
31 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
37 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
50 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but
| | found "false"
64 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
69 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but
| | found "true"
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...ibution/drupal10/web/modules/contrib/youtube_cookies/js/youtube-cookies.js
--------------------------------------------------------------------------------
FOUND 38 ERRORS AFFECTING 38 LINES
--------------------------------------------------------------------------------
27 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but
| | found "false"
31 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but
| | found "true"
33 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but
| | found "null"
34 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but
| | found "null"
36 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but
| | found "null"
37 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but
| | found "true"
70 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but
| | found "null"
84 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
95 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
131 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
157 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but
| | found "null"
173 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but
| | found "true"
175 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but
| | found "false"
180 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but
| | found "true"
181 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but
| | found "null"
198 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
207 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
215 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but
| | found "null"
224 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but
| | found "null"
227 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but
| | found "true"
237 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
240 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but
| | found "null"
243 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but
| | found "null"
246 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but
| | found "true"
247 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but
| | found "null"
254 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
256 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but
| | found "null"
257 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but
| | found "true"
278 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but
| | found "false"
318 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but
| | found "true"
321 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but
| | found "false"
330 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
347 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
359 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but
| | found "null"
362 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but
| | found "null"
376 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but
| | found "null"
388 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
492 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but
| | found "null"
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 38 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...on/drupal10/web/modules/contrib/youtube_cookies/js/eu_cookie_compliance.js
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
17 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
24 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...bution/drupal10/web/modules/contrib/youtube_cookies/youtube_cookies.module
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
3 | ERROR | [x] There must be one blank line after the last USE statement; 0
| | found;
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...rupal10/web/modules/contrib/youtube_cookies/youtube_cookies.links.task.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
--------------------------------------------------------------------------------

Time: 496ms; Memory: 12MB

Steps to reproduce

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig youtube_cookies/

Proposed resolution

Fix all the issues and beautify the code.

Remaining tasks

Patch review.

📌 Task
Status

RTBC

Version

2.0

Component

Code

Created by

🇮🇳India urvashi_vora Madhya Pradesh, India

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

  • Issue created by @urvashi_vora
  • Status changed to RTBC over 1 year ago
  • 🇵🇭Philippines clarkssquared

    Hi urvashi_vora

    I applied your patch coding-standard-fixes.patch → to Youtube cookies against version 2.0.x-dev and confirmed that your patch fixed all the PHPCS issues.

    Please look at the screenshot attached for your reference

    Thank you

  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    +/**
    + * @file
    + * Contains youtube_cookies.module.
    + */
    +
     use Drupal\Core\Render\RenderContext;
    +
     /**
      * @file
      * Do not load youtube videos after accepting youtube onetrust cookies.

    The usual module description is Hook implementations for the [module name] module. where [module name] is replaced by the module name shown in the .info.yml file.
    There must be only a @file tag per file; the comment after use Drupal\Core\Render\RenderContext; must be removed.

  • 🇮🇳India urvashi_vora Madhya Pradesh, India

    I will update the patch soon.

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India urvashi_vora Madhya Pradesh, India

    Updated the patch with suggested changes, please review.

  • 🇮🇳India Raveen Kumar

    @Hello Guys
    I have implemented the patch #5 on my Drupal website having version -9.5.9 & PHP version- 8.1
    My issues were fixed after applying the #patch5. I am adding a screenshot for reference. Please review
    And Thank You.

  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
     <?php
     
    -use Drupal\Core\Render\RenderContext;
     /**
      * @file
    - * Do not load youtube videos after accepting youtube onetrust cookies.
    + * Hook implementations for youtube_cookies module.
      */
    

    The @file comment must be after the PHP opening tag and before any use line.

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India urvashi_vora Madhya Pradesh, India

    @apaderno, I'm unsure of the reviewing process at your end. In order to assist you, please find the attached screenshots of the file as well as patch along with this comment. I can assure you that these changes are accurate and do not require any relocation of the @file tag, as it is already appropriately positioned. I kindly request you to review the patches diligently.

    Thanks

  • Attached patched is working fine.
    Thanks

  • Status changed to RTBC over 1 year ago
  • Hi, Patch #5 applied cleanly and also the changes mentioned in the #7 is also clearly addressed.
    Thankyou.

Production build 0.71.5 2024