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

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

arunkumark created an issue. See original summary.

arunkumark’s picture

Status: Active » Needs review
akram khan’s picture

Status: Needs review » Needs work

checked MR still there is 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
-------------------------------------------------------------------------------------------------------

akram khan’s picture

Status: Needs work » Needs review
StatusFileSize
new5.97 KB
new160 bytes

added updated patch and Fixed remaining issue

akshaydalvi212’s picture

Assigned: Unassigned » akshaydalvi212

hello Team,

I will review the patch #5.

akshaydalvi212’s picture

Assigned: akshaydalvi212 » Unassigned
StatusFileSize
new47.59 KB

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.

avpaderno’s picture

Status: Needs review » Needs work
-        // 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].

akshaydalvi212’s picture

Assigned: Unassigned » akshaydalvi212

Hello @apaderno

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

akshaydalvi212’s picture

Assigned: akshaydalvi212 » Unassigned
Status: Needs work » Needs review
StatusFileSize
new6.33 KB

Fixed remaining issues reported with PHPCS.
Kindly review.

avpaderno’s picture

Status: Needs review » Needs work
-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.

kkalashnikov made their first commit to this issue’s fork.

shivam_tiwari made their first commit to this issue’s fork.

shivam_tiwari’s picture

Status: Needs work » Needs review
avpaderno’s picture

Status: Needs review » Needs work
-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.

shivam_tiwari’s picture

Status: Needs work » Needs review
avpaderno’s picture

Status: Needs review » Needs work
+/**
+ * @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.

amit.rawat777’s picture

Status: Needs work » Needs review
StatusFileSize
new5.86 KB

I have fixed the issue please review.

shivam_tiwari’s picture

I updated commit, Please review now.

avpaderno’s picture

Status: Needs review » Needs work
 /**
  * @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.

arunkumark’s picture

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

arunkumark’s picture

Status: Needs work » Needs review
shivam_tiwari’s picture

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

avpaderno’s picture

Status: Needs review » Needs work
 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.

shivam_tiwari’s picture

Status: Needs work » Needs review
validoll’s picture

Status: Needs review » Fixed

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

Status: Fixed » Closed (fixed)

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