Drupal Coding Standards Issues | phpcs

Created on 6 March 2023, almost 2 years ago
Updated 28 February 2024, 10 months ago

Problem/Motivation

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/consent_manager/consent_manager.install
------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------
25 | WARNING | Avoid backslash escaping in translatable strings when possible, use "" quotes instead
------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/consent_manager/src/Form/ConsentManagerSettingsForm.php
-------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
-------------------------------------------------------------------------------------------
26 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
120 | ERROR | [x] Expected 1 space after "=>"; 0 found
172 | ERROR | [x] Whitespace found at end of line
-------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/consent_manager/src/CodeManager.php
------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------
69 | ERROR | [x] Expected 1 blank line after function; 0 found
70 | ERROR | [x] The closing brace for the class must have an empty line before it
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------

Time: 3.14 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/consent_manager/

Proposed resolution

Above error/warnings need to be fixed.

📌 Task
Status

Needs review

Version

2.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

Merge Requests

Comments & Activities

Not all content is available!

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

  • First commit to issue fork.
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 10 months ago
    2 pass
  • Status changed to Fixed 10 months ago
  • Status changed to Needs work 10 months ago
  • Status changed to Needs review 10 months ago
  • 🇮🇳India zkhan.aamir

    Hi,

    MR #8 applied successfully

    Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules/consent_manager (2.0.x)
    $ curl https://git.drupalcode.org/project/consent_manager/-/merge_requests/8.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  2647    0  2647    0     0   6876      0 --:--:-- --:--:-- --:--:--  6911
    patching file consent_manager.install
    patching file src/CodeManager.php
    patching file src/Form/ConsentManagerSettingsForm.php
    

    No issues remaining.

    Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules
    $ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,css,js,yml consent_manager/
    
    Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules
    $
    
    
Production build 0.71.5 2024