picandocodigo/List-Category-Posts

View on GitHub
include/lcp-parameters.php

Summary

Maintainability
C
7 hrs
Test Coverage

Function get_query_params has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

  public function get_query_params($params){
    $this->params = $params;
    # Essential parameters:
    $args = array(
      'numberposts' => $params['numberposts'],
Severity: Minor
Found in include/lcp-parameters.php - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method get_query_params has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public function get_query_params($params){
    $this->params = $params;
    # Essential parameters:
    $args = array(
      'numberposts' => $params['numberposts'],
Severity: Major
Found in include/lcp-parameters.php - About 2 hrs to fix

    Function lcp_check_excludes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      private function lcp_check_excludes($args){
        if( $this->utils->lcp_not_empty('excludeposts') ){
          $excludeposts = explode(',', $this->params['excludeposts']);
    
          $this_index = array_search("this", $excludeposts);
    Severity: Minor
    Found in include/lcp-parameters.php - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    There are no issues that match your filters.

    Category
    Status