Fix the issues reported by phpcs

Created on 9 May 2023, over 1 year ago
Updated 17 May 2023, over 1 year ago

Problem/Motivation

โฏ phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,css,js .

FILE: /Users/specbee/Sites/Projects/secure_html/secure_html.module
-------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------
 6 | ERROR | [x] Doc comment short description must be on the first line
-------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/secure_html/src/Plugin/Filter/SecureHtmlFilter.php
--------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------------------
  9 | ERROR | [ ] Missing short description in doc comment
 27 | ERROR | [x] list(...) is forbidden, use [...] instead.
 43 | ERROR | [x] Short array syntax must be used to define arrays
--------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------

Time: 110ms; Memory: 10MB

Steps to reproduce

Run following command
phpcs --standard=โ€œDrupal,DrupalPracticeโ€ --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,css,js .

๐Ÿ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia Shanu Chouhan

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 @Shanu Chouhan
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Shanu Chouhan

    I have Created a patch to fix this issue.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • First commit to issue fork.
  • @dineshkumarbollu opened merge request.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dineshkumarbollu

    Hi

    The patch#2 applied cleanly but found 1 phpcbf warning that is fixed in the MR.

    Thanks.

  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
     /**
      * @file
    - *
      * Hook implementations.
      */

    Since that comment is edited, the description should be changed too. (Hook implementations for the Secure html module.)

     /**
    + * A filter that Wraps content in an iframe.
    + *

    Wraps is misspelled, since it has been capitalized when it should not.

    Also, the report shown in the issue summary is for a single file, but the MR changes two files. Either the report is updated or the MR changes what the report says to change.

  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dineshkumarbollu

    Hi
    I changed the 2 comment which reported above, while running phpcs command before applying patch changes are in 2 files.

    Thanks

  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    + /**
    ++ * A filter that Wraps content in an iframe.
    ++ *
    +  * @Filter(
    +-      list($k, $v) = explode("=", $str);
    ++      [$k, $v] = explode("=", $str);
    +   public function settingsForm(array $form, FormStateInterface $form_state) {
    +-    $form['secure_html_settings'] = array(
    ++    $form['secure_html_settings'] = [

    There are extra plus/minus signs that need to be removed.

    - * Hook implementations.
    + * Hook implementations for the Secure html module..

    There are two periods at the end of the description instead of one.

  • Assigned to imustakim
  • ๐Ÿ‡จ๐Ÿ‡ฆCanada imustakim Canada
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡จ๐Ÿ‡ฆCanada imustakim Canada

    Patch updated.
    Please review.

  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
     /**
      * @file
    - *
    - * Hook implementations.
    + * Hook implementations for Secure HTML module.
      */

    The module name is Secure html, not Secure HTML.
    A definite article is missing after for.

    The report shows warnings/errors for a single file, but the patch changes two files. Either the patch changes only the file for which the issue summary reports warnings/errors or the report is changed to reflect the changes done.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada imustakim Canada
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡จ๐Ÿ‡ฆCanada imustakim Canada

    Patch updated.
    Please review.

  • First commit to issue fork.
  • Status changed to Fixed over 1 year ago
  • ๐Ÿ‡ท๐Ÿ‡บRussia anrkaid
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024