Problem/Motivation

PHPCS reports 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 imce_copylink

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\imce_copylink\imce_copylink.css
-------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
 2 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
 2 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
-------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\imce_copylink\src\Plugin\ImcePlugin\Copylink.php
------------------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AND 1 WARNING AFFECTING 7 LINES
------------------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
  5 | WARNING | [x] Unused use statement
 16 | ERROR   | [x] There must be exactly one newline after the class comment
 18 | ERROR   | [ ] Class name doesn't match filename; expected "class Copylink"
 24 | ERROR   | [x] Short array syntax must be used to define arrays
 34 | ERROR   | [x] Expected 1 blank line after function; 0 found
 35 | 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: 600ms; Memory: 6MB

Steps to reproduce

Run the phpcs command on the module.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

sidharth_soman created an issue. See original summary.

sidharth_soman’s picture

Assigned: sidharth_soman » Unassigned
Status: Needs work » Needs review
StatusFileSize
new1.06 KB

All issues fixed except the mismatch of the class name with the filename for the plugin file Copylink.php. I'm leaving it as it is for now.

clarkssquared’s picture

Status: Needs review » Needs work
StatusFileSize
new135.88 KB

Hi sidharth_soman

I applied your patch #2 to my local and I noticed that there is still PHPCS error being flagged in my terminal, for convenience below is the error.

FILE: /Users/studenttrainees/imce_copylink/src/Plugin/ImcePlugin/Copylink.php
-----------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------
16 | ERROR | Class name doesn't match filename; expected "class Copylink"
-----------------------------------------------------------------------------

Time: 177ms; Memory: 10MB

Please also look at the screenshot I attached,
Thank you.

soham sengupta’s picture

Status: Needs work » Needs review
StatusFileSize
new1.1 KB

Hi,

I have fixed the remaining phpcs error in this patch.

roberttabigue’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new84.55 KB

Hi,

I reviewed the changes and confirmed the Patch was applied cleanly to the IMCE Copy Link module against 8.x-1.x-dev on Drupal 9.5.10.

Checking patch imce_copylink.css...
Checking patch src/Plugin/ImcePlugin/Copylink.php...
Applied patch imce_copylink.css cleanly.
Applied patch src/Plugin/ImcePlugin/Copylink.php cleanly.

And all PHPCS errors have been fixed.

I ran this command:
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig imce_copylink

Please see the attached file for reference.

I'm moving this now to RTBC.

Thank you!

jeroent’s picture

Status: Reviewed & tested by the community » Needs work

Can you please make a merge request for those changes?

  • jeroent committed 6dc9e76a on 8.x-1.x
    [#3373862] fix: Fix the issues reported by phpcs
    
    By: sidharth_soman
    By...
jeroent’s picture

Status: Needs work » Fixed

Merged to 8.x-1.x. Thanks!

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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