Fix the warnings/errors reported by PHP_CodeSniffer

Created on 10 July 2023, over 1 year ago
Updated 26 October 2023, about 1 year ago

Problem/Motivation

FILE: /home/lenovo/d7to9/web/modules/contrib/layout_builder_iframe_modal/src/IframeModalHelper.php
--------------------------------------------------------------------------------------------------
FOUND 10 ERRORS AFFECTING 10 LINES
--------------------------------------------------------------------------------------------------
 34 | ERROR | [x] Expected 3 space(s) before asterisk; 2 found
 35 | ERROR | [x] Expected 3 space(s) before asterisk; 2 found
 36 | ERROR | [x] Expected 3 space(s) before asterisk; 2 found
 37 | ERROR | [x] Expected 3 space(s) before asterisk; 2 found
 38 | ERROR | [x] Expected 3 space(s) before asterisk; 2 found
 39 | ERROR | [x] Expected 3 space(s) before asterisk; 2 found
 40 | ERROR | [x] Expected 3 space(s) before asterisk; 2 found
 41 | ERROR | [x] Expected 3 space(s) before asterisk; 2 found
 44 | ERROR | [x] Expected 1 blank line after function; 0 found
 45 | ERROR | [x] The closing brace for the class must have an empty line before it
--------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 10 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/layout_builder_iframe_modal/src/Render/MainContent/IframeRenderer.php
----------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------------------------------------------------------------------
  9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Routing\RouteMatchInterface.
 60 | ERROR | [x] Use null coalesce operator instead of ternary operator.
----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/layout_builder_iframe_modal/layout_builder_iframe_modal.module
--------------------------------------------------------------------------------------------------------------------------------------------
FOUND 7 ERRORS AND 1 WARNING AFFECTING 6 LINES
--------------------------------------------------------------------------------------------------------------------------------------------
  62 | ERROR   | [x] Expected 1 space after SWITCH keyword; 0 found
  66 | ERROR   | [x] Case breaking statements must be followed by a single blank line
  69 | ERROR   | [x] Case breaking statements must be followed by a single blank line
  72 | ERROR   | [x] Case breaking statements must be followed by a single blank line
 123 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
 124 | ERROR   | [ ] The array declaration extends to column 83 (the limit is 80). The array content should be split up over multiple lines
 124 | ERROR   | [x] Expected 1 space between comma and "'layout_builder_update_block'"; 0 found
 124 | ERROR   | [x] Expected one space after the comma, 0 found
--------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/layout_builder_iframe_modal/layout_builder_iframe_modal.install
------------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------
  6 | ERROR | [x] Doc comment short description must be on the first line
  6 | ERROR | [x] Doc comment short description must start with a capital letter
  6 | ERROR | [x] Doc comment short description must end with a full stop
  7 | ERROR | [x] There must be exactly one blank line after the file comment
 15 | ERROR | [x] Expected 1 blank line before function; 2 found
------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------

Time: 125ms; Memory: 10MB

Steps to reproduce

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

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Needs review

Version

1.3

Component

Code

Created by

🇮🇳India roshni27

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 @roshni27
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work over 1 year ago
  • 🇵🇭Philippines paraderojether

    Hi

    I reviewed patch #2, and still getting issues reported by phpcs shown below:

    FILE: /Users/studenttrainees/Drupal/drupalorg-issues-site/docroot/modules/contrib/layout_builder_iframe_modal/js/iframe.js
    --------------------------------------------------------------------------------------------------------------------------
    FOUND 4 ERRORS AFFECTING 4 LINES
    --------------------------------------------------------------------------------------------------------------------------
     35 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
     53 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
     59 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
     74 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
    --------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/studenttrainees/Drupal/drupalorg-issues-site/docroot/modules/contrib/layout_builder_iframe_modal/layout_builder_iframe_modal.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: /Users/studenttrainees/Drupal/drupalorg-issues-site/docroot/modules/contrib/layout_builder_iframe_modal/layout_builder_iframe_modal.module
    ------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------------------------
     126 | WARNING | Line exceeds 80 characters; contains 82 characters
    ------------------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 289ms; Memory: 10MB

    Please check.
    Thank You.

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India Ashutosh Ahirwal India

    Hi have fixed all the issue and providing patch for it.

  • 🇮🇳India rudrakumar188

    Hello, I reviewed the patch #4
    by running
    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig layout_builder_iframe_modal/

    was able to reproduce the errors and after applying patch I was getting 1 error only and few warnings.

    FILE: ...Documents/drupal10/modules/contrib/layout_builder_iframe_modal/PATCHES.txt
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    --------------------------------------------------------------------------------
     1 | WARNING | [ ] Line exceeds 80 characters; contains 104 characters
     5 | ERROR   | [x] Expected 1 newline at end of file; 3 found
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...s/contrib/layout_builder_iframe_modal/layout_builder_iframe_modal.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
    --------------------------------------------------------------------------------
    
    Time: 133ms; Memory: 12MB
    
    
Production build 0.71.5 2024