Fix the issues reported by phpcs

Created on 20 March 2023, almost 2 years ago
Updated 21 June 2023, over 1 year ago

Problem/Motivation

Resolve the PHP Coding standard issue.

FILE: /var/www/html/web/modules/custom/token_views_filter/tests/modules/token_views_filter_test/token_views_filter_test.tokens.inc
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 1 WARNING AFFECTING 4 LINES
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] Missing file doc comment
  3 | ERROR   | [x] When importing a class with "use", do not include a leading \
  6 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements
    |         |     hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates."
 25 | ERROR   | [x] Expected 1 blank line after function; 2 found
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/custom/token_views_filter/tests/src/Functional/TokenViewsFilterTest.php
-------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------
 28 | ERROR | The array declaration extends to column 88 (the limit is 80). The array content should be split up over multiple lines
-------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/custom/token_views_filter/tests/src/Kernel/TokenReplacementTest.php
--------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 4 WARNINGS AFFECTING 6 LINES
--------------------------------------------------------------------------------------------------------------------------------------------
  28 | ERROR   | [ ] The array declaration extends to column 85 (the limit is 80). The array content should be split up over multiple lines
  80 | WARNING | [x] A comma should follow the last multiline array item. Found: 'date'
  90 | WARNING | [x] A comma should follow the last multiline array item. Found: 'date'
 139 | WARNING | [x] A comma should follow the last multiline array item. Found: 'date'
 149 | WARNING | [x] A comma should follow the last multiline array item. Found: 'date'
 153 | ERROR   | [x] Expected 1 blank line after function; 2 found
--------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/custom/token_views_filter/README.md
-------------------------------------------------------------------------
FOUND 8 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
-------------------------------------------------------------------------
 27 | WARNING | [ ] Line exceeds 80 characters; contains 86 characters
 32 | WARNING | [ ] Line exceeds 80 characters; contains 84 characters
 85 | ERROR   | [x] Expected 1 space before "/"; 0 found
 85 | ERROR   | [x] Expected 1 space after "/"; 0 found
 85 | ERROR   | [x] Expected 1 space before "/"; 0 found
 85 | ERROR   | [x] Expected 1 space after "/"; 0 found
 85 | ERROR   | [x] Concat operator must be surrounded by a single space
 85 | ERROR   | [x] Concat operator must be surrounded by a single space
 90 | ERROR   | [x] Concat operator must be surrounded by a single space
 90 | ERROR   | [x] Concat operator must be surrounded by a single space
-------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------


FILE: /var/www/html/web/modules/custom/token_views_filter/src/TokensFilterTrait.php
-----------------------------------------------------------------------------------
FOUND 4 ERRORS AND 1 WARNING AFFECTING 5 LINES
-----------------------------------------------------------------------------------
  76 | ERROR   | [x] Doc comment long description must end with a full stop
  89 | ERROR   | [x] Whitespace found at end of line
  91 | ERROR   | [x] Whitespace found at end of line
 113 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
 139 | ERROR   | [x] Expected 1 newline at end of file; 2 found
-----------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------

Steps to reproduce

Run the Code sniffer

Run the phpcs --standard="DrupalPractice,DrupalStandard" token_views_filter

Proposed resolution

Resolve the PHPCS issues.

Remaining tasks

