suer/redmine_issues_summary_graph

View on GitHub

Showing 14 of 14 total issues

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

  def generate_summary_graph(closed_issue_status_ids, tracker_ids, version_ids, from, to)
    closed_issue_map = {}
    open_issue_map = {}
    total_issue_num = 0

Severity: Minor
Found in app/helpers/issues_summary_graph_helper.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 issue_closed_date has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def issue_closed_date(issue, closed_issue_status_ids)
    issue.journals.each do |journal|
      if journal.details.size == 0
        return (closed_issue_status_ids.include?(issue.status.id) ? issue.updated_on : nil)
      end
Severity: Minor
Found in app/helpers/issues_summary_graph_helper.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 generate_summary_graph has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def generate_summary_graph(closed_issue_status_ids, tracker_ids, version_ids, from, to)
    closed_issue_map = {}
    open_issue_map = {}
    total_issue_num = 0

Severity: Minor
Found in app/helpers/issues_summary_graph_helper.rb - About 1 hr to fix

    Method draw_line has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      def draw_line(issue_map, start_date, duration, gc, color, issue_num)
        top_issue_num = border_step(issue_num) * LINE_NUM
        x_base = PADDING
        y_base = SUMMARY_IMAGE_HEIGHT - PADDING
        x = x_base
    Severity: Minor
    Found in app/helpers/issues_summary_graph_helper.rb - 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 show has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      def show
        @from = params[:from]
        @from = DEFAULT_START_DATE.strftime('%Y-%m-%d') if @from.blank? and request.get?
    
        @to = params[:to]
    Severity: Minor
    Found in app/controllers/issues_summary_graph_controller.rb - 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 draw_line has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def draw_line(issue_map, start_date, duration, gc, color, issue_num)
        top_issue_num = border_step(issue_num) * LINE_NUM
        x_base = PADDING
        y_base = SUMMARY_IMAGE_HEIGHT - PADDING
        x = x_base
    Severity: Minor
    Found in app/helpers/issues_summary_graph_helper.rb - About 1 hr to fix

      Method draw_summary_graph has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def draw_summary_graph(start_date, total_issue_num, open_issue_map,  closed_issue_map, duration)
          img = MiniMagick::Image.create(".png", false)
          MiniMagick::Tool::Convert.new do |gc|
            gc.size('%dx%d' % [SUMMARY_IMAGE_WIDTH, SUMMARY_IMAGE_HEIGHT])
            gc.xc('white')
      Severity: Minor
      Found in app/helpers/issues_summary_graph_helper.rb - About 1 hr to fix

        Method draw_line has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def draw_line(issue_map, start_date, duration, gc, color, issue_num)
        Severity: Minor
        Found in app/helpers/issues_summary_graph_helper.rb - About 45 mins to fix

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

            def generate_summary_graph(closed_issue_status_ids, tracker_ids, version_ids, from, to)
          Severity: Minor
          Found in app/helpers/issues_summary_graph_helper.rb - About 35 mins to fix

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

              def draw_summary_graph(start_date, total_issue_num, open_issue_map,  closed_issue_map, duration)
            Severity: Minor
            Found in app/helpers/issues_summary_graph_helper.rb - About 35 mins to fix

              Method border_step has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                def border_step(issue_num)
                  return 1 if issue_num <= 10
                  digit = issue_num.to_s.size
                  if digit == 2
                    return 5 if issue_num <= 50
              Severity: Minor
              Found in app/helpers/issues_summary_graph_helper.rb - 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

              Method draw_summary_graph has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def draw_summary_graph(start_date, total_issue_num, open_issue_map,  closed_issue_map, duration)
                  img = MiniMagick::Image.create(".png", false)
                  MiniMagick::Tool::Convert.new do |gc|
                    gc.size('%dx%d' % [SUMMARY_IMAGE_WIDTH, SUMMARY_IMAGE_HEIGHT])
                    gc.xc('white')
              Severity: Minor
              Found in app/helpers/issues_summary_graph_helper.rb - 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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                    start_date = Date.parse((sorted_open_issue_map[0][0] < sorted_closed_issue_map[0][0]) ? sorted_open_issue_map[0][0] : sorted_closed_issue_map[0][0])
              Severity: Minor
              Found in app/helpers/issues_summary_graph_helper.rb and 1 other location - About 15 mins to fix
              app/helpers/issues_summary_graph_helper.rb on lines 58..58

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 25.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                    end_date = Date.parse((sorted_open_issue_map[-1][0] > sorted_closed_issue_map[-1][0]) ? sorted_open_issue_map[-1][0] : sorted_closed_issue_map[-1][0])
              Severity: Minor
              Found in app/helpers/issues_summary_graph_helper.rb and 1 other location - About 15 mins to fix
              app/helpers/issues_summary_graph_helper.rb on lines 57..57

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 25.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Severity
              Category
              Status
              Source
              Language