crispgm/jekyll-tags-list-plugin

View on GitHub

Showing 6 of 9 total issues

Method parse_params has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_params
        params = @text.split(',')
        params.each do |param|
          key_vals = param.split('=>', 2)
          param_name = key_vals[0].strip
Severity: Minor
Found in lib/jekyll-tagslist/tagslist_tag.rb - About 3 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 render has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

      def render(context)
        tags = context.registers[:site].tags.map do |tag, posts|
          [tag, posts.count] if posts.count >= @threshold
        end

Severity: Minor
Found in lib/jekyll-tagslist/tagslist_tag.rb - 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 render has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def render(context)
        tags = context.registers[:site].tags.map do |tag, posts|
          [tag, posts.count] if posts.count >= @threshold
        end

Severity: Minor
Found in lib/jekyll-tagslist/tagslist_tag.rb - About 1 hr to fix

    Method parse_params has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def parse_params
            params = @text.split(',')
            params.each do |param|
              key_vals = param.split('=>', 2)
              param_name = key_vals[0].strip
    Severity: Minor
    Found in lib/jekyll-tagslist/tagslist_tag.rb - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                  if param_value.eql? 'time'
                    @sort_by  = 'time'
                  elsif param_value.eql? 'count'
                    @sort_by  = 'count'
                  else
      Severity: Major
      Found in lib/jekyll-tagslist/tagslist_tag.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                  elsif param_name.eql? ':limit'
                    param_value = param_value.to_i
                    @limit = param_value if param_value > 0
                  else
                    next
        Severity: Major
        Found in lib/jekyll-tagslist/tagslist_tag.rb - About 45 mins to fix
          Severity
          Category
          Status
          Source
          Language