Fix the issues reported by phpcs

Created on 28 June 2023, over 1 year ago
Updated 11 July 2023, over 1 year ago

Fix all the issues reported by PHPCS for Drupal and DrupalPractice Coding Standards

Steps to reproduce
Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig eth_fundraiser/

Proposed resolution
Fixing all issues mentioned:

FILE: eth_fundraiser/eth_fundraiser.module
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
9 | ERROR | [x] Use statements should be sorted alphabetically. The first
| | wrong one is Drupal\Core\Form\FormStateInterface.
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: eth_fundraiser/src/Plugin/Block/EthFundraiserBlock.php
--------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------
154 | WARNING | Unused variable $values.
174 | WARNING | Unused variable $config.
--------------------------------------------------------------------------

FILE: eth_fundraiser/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------
14 | WARNING | Line exceeds 80 characters; contains 146 characters
36 | WARNING | Line exceeds 80 characters; contains 154 characters
----------------------------------------------------------------------

📌 Task
Status

RTBC

Version

1.0

Component

Code

Created by

🇮🇳India vishal365365

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 @vishal365365
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India vishal365365

    i have fixed the issues

  • First commit to issue fork.
  • @arti_parmar opened merge request.
  • Status changed to Needs work over 1 year ago
  • 🇵🇭Philippines clarkssquared

    Hi vishal365365

    I applied your patch #2 to my local and I noticed that your patch has whitespace errors as per my terminal, and executing the PHPCS command flags an issue regarding eth_fundraiser.js. For convenience below is the output I saw in my terminal.

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

    FILE: /Users/studenttrainees/eth_fundraiser/js/eth_fundraiser.js
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------
    1 | WARNING | File appears to be minified and cannot be processed
    ----------------------------------------------------------------------

    FILE: /Users/studenttrainees/eth_fundraiser/templates/eth-fundraiser-block.html.twig
    ------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------
    35 | ERROR | [x] Expected 1 newline at end of file; 0 found
    ------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------

    Time: 263ms; Memory: 10MB

    Please also look at the attached screenshot for reference

    Thank you

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

    hi clarkssquared
    i have created new patch and solved the issues you mentioned but one warning mentioned below can not be resolved as the maintainers of the project has given the eth_fundraiser.js in minified format. which phphcs can not able evaluate.
    eth_fundraiser/js/eth_fundraiser.js
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------
    1 | WARNING | File appears to be minified and cannot be processed
    ----------------------------------------------------------------------

  • Status changed to RTBC over 1 year ago
  • 🇮🇳India indrapatil Bangalore

    The patch is working well so moving to RTBC WIth your #6 comment @vishal.

Production build 0.71.5 2024