Fix the issues reported by phpcs

Created on 19 April 2023, about 1 year ago
Updated 19 June 2023, about 1 year ago

Problem/Motivation

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/textarea_limit/css/textarea_limit.css
---------------------------------------------------------------------------
FOUND 8 ERRORS AFFECTING 2 LINES
---------------------------------------------------------------------------
1 | ERROR | [x] Opening brace should be the last content on the line
1 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
1 | ERROR | [x] Closing brace of class definition must be on new line
2 | ERROR | [x] Opening brace should be the last content on the line
2 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
2 | ERROR | [x] Each style definition must be on a line by itself
2 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
2 | ERROR | [x] Closing brace of class definition must be on new line
---------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/textarea_limit/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
----------------------------------------------------------------------
3 | WARNING | Line exceeds 80 characters; contains 246 characters
7 | WARNING | Line exceeds 80 characters; contains 94 characters
11 | WARNING | Line exceeds 80 characters; contains 143 characters
14 | WARNING | Line exceeds 80 characters; contains 113 characters
15 | WARNING | Line exceeds 80 characters; contains 129 characters
----------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/textarea_limit/src/Form/LimitTextSettingsForm.php
----------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
2 | ERROR | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
----------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/textarea_limit/src/TextareaLimitConstants.php
------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------
19 | ERROR | [x] The closing brace for the class must have an empty line before it
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/textarea_limit/src/TextareaLimitCallbacks.php
---------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------
5 | WARNING | [x] Unused use statement
---------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------

Time: 1.39 secs; Memory: 6MB

Steps to reproduce

Run following command

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/textarea_limit/

Proposed resolution

Above error/warnings need to be fixed.

📌 Task
Status

Needs review

Version

3.0

Component

Code

Created by

🇮🇳India samit.310@gmail.com

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 @samit.310@gmail.com
  • 🇮🇳India samit.310@gmail.com

    Above errors/warnings has been fixed.

  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • 🇮🇳India Ashutosh Ahirwal India

    Hi I have test your patch it get apply cleanly but having some other issue too.

    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml web/modules/custom/textarea_limit

    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/textarea_limit/textarea_limit.module
    ------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------
    10 | 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
    ------------------------------------------------------------------------------------------------------------------------------

    Time: 122ms; Memory: 10MB

    Providing patch with remaining issue fixes with #2.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.2 & MySQL 8
    last update about 1 year ago
    Patch Failed to Apply
  • 🇮🇳India Anjali Mehta

    Hello @Ashutosh Ahirwal
    Tested #3355065-3.patch on Drupal 9.5 and php version 8.1. Patch applied cleanly. But getting a warning and error on running the phpcs. Adding screenshot for Your references. Please have a look.
    Thank You for your support.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.2 & MySQL 8
    last update about 1 year ago
    Patch Failed to Apply
Production build 0.69.0 2024