Fix the issues reported by phpcs

Created on 10 July 2023, over 1 year ago
Updated 5 January 2024, 11 months 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 field_group_table

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\field_group_table\field_group_table.api.php
-------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
-------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\field_group_table\src\Plugin\field_group\FieldGroupFormatter\FieldGroupTable.php
--------------------------------------------------------------------------------------------------------------------------------------------
FOUND 7 ERRORS AFFECTING 7 LINES
--------------------------------------------------------------------------------------------------------------------------------------------
   1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
 392 | ERROR | [x] Use null coalesce operator instead of ternary operator.
 397 | ERROR | [x] Use null coalesce operator instead of ternary operator.
 423 | ERROR | [x] Use null coalesce operator instead of ternary operator.
 619 | ERROR | [x] Use null coalesce operator instead of ternary operator.
 620 | ERROR | [x] Use null coalesce operator instead of ternary operator.
 659 | ERROR | [ ] The array declaration extends to column 93 (the limit is 80). The array content should be split up over multiple lines
--------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------------

Time: 1.61 secs; Memory: 8MB

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

    The only issue left to fix is the 'array exceeding column 80' error in the isset() statement. I'm leaving it as it is for now due to readability purposes.

    Please review the patch.

  • Status changed to RTBC 11 months ago
  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi

    I applied your patch #2 and I confirmed that it fixes the PHPCS erorr and I confirmed that the remaining issue is the 'array exceeding column 80' error and since it is for readability purposes it can be ignored.

    āžœ  field_group_table git:(8.x-1.1) curl https://www.drupal.org/files/issues/2023-07-10/3373661-2.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  2265  100  2265    0     0   4472      0 --:--:-- --:--:-- --:--:--  4520
    patching file 'src/Plugin/field_group/FieldGroupFormatter/FieldGroupTable.php'
    āžœ  field_group_table git:(8.x-1.1) āœ— ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml field_group_table 
    
    FILE: /Users/clarksubing-subing/Projects/d9/d9-local/web/modules/contrib/field_group_table/src/Plugin/field_group/FieldGroupFormatter/FieldGroupTable.php
    ---------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------------------------------
     659 | ERROR | The array declaration extends to column 93 (the limit is 80). The array content should be split up over multiple lines
    ---------------------------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 367ms; Memory: 14MB
    
    āžœ  contrib git:(master) āœ— 
    
    
Production build 0.71.5 2024