Fix the issues reported by phpcs

Created on 26 February 2024, 7 months ago
Updated 1 March 2024, 7 months ago

Steps to reproduce

When I run the reported command, I get more errors/warnings.

phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml -- web/modules/contrib/cmm/

FILE: D:\xampp\htdocs\drupal9\web\modules\contrib\cmm\cmm.info.yml
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
5 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal9\web\modules\contrib\cmm\cmm.module
------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormStateInterface.
51 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal9\web\modules\contrib\cmm\cmm.routing.yml
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
9 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal9\web\modules\contrib\cmm\cmm.services.yml
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
11 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal9\web\modules\contrib\cmm\README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
3 | WARNING | Line exceeds 80 characters; contains 366 characters
----------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal9\web\modules\contrib\cmm\src\Form\UserLoginHiddenForm.php
-----------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormStateInterface.
-----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal9\web\modules\contrib\cmm\src\Routing\RouteSubscriber.php
--------------------------------------------------------------------------------------
FOUND 7 ERRORS AFFECTING 5 LINES
--------------------------------------------------------------------------------------
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"
2 | ERROR | [x] There must be one blank line after the namespace declaration
4 | ERROR | [x] There must be one blank line after the last USE statement; 0 found;
12 | ERROR | [x] Expected 1 blank line before function; 0 found
18 | ERROR | [x] Expected 1 newline at end of file; 0 found
18 | ERROR | [x] The closing brace for the class must have an empty line before it

๐Ÿ“Œ Task
Status

RTBC

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia jayprakash.kushwah 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

Merge Requests

Comments & Activities

  • Issue created by @jayprakash.kushwah
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Prem Suthar gujrat

    Prem Suthar โ†’ made their first commit to this issueโ€™s fork.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Prem Suthar gujrat

    Prem Suthar โ†’ changed the visibility of the branch 3423795-fix-the-issues to hidden.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Prem Suthar gujrat

    added the MR for phpcs issue fixed please review

  • Status changed to Needs review 7 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Prem Suthar gujrat
  • First commit to issue fork.
  • Status changed to RTBC 7 months ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines clarkssquared

    Hi

    I applied MR !2 and I confirmed that it fixes all the PHPCS erors, the remaining errors about happens when you install the module via composer.

    โžœ  cmm git:(master) โœ— curl https://git.drupalcode.org/project/cmm/-/merge_requests/2.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  4517    0  4517    0     0  11211      0 --:--:-- --:--:-- --:--:-- 11377
    patching file README.md
    patching file cmm.info.yml
    1 out of 1 hunks failed--saving rejects to cmm.info.yml.rej
    patching file cmm.module
    patching file cmm.routing.yml
    patching file cmm.services.yml
    patching file 'src/Form/UserLoginHiddenForm.php'
    patching file 'src/Routing/RouteSubscriber.php'
    โžœ  cmm git:(master) โœ— ..
    โžœ  contrib git:(master) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml cmm 
    
    FILE: ...arksubing-subing/Projects/d9/d9-local/web/modules/contrib/cmm/cmm.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: 197ms; Memory: 10MB
    
    โžœ  contrib git:(master) โœ— 
Production build 0.71.5 2024