dhgwilliam/google-voice-stats

View on GitHub
helpers.rb

Summary

Maintainability
C
1 day
Test Coverage

Method person_by has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  def person_by(person = nil, time_period = "month")
    messages = []
    unless person.nil?
      Message.find(:sent_by_id => person.id).union(:sent_to_id => person.id).each {|message| messages << message}
    else
Severity: Minor
Found in helpers.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 graph has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def graph
    sip_hash = {}
    sips = get_sip_corpus(false)
    sips.each do |word|
      sip_hash[word] = who_has_sip(word)
Severity: Minor
Found in helpers.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 build_dic has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def build_dic(person_id = nil, time_period = nil)
    unless person_id.nil? then dictionary = "dic_#{person_id}" else dictionary = "dic_all" end
    unless person_id.nil? then Ohm.redis.zremrangebyrank(dictionary, 0, -1)  end
    messages = {}
    unless person_id.nil?
Severity: Minor
Found in helpers.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 person_by has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def person_by(person = nil, time_period = "month")
    messages = []
    unless person.nil?
      Message.find(:sent_by_id => person.id).union(:sent_to_id => person.id).each {|message| messages << message}
    else
Severity: Minor
Found in helpers.rb - About 1 hr to fix

    Method generate_sip_corpus has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def generate_sip_corpus
        sip_corpus = {}
        Person.all.each do |person|
          unless person.id == "1"
            @dictionary = sips_for(person.id, false)
    Severity: Minor
    Found in helpers.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 graph has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def graph
        sip_hash = {}
        sips = get_sip_corpus(false)
        sips.each do |word|
          sip_hash[word] = who_has_sip(word)
    Severity: Minor
    Found in helpers.rb - About 1 hr to fix

      There are no issues that match your filters.

      Category
      Status