Fix the issues reported by phpcs

Created on 11 July 2023, over 1 year ago
Updated 12 July 2023, over 1 year ago

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

📌 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

Comments & Activities

  • Issue created by @sidharth_soman
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India sidharth_soman Bangalore

    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.

  • Status changed to Needs work over 1 year ago
  • 🇵🇭Philippines clarkssquared

    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.

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India Soham Sengupta

    Hi,

    I have fixed the remaining phpcs error in this patch.

  • Status changed to RTBC over 1 year ago
  • 🇵🇭Philippines roberttabigue

    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!

Production build 0.71.5 2024