picandocodigo/List-Category-Posts

View on GitHub
include/lcp-paginator.php

Summary

Maintainability
C
1 day
Test Coverage

Method get_pagination has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public function get_pagination($params){
    if (LcpUtils::lcp_show_pagination($params['pagination'])){
      $lcp_paginator = '';
      $pages_count = ceil (
        $params['posts_count'] /
Severity: Major
Found in include/lcp-paginator.php - About 2 hrs to fix

    Function get_pagination has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

      public function get_pagination($params){
        if (LcpUtils::lcp_show_pagination($params['pagination'])){
          $lcp_paginator = '';
          $pages_count = ceil (
            $params['posts_count'] /
    Severity: Minor
    Found in include/lcp-paginator.php - About 2 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 lcp_page_link has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function lcp_page_link($page, $current_page, $lcp_instance, $bookmark, $char = null){
        $link = '';
    
        if ($page == $current_page){
          $link = "<li class='lcp_currentpage'>" . esc_html($current_page) . '</li>';
    Severity: Minor
    Found in include/lcp-paginator.php - About 1 hr to fix

      Function lcp_page_link has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          private function lcp_page_link($page, $current_page, $lcp_instance, $bookmark, $char = null){
          $link = '';
      
          if ($page == $current_page){
            $link = "<li class='lcp_currentpage'>" . esc_html($current_page) . '</li>';
      Severity: Minor
      Found in include/lcp-paginator.php - About 1 hr 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 lcp_page_link has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          private function lcp_page_link($page, $current_page, $lcp_instance, $bookmark, $char = null){
      Severity: Minor
      Found in include/lcp-paginator.php - About 35 mins to fix

        There are no issues that match your filters.

        Category
        Status