hstove/issue_stats

View on GitHub

Showing 5 of 5 total issues

Class Report has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

class Report < ActiveRecord::Base
  serialize :basic_distribution, Hash
  serialize :pr_distribution, Hash
  serialize :issues_distribution, Hash

Severity: Minor
Found in app/models/report.rb - About 2 hrs to fix

Method badge_values has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def badge_values(variant, concise=false)
    duration = send("#{variant}_close_time")
    index = Issue.duration_index(duration)

    if variant == 'pr'
Severity: Minor
Found in app/models/report.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 bootstrap has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def bootstrap
    day_split = 8.0
    setup_distributions
    self.issues_count = 0
    durations = []
Severity: Minor
Found in app/models/report.rb - About 1 hr to fix

Method language_highchart has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def language_highchart(pr_values, issues_values, languages)
    LazyHighCharts::HighChart.new('graph') do |f|
      f.title(:text => "Responsiveness by Language")
      f.series name: "Pull Requests", data: pr_values
      f.series name: "Issues", data: issues_values
Severity: Minor
Found in app/helpers/highcharts_helper.rb - About 1 hr to fix

Method duration_tier_from_duration has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def duration_tier_from_duration(duration)
      return 0 unless duration
      duration_tiers.each_with_index do |tier, index|
        last_tier = index == 0 ? 0 : Issue.duration_tiers[index - 1]
        if (duration <= tier) && (duration > last_tier)
Severity: Minor
Found in app/models/issue.rb - About 45 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