lib/sportradar/api/basketball/game.rb
Class Game
has 55 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Game < Data
attr_accessor :response, :id, :title, :home_id, :away_id, :score, :status, :coverage, :time_zone, :scheduled, :venue, :broadcast, :clock, :duration, :attendance, :team_stats, :player_stats, :changes, :media_timeouts
attr_accessor :period
@all_hash = {}
Method update
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
Open
def update(data, source: nil, **opts)
# via pbp
@status = data['status'] if data['status']
@coverage = data['coverage'] if data['coverage']
@home_id = data['home_team'] || data.dig('home', 'id') if data['home_team'] || data.dig('home', 'id')
- Read upRead up
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
File game.rb
has 287 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module Sportradar
module Api
module Basketball
class Game < Data
attr_accessor :response, :id, :title, :home_id, :away_id, :score, :status, :coverage, :time_zone, :scheduled, :venue, :broadcast, :clock, :duration, :attendance, :team_stats, :player_stats, :changes, :media_timeouts
Method ingest_pbp
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
def ingest_pbp(data)
period_name = 'periods'
update(data, source: :pbp)
period_data = if data[period_name] && !data[period_name].empty?
@period = data[period_name].last['sequence'].to_i
- Read upRead up
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"