Fix the errors/warnings reported by Php_CodeSniffer

Created on 7 July 2023, over 1 year ago
Updated 13 June 2024, 5 months ago

Problem/Motivation

PHPCS throws the following errors:

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 user_email_verification
FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\user_email_verification\src\Form\UserEmailVerificationRequestForm.php
---------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
 17 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
---------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\user_email_verification\src\Plugin\views\filter\EmailVerification.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
------------------------------------------------------------------------------------------------------------------------------------------
   1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
  57 | ERROR | [ ] Class property $no_operator should use lowerCamel naming without underscores
  64 | ERROR | [ ] Class property $accept_null should use lowerCamel naming without underscores
 149 | ERROR | [ ] The array declaration extends to column 83 (the limit is 80). The array content should be split up over multiple lines
------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\user_email_verification\src\UserEmailVerification.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
------------------------------------------------------------------------------------------------------------------------------------------
   1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
 390 | ERROR | [x] Array indentation error, expected 10 spaces but found 8
 391 | ERROR | [x] Array indentation error, expected 10 spaces but found 8
 671 | ERROR | [ ] The array declaration extends to column 83 (the limit is 80). The array content should be split up over multiple lines
------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\user_email_verification\user_email_verification.install
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
 15 | WARNING | [x] 'TODO: ReDo it with batch (if many users - timeout on install).' should match the format '@todo Fix problem X here.'
-----------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------

Steps to reproduce

Run the phpcs command on the module.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

šŸ“Œ Task
Status

RTBC

Version

1.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 !4Fixed phpcs issues. ā†’ (Open) created by sidharth_soman
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡³India sidharth_soman Bangalore
  • šŸ‡«šŸ‡®Finland tvalimaa
    FILE: user_email_verification.module
    -----------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------------------------
     9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Entity\Display\EntityViewDisplayInterface.
    -----------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: src/Plugin/views/filter/EmailVerification.php
    --------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------------------------------------------------
     9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\views\Plugin\views\filter\FilterPluginBase.
    --------------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: src/Controller/UserEmailVerificationVerifyExtended.php
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------
     93 | ERROR | Unnecessarily gendered language in a comment
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: src/Controller/UserEmailVerificationVerify.php
    ---------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------------------------------
     94 | ERROR | Unnecessarily gendered language in a comment
    ---------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: src/Event/UserEmailVerificationVerifyEvent.php
    ---------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\user\UserInterface.
    ---------------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: src/Event/UserEmailVerificationDeleteAccountEvent.php
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\user\UserInterface.
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: src/Event/UserEmailVerificationCreateVerificationEvent.php
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\user\UserInterface.
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: src/Event/UserEmailVerificationBlockAccountEvent.php
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\user\UserInterface.
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: user_email_verification/src/UserEmailVerification.php
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
     20 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\user_email_verification\Event\UserEmailVerificationBlockAccountEvent.
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
  • Status changed to Needs work 6 months ago
  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi

    I applied MR !4 and there are PHPCS error that PHPCS reported:

    āžœ  user_email_verification git:(8.x-1.2) curl https://git.drupalcode.org/project/user_email_verification/-/merge_requests/4.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 10239    0 10239    0     0  13598      0 --:--:-- --:--:-- --:--:-- 13725
    patching file 'src/Controller/UserEmailVerificationVerify.php'
    patching file 'src/Controller/UserEmailVerificationVerifyExtended.php'
    patching file 'src/Event/UserEmailVerificationBlockAccountEvent.php'
    patching file 'src/Event/UserEmailVerificationCreateVerificationEvent.php'
    patching file 'src/Event/UserEmailVerificationDeleteAccountEvent.php'
    patching file 'src/Event/UserEmailVerificationVerifyEvent.php'
    patching file 'src/Form/UserEmailVerificationRequestForm.php'
    patching file 'src/Plugin/views/filter/EmailVerification.php'
    patching file 'src/UserEmailVerification.php'
    patching file user_email_verification.install
    patching file user_email_verification.module
    āžœ  user_email_verification git:(8.x-1.2) āœ— ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml user_email_verification 
    
    FILE: ...trib/user_email_verification/src/Plugin/views/filter/EmailVerification.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     149 | ERROR | The array declaration extends to column 83 (the limit is 80).
         |       | The array content should be split up over multiple lines
    --------------------------------------------------------------------------------
    
    
    FILE: .../web/modules/contrib/user_email_verification/src/UserEmailVerification.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     671 | ERROR | The array declaration extends to column 83 (the limit is 80).
         |       | The array content should be split up over multiple lines
    --------------------------------------------------------------------------------
    
    Time: 687ms; Memory: 16MB
    
    āžœ  contrib git:(master) āœ— 
    
  • šŸ‡«šŸ‡®Finland tvalimaa

    hmm I didn't get those errors even I use same line on my local. Anyway I made commit based #5 comment

  • Status changed to RTBC 5 months ago
  • šŸ‡®šŸ‡³India dev16.addweb

    Hello,
    I have tested MR !4 and found no errors or warnings. I have attached SS for the same.

Production build 0.71.5 2024