meissadia/hoopscrape

View on GitHub

Showing 6 of 6 total issues

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

def generate_toc(filename)
  data = read_file(filename)
  base = 2
  indent = [0]
  last = base
Severity: Minor
Found in readme/generate.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 processSeason has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def processSeason(schedule, tid, year1, seasontype, new_form)
    seasontype = seasontype.to_i
    game_id = 0 # 82-game counter

    # Process Schedule lines
Severity: Minor
Found in lib/hoopscrape/NbaSchedule.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 processTeamRow has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def processTeamRow(row, tid, new_form)
    result = []
    row.children.each do |cell|
      c_val = cell.text.strip
      case cell.attribute('class').text
Severity: Minor
Found in lib/hoopscrape/NbaBoxScore.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

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

  def processSeason(schedule, tid, year1, seasontype, new_form)
Severity: Minor
Found in lib/hoopscrape/NbaSchedule.rb - About 35 mins to fix

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

      def saveProcessedScheduleRow(tmp, game_date, season_type, new_form, game_in_past)
    Severity: Minor
    Found in lib/hoopscrape/NbaSchedule.rb - About 35 mins to fix

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

        def saveProcessedScheduleRow(tmp, game_date, season_type, new_form, game_in_past)
          tmp << game_date                    # Game DateTime
          tmp << season_type.to_s             # Season Type
          @game_list << tmp if new_form.nil?  # Save processed Array
          @game_list += tmp.send(new_form, game_in_past ? S_GAME_P : S_GAME_F) unless new_form.nil? # Conversion
      Severity: Minor
      Found in lib/hoopscrape/NbaSchedule.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

      Severity
      Category
      Status
      Source
      Language