Testing

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India arunkumark Coimbatore

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 @arunkumark
  • @arunkumark opened merge request.
  • Status changed to Needs review almost 2 years ago
  • Status changed to Needs work almost 2 years ago
  • 🇮🇳India Akram Khan Cuttack, Odisha

    checked MR still there are one issue

    FILE: ...ktop/Contribution/drupal9.5.x/drupal/modules/contrib/token_views_filter/src/TokensFilterTrait.php
    -------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------
    139 | ERROR | [x] Expected 1 newline at end of file; 2 found
    -------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------

  • Status changed to Needs review almost 2 years ago
  • 🇮🇳India Akram Khan Cuttack, Odisha

    added updated patch and Fixed remaining issue

  • Assigned to akshaydalvi212
  • 🇮🇳India akshaydalvi212

    hello Team,

    I will review the patch #5.

  • Issue was unassigned.
  • 🇮🇳India akshaydalvi212

    Hello Team,

    Patch #5 gets applied and fixes all the issues reported by PHPCS.
    so #5 is ready to move to RTBC. i.e. RTBC +1.

  • Status changed to Needs work almost 2 years ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    -        // Value can be optional, For example for 'empty' and 'not empty' filters.
    +        // Value can be optional, For example 'empty' and 'not empty' filters.

    After a comma, for is not spelled in capital case.

    +/**
    + * @file
    + * Contains the Hook implementations.
    + */

    Hook does not need to be in capital case, since it is not at the beginning of a sentence.

    That comment is usually Hook implementations for [module name].

  • Assigned to akshaydalvi212
  • 🇮🇳India akshaydalvi212

    Hello @apaderno

    Will work on the #5 patch and make changes as per your suggection and provide the new patch.

  • Issue was unassigned.
  • Status changed to Needs review almost 2 years ago
  • 🇮🇳India akshaydalvi212

    Fixed remaining issues reported with PHPCS.
    Kindly review.

  • Status changed to Needs work almost 2 years ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    -views.filter.string:
    +views . filter . string:

    That line is correct as it is.

    -   * In case of grouped filters we have to override the parent FilterPluginBase 
    +   * In case of grouped filters we have to override the parent FilterPluginBase
        * method so that we can tokenize the individual group_item's value.

    It is not necessary to say which is the parent class; parent method is sufficient.

    + * @file
    + * Contains the hook implementation for token view filter test.

    The usual comment is Hook implementations for [module name].

    - * Primarily Drupal hooks to manipulate Token Views Filter.
    + * Primarily Drupal hooks to manipulate token views filter.

    Primarily is an adverb; it cannot be used to alter a noun phrase (Drupal hooks).
    Drupal does not make any distinction between primary and secondary hooks. The usual comment is another one.

  • First commit to issue fork.
  • @kkalashnikov opened merge request.
  • First commit to issue fork.
  • @shivam_tiwari opened merge request.
  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    -views.filter.string:
    +views . filter . string:

    It has been already pointed out that change is wrong.

    -        // Value can be optional, For example for 'empty' and 'not empty' filters.
    +        // Value can be optional, For example 'empty' and 'not empty' filters.

    A word after a comma does not need to be written in capital case, except in the case that word is always written in capital case.

    +/**
    + * @file
    + * Hook implementations for [module name].
    + */
    +

    This module name is not [module name]. Clearly, in my previous comment, I used a placeholder since, speaking for every module, I cannot list the names of every module.

  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    +/**
    + * @file
    + * Hook implementations for tokens in views filter criteria.
    + */

    The module name should also respect uppercase letters.

    /**
      * @file
    - * Primarily Drupal hooks to manipulate Token Views Filter.
    + * Primarily Drupal hooks to manipulate token views filter.
      */

    That comment is not correct for the reasons I have already reported. It does not describe the purpose of the functions contained in the token_views_filter.views.inc file, then.

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India amit.rawat777

    I have fixed the issue please review.

  • 🇮🇳India shivam_tiwari

    I updated commit, Please review now.

  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
     /**
      * @file
    - * Primarily Drupal hooks to manipulate Token Views Filter.
    + * Hooks to modify views filter handler plugin.
      */

    A .views.inc file contains hook implementations used by the Views module. The correct description is Hook implementations used by the Views module. or Hook implementations used by Views. invoked is a fine replacement for used.

  • 🇮🇳India arunkumark Coimbatore

    As per comment #22, I updated the Description of the hook implementation.

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

    Updated all the code as per the comments. Please check.

  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
     To use token views filter you should redefine original views filter schema 
    -in your module in file `config/schema/{module_name}.schema.yml`
    +in your module in file `config / schema / {module_name} . schema . yml`

    Spaces in file paths are not used. It is already correct as it is.

  • Status changed to Needs review over 1 year ago
  • Status changed to Fixed over 1 year ago
  • 🇷🇺Russia validoll Ekaterinburg

    Thanks for all!!!!
    Changes has been merged to dev branch.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024