Fix the issues reported by phpcs

Created on 10 July 2023, almost 2 years ago

Problem/Motivation

PHPCS reports the errors as follows:

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\entity_abuse\src\Controller\EntityAbuseNoAccess.php
-----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
-----------------------------------------------------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
 12 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
 51 | WARNING | [x] '@TODO: Add logging of $entity_type & $entity_id data for statistics?' should match the format '@todo Fix problem X here.'
-----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\entity_abuse\src\EntityAbuseReportLinkLazyBuilder.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
  1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
 94 | ERROR | [ ] The array declaration extends to column 86 (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\entity_abuse\src\Form\EntityAbuseReportDeleteForm.php
-----------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------
  1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
 11 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Url.
-----------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\entity_abuse\src\Form\EntityAbuseSettingsForm.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\Entity\ContentEntityTypeInterface.
---------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------

Steps to reproduce

Run the phpcs command on the module.

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

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

šŸ“Œ Task
Status

Active

Version

1.1

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

Comments & Activities

  • Issue created by @sidharth_soman
  • šŸ‡®šŸ‡³India sidharth_soman Bangalore

    I've solved all the issues except for the array exceeding column 80 in EntityAbuseReportLinkLazyBuilder.php. I'm keeping it that way due to readability.

    Please review the patch.

  • Issue was unassigned.
  • Status changed to Needs review almost 2 years ago
  • Status changed to Needs work over 1 year ago
  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi

    I applied your patch #2 and it fixes most of the PHPCS issues that has been reported but there is one PHPCS error that my terminal flagged, for your reference this is the output from my terminal after I applied your patch

    āžœ  entity_abuse git:(1.1.x) curl https://www.drupal.org/files/issues/2023-07-10/3373668-2.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  2211  100  2211    0     0   4559      0 --:--:-- --:--:-- --:--:--  4654
    patching file 'src/Controller/EntityAbuseNoAccess.php'
    patching file 'src/Form/EntityAbuseReportDeleteForm.php'
    patching file 'src/Form/EntityAbuseSettingsForm.php'
    āžœ  entity_abuse git:(1.1.x) āœ— ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml entity_abuse 
    
    FILE: .../web/modules/contrib/entity_abuse/src/EntityAbuseReportLinkLazyBuilder.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     94 | ERROR | The array declaration extends to column 86 (the limit is 80). The
        |       | array content should be split up over multiple lines
    --------------------------------------------------------------------------------
    
    Time: 419ms; Memory: 10MB
    
    āžœ  contrib git:(master) āœ— 
    
  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡³India sakthi_dev

    Addressed the comment #4. Please review.

  • Status changed to RTBC over 1 year ago
  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi

    I applied patch #5 and I confirmed that it fixes all the PHPCS issues

    āžœ  entity_abuse git:(1.1.x) curl https://www.drupal.org/files/issues/2023-12-15/3373668-5.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  2909  100  2909    0     0  15609      0 --:--:-- --:--:-- --:--:-- 16071
    patching file 'src/Controller/EntityAbuseNoAccess.php'
    patching file 'src/EntityAbuseReportLinkLazyBuilder.php'
    patching file 'src/Form/EntityAbuseReportDeleteForm.php'
    patching file 'src/Form/EntityAbuseSettingsForm.php'
    āžœ  entity_abuse git:(1.1.x) āœ— ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml entity_abuse 
    āžœ  contrib git:(master) āœ— 
    
    
    • 2520c3c4 committed on 1.1.x
      Issue #3373668 by sidharth_soman, sakthi_dev, clarkssquared: Fix the...
  • šŸ‡©šŸ‡ŖGermany Antonnavi Berlin
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024