Fix the issues reported by phpcs

Created on 4 July 2023, over 1 year ago
Updated 8 March 2024, 9 months ago

Problem/Motivation

Upon running the phpcs command on the module, we get:

C:\xampp\htdocs\backendassignment\web\modules\contrib>phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig fb_likebox

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\fb_likebox\fb_likebox.module
----------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 1 LINE
----------------------------------------------------------------------------------------
 1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
 1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\fb_likebox\src\Plugin\Block\FBLikeboxBlock.php
----------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\fb_likebox\tests\src\Functional\FBLikeboxBlockTest.php
------------------------------------------------------------------------------------------------------------------
FOUND 7 ERRORS AND 1 WARNING AFFECTING 6 LINES
------------------------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
 37 | ERROR   | [ ] Public method name "FBLikeboxBlockTest::testFBLikeboxBlock" is not in lowerCamel format
 38 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
 41 | ERROR   | [x] Expected 1 space between comma and "'olivero'"; 0 found
 41 | ERROR   | [x] Expected 0 spaces between "'stark'" and comma; 1 found
 41 | ERROR   | [x] Expected one space after the comma, 0 found
 59 | ERROR   | [x] Expected 1 blank line after function; 0 found
 60 | ERROR   | [x] The closing brace for the class must have an empty line before it
------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------

Time: 1.31 secs; Memory: 6MB

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ“Œ Task
Status

RTBC

Version

2.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia sidharth_soman Bangalore

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

  • Issue created by @sidharth_soman
  • Merge request !3Fixed phpcs issues. โ†’ (Open) created by sidharth_soman
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sidharth_soman Bangalore

    I have fixed all the issues except for the 'line exceeds' warning for the comment in the test file. I'm keeping it that way for readability purposes.

    Please review the MR.

  • Status changed to Needs work 9 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Ashutosh Ahirwal India

    Hi, MR3 resolve phpcs issue but still there are one issue.
    Moving to need work to get notice
    Used command:-
    ./vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,css,js,yml web/modules/custom/fb_likebox

    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/fb_likebox/tests/src/Functional/FBLikeboxBlockTest.php
    -------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------
    38 | WARNING | Line exceeds 80 characters; contains 82 characters
    -------------------------------------------------------------------------------------------------------------------------------

    Time: 186ms; Memory: 12MB

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia mohd sahzad

    Mohd Sahzad โ†’ made their first commit to this issueโ€™s fork.

  • Status changed to Needs review 9 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Yashaswi18

    Hello, I checked out to the branch '3372133-fix-the-issues', ran the phpcs command

    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig fb_likebox

    Found no errors or warnings remaining. Attaching screenshot.

  • Status changed to RTBC 9 months ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines clarkssquared

    Hi

    I also applied MR !3 and I confirmed that all PHPCS issues were resolved.

    โžœ  fb_likebox git:(8.x-2.3) curl https://git.drupalcode.org/project/fb_likebox/-/merge_requests/3.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  1567    0  1567    0     0   3023      0 --:--:-- --:--:-- --:--:--  3066
    patching file fb_likebox.module
    patching file 'tests/src/Functional/FBLikeboxBlockTest.php'
    โžœ  fb_likebox git:(8.x-2.3) โœ— ..
    โžœ  contrib git:(master) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml fb_likebox 
    โžœ  contrib git:(master) โœ— 
    
    
Production build 0.71.5 2024