Problem/Motivation

It is likely that there are bugs remaining in code.

Note: I removed threshold warnings from the reports.

PHP MD:

FILE: /project/app/modules/custom/views_merge_rows/src/HookHandler/ViewsPreRenderHookHandler.php
------------------------------------------------------------------------------------------------
 167  | VIOLATION | Avoid using undefined variables such as '$merged_row_replaced' which will lead to PHP notices.
 171  | VIOLATION | Avoid using undefined variables such as '$merged_row_replaced' which will lead to PHP notices.
 1182 | VIOLATION | Avoid assigning values to variables in if clauses and the like (line '1201', column '9').

PHP CPD:

phpcpd 6.0.3 by Sebastian Bergmann.

Found 2 clones with 103 duplicated lines in 1 files:

  - /project/app/modules/custom/views_merge_rows/src/HookHandler/ViewsPreRenderHookHandler.php:783-846 (63 lines)
    /project/app/modules/custom/views_merge_rows/src/HookHandler/ViewsPreRenderHookHandler.php:886-949

  - /project/app/modules/custom/views_merge_rows/src/HookHandler/ViewsPreRenderHookHandler.php:1032-1072 (40 lines)
    /project/app/modules/custom/views_merge_rows/src/HookHandler/ViewsPreRenderHookHandler.php:1080-1120

6.45% duplicated lines out of 1596 total lines of code.
Average size of duplication is 51 lines, largest clone has 63 of lines

PHPStan:

------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   modules/custom/views_merge_rows/src/HookHandler/ViewsPreRenderHookHandler.php                                                                                                               
 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  262    Cannot access offset 'scheme' on array(?'scheme' => string, ?'host' => string, ?'port' => int, ?'user' => string, ?'pass' => string, ?'path' => string, ?'query' => string, ?'fragment' =>  
         string)|false.                                                                                                                                                                              
  264    Cannot access offset 'query' on Drupal\Core\Url.                                                                                                                                            
  805    Access to property $current_page on an unknown class Drupal\views\Plugin\views\query\views_plugin_pager.                                                                                    
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                                                                                                                          
  805    Access to property $current_page on an unknown class Drupal\views\Plugin\views\query\views_plugin_pager.                                                                                    
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                                                                                                                          
  876    Variable $first_value in isset() is never defined.                                                                                                                                          
  880    Left side of && is always true.                                                                                                                                                             
  908    Access to property $current_page on an unknown class Drupal\views\Plugin\views\query\views_plugin_pager.                                                                                    
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                                                                                                                          
  908    Access to property $current_page on an unknown class Drupal\views\Plugin\views\query\views_plugin_pager.                                                                                    
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                                                                                                                          
  1073   Method Drupal\views_merge_rows\HookHandler\ViewsPreRenderHookHandler::renderMerge() has no return typehint specified.                                                                       
  1201   If condition is always true.                                                                                                                                                                
 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 

 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   modules/custom/views_merge_rows/src/Plugin/views/display_extender/ViewsMergeRowsDisplayExtenderPlugin.php                                                                 
 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  37     Method Drupal\views_merge_rows\Plugin\views\display_extender\ViewsMergeRowsDisplayExtenderPlugin::buildOptionsForm() has parameter $form with no typehint specified.      
  196    Method Drupal\views_merge_rows\Plugin\views\display_extender\ViewsMergeRowsDisplayExtenderPlugin::submitOptionsForm() has parameter $form with no typehint specified.     
  208    Method Drupal\views_merge_rows\Plugin\views\display_extender\ViewsMergeRowsDisplayExtenderPlugin::optionsSummary() has parameter $categories with no typehint specified.  
  208    Method Drupal\views_merge_rows\Plugin\views\display_extender\ViewsMergeRowsDisplayExtenderPlugin::optionsSummary() has parameter $options with no typehint specified.     
 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 

Note: PHPStan warnings on typehints in ViewsMergeRowsDisplayExtenderPlugin.php are not fixable because of inherited methods.

Comments

Grimreaper created an issue. See original summary.

  • Grimreaper authored c4e8949 on 8.x-2.x
    Issue #3211863 by Grimreaper: Fix code quality analysis
    
grimreaper’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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