Showing 20 of 27 total issues
Method process_spotrac_salary_data
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def self.process_spotrac_salary_data
NflPlayer.find_each do |player|
next if player.full_name == "Kevin Norwood"
next if player.full_name == "Rueben Randle"
next if player.full_name == "Chris Givens"
- Read upRead up
- Create a ticketCreate a ticket
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 process_spotrac_player_data
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def self.process_spotrac_player_data
NflTeam.all.each do |nfl_team|
puts "processing: " + nfl_team.full_name + " " + nfl_team.spotrac_url
nfl_page = Nokogiri::HTML(open(nfl_team.spotrac_url))
- Read upRead up
- Create a ticketCreate a ticket
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
Class NflPlayer
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class NflPlayer < ActiveRecord::Base
attr_accessible :first_name, :last_name, :position, :salary,
:nfl_team_id, :spotrac_url, :full_name, :jersey,
:height, :weight, :dob, :college, :active, :current_status,
:depth_order, :experience, :photo_url, :fantasy_data_id
- Create a ticketCreate a ticket
Method update_stat_with_data_by_position
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def update_stat_with_data_by_position stat, position
stat.played = rand(0..1)
stat.started = rand(0..1)
if position == Position::QUARTERBACK
- Read upRead up
- Create a ticketCreate a ticket
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 update_stat_with_data_by_position
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_stat_with_data_by_position stat, position
stat.played = rand(0..1)
stat.started = rand(0..1)
if position == Position::QUARTERBACK
- Create a ticketCreate a ticket
Method col4_for_header
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def col4_for_header header_category, year, week
val = 0
if is_passing_header?(header_category)
stat = @player.passing_stats.where({season: year, week: week}).first
val = stat.passing_interceptions if stat
- Read upRead up
- Create a ticketCreate a ticket
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 col2_for_header
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def col2_for_header header_category, year, week
val = 0
if is_passing_header?(header_category)
stat = @player.passing_stats.where({season: year, week: week}).first
val = stat.passing_yards if stat
- Read upRead up
- Create a ticketCreate a ticket
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 col3_for_header
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def col3_for_header header_category, year, week
val = 0
if is_passing_header?(header_category)
stat = @player.passing_stats.where({season: year, week: week}).first
val = stat.passing_touchdowns if stat
- Read upRead up
- Create a ticketCreate a ticket
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 process_box_score
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_box_score stat_data
week = stat_data.score.week
season = stat_data.score.season
# process_defense_stat stat_data["AwayFantasyDefense"], week, season
- Create a ticketCreate a ticket
Method import_nfl_player_data
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import_nfl_player_data
NflPlayer.update_all(active: false)
teams = NflTeam.all
Fantasydata.player_details_available.each do |player|
- Create a ticketCreate a ticket
Method defensive_points_allowed_points
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def defensive_points_allowed_points league
return 0 if nfl_player.nil?
return 0 unless nfl_player.position.upcase == "DEF"
if self.points_allowed.to_i < 7
- Read upRead up
- Create a ticketCreate a ticket
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
Avoid deeply nested control flow statements. Open
val = stat.field_goals_made if stat
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
val = stat.extra_points_made if stat
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
val = stat.field_goals_attempted if stat
- Create a ticketCreate a ticket
Method import_nfl_player_data
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def import_nfl_player_data
NflPlayer.update_all(active: false)
teams = NflTeam.all
Fantasydata.player_details_available.each do |player|
- Read upRead up
- Create a ticketCreate a ticket
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
Avoid too many return
statements within this method. Open
return league.defensive_points_allowed_under_35_points
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return league.defensive_points_allowed_under_28_points
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return league.defensive_points_allowed_under_21_points
- Create a ticketCreate a ticket
Method stat_catagories_headers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def stat_catagories_headers
if @player.position == Position::QUARTERBACK
["Passing", "Rushing"]
elsif @player.position == Position::RUNNINGBACK
- Read upRead up
- Create a ticketCreate a ticket
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 sortable_link
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def sortable_link(column, title = nil)
title ||= column.titleize
css_class = column == sort_column ? "current #{sort_direction}" : nil
direction = column == sort_column && sort_direction == "asc" ? "desc" : "asc"
link_to title, params.merge(:sort => column, :direction => direction, :page => nil), {:class => css_class}
- Read upRead up
- Create a ticketCreate a ticket
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"