picandocodigo/List-Category-Posts

View on GitHub

Showing 50 of 50 total issues

Method get_thumbnail has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  public function get_thumbnail($single, $thumbnail, $thumbnail_size, $force_thumbnail, $lcp_thumb_class = null){
Severity: Minor
Found in include/lcp-thumbnail.php - About 35 mins to fix

    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

      Method get_post_title has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        public function get_post_title($single, $tag = null, $css_class = null,
          $link = true, $link_current = true) {
      Severity: Minor
      Found in include/lcp-catlistdisplayer.php - About 35 mins to fix

        Function assign_style has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          private function assign_style($info, $tag = null, $css_class = null){
            if (!empty($info)):
              if (empty($tag) && !empty($css_class)):
                $tag = "span";
              elseif (empty($tag)):
        Severity: Minor
        Found in include/lcp-wrapper.php - About 35 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

        Function lcp_categories has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          private function lcp_categories($categories, $child_categories, $exclude) {
            $args = array();
        
            if (is_array($categories)) {
              // Handle excluded categories for the 'and' relationship.
        Severity: Minor
        Found in include/lcp-category.php - About 35 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

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

          private function get_post_primary_category( $post_id ) {
            $return = null;
        
            if ( class_exists( 'WPSEO_Primary_Term' ) ) {
              // Show Primary category by Yoast if it is enabled & set
        Severity: Minor
        Found in include/lcp-category.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

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

          public function get_lcp_category($params, &$lcp_category_id=0) {
            // Only used when excluded categories are combined with 'and' relationship.
            $exclude = [];
            // This will be the value of lcp_category_id which is passed by reference.
            $categories = $lcp_category_id;
        Severity: Minor
        Found in include/lcp-category.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

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

          private function check_youtube_thumbnail($single, $lcp_thumb_class){
            $content = $single->content;
            
            # youtube.com/watch?v=id
            $yt_pattern = '/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)/';
        Severity: Minor
        Found in include/lcp-thumbnail.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

        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

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

          public function get_author_to_show($single) {
            if ($this->params['author'] == 'yes') {
              $lcp_userdata = get_userdata($single->post_author);
              $author_name =  $lcp_userdata->display_name;
              if($this->utils->lcp_not_empty('author_posts_link') &&
        Severity: Minor
        Found in include/lcp-catlist.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

        Severity
        Category
        Status
        Source
        Language