Fix coding standard related errors

Created on 1 May 2016, about 9 years ago
Updated 4 August 2024, 10 months ago

When running the module code against Drupal coding standards based on the rules in phpcs.xml in core, the module shows errors

phpcs -s --standard=core/phpcs.xml sites/default/modules/share_selection/
FILE: ...l-8/sites/default/modules/share_selection/share_selection.module
----------------------------------------------------------------------
FOUND 15 ERRORS AFFECTING 6 LINES
----------------------------------------------------------------------
 196 | ERROR | [x] Expected 1 spaces after parameter type; 2 found
     |       |     (Drupal.Commenting.FunctionComment.SpacingAfterParamType)
 196 | ERROR | [x] Tag value indented incorrectly; expected 1 space but
     |       |     found 2 (Drupal.Commenting.DocComment.TagValueIndent)
 196 | ERROR | [x] Parameter comment must be on the next line
     |       |     (Drupal.Commenting.FunctionComment.ParamCommentNewLine)
 197 | ERROR | [x] Tag value indented incorrectly; expected 1 space but
     |       |     found 2 (Drupal.Commenting.DocComment.TagValueIndent)
 197 | ERROR | [x] Parameter comment must be on the next line
     |       |     (Drupal.Commenting.FunctionComment.ParamCommentNewLine)
 263 | ERROR | [x] Tag value indented incorrectly; expected 1 space but
     |       |     found 2 (Drupal.Commenting.DocComment.TagValueIndent)
 263 | ERROR | [x] Parameter comment must be on the next line
     |       |     (Drupal.Commenting.FunctionComment.ParamCommentNewLine)
 280 | ERROR | [x] Tag value indented incorrectly; expected 1 space but
     |       |     found 2 (Drupal.Commenting.DocComment.TagValueIndent)
 280 | ERROR | [x] Parameter comment must be on the next line
     |       |     (Drupal.Commenting.FunctionComment.ParamCommentNewLine)
 330 | ERROR | [x] Expected 1 spaces after parameter type; 2 found
     |       |     (Drupal.Commenting.FunctionComment.SpacingAfterParamType)
 330 | ERROR | [x] Tag value indented incorrectly; expected 1 space but
     |       |     found 2 (Drupal.Commenting.DocComment.TagValueIndent)
 330 | ERROR | [x] Parameter comment must be on the next line
     |       |     (Drupal.Commenting.FunctionComment.ParamCommentNewLine)
 331 | ERROR | [x] Expected 1 spaces after parameter type; 3 found
     |       |     (Drupal.Commenting.FunctionComment.SpacingAfterParamType)
 331 | ERROR | [x] Tag value indented incorrectly; expected 1 space but
     |       |     found 2 (Drupal.Commenting.DocComment.TagValueIndent)
 331 | ERROR | [x] Parameter comment must be on the next line
     |       |     (Drupal.Commenting.FunctionComment.ParamCommentNewLine)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 15 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
πŸ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States anoopjohn Washington D. C.

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡΅πŸ‡­Philippines clarkssquared

    Hi

    I applied the patch #5 and I confirmed that there's no PHPCS after I execute the PHPCS command:

    ➜  share_selection git:(7.x-1.x) curl https://www.drupal.org/files/issues/2022-08-30/coding-standard-fixed-2716817-5.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 15428  100 15428    0     0  31036      0 --:--:-- --:--:-- --:--:-- 31744
    patching file README.txt
    patching file 'css/share-selection.css'
    patching file share_selection.admin.inc
    patching file share_selection.api.php
    patching file share_selection.install
    patching file share_selection.module
    ➜  share_selection git:(7.x-1.x) βœ— ..
    ➜  contrib git:(2.1.x) βœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml share_selection 
    ➜  contrib git:(2.1.x) βœ— 
    

    RTBC +1 from me

Production build 0.71.5 2024