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

CommentFileSizeAuthor
#5 3373668-5.patch2.84 KBsakthi_dev
#2 3373668-2.patch2.16 KBsidharth_soman

Comments

sidharth_soman created an issue. See original summary.

sidharth_soman’s picture

StatusFileSize
new2.16 KB

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.

sidharth_soman’s picture

Assigned: sidharth_soman » Unassigned
Status: Active » Needs review
clarkssquared’s picture

Status: Needs review » Needs work

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) ✗ 
sakthi_dev’s picture

Status: Needs work » Needs review
StatusFileSize
new2.84 KB

Addressed the comment #4. Please review.

clarkssquared’s picture

Status: Needs review » Reviewed & tested by the community

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...
antonnavi’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.