Showing 5 of 104 total issues
Class Match
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Match < ActiveRecord::Base
WINNER_SQL = %{ "matches"."victor_id" }.freeze
LOSER_SQL = <<-SQL.freeze
CASE
WHEN "matches"."victor_id" = "home_player_id" THEN "away_player_id"
Class Personal
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Stats::Personal
def initialize(player)
@player = player
end
Function InactivePlayersList
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const InactivePlayersList = (props) => {
const { retiredPlayers, unretiredPlayers, activatePlayer } = props
const retiredPlayerListItems = retiredPlayers.map((player) => {
return (
Method setup!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def self.setup!(matchup = nil, table: Table.default)
matchup ||= Matchmaker.choose
return unless matchup.valid?
player1, player2 = *matchup.players.sort_by(&:name)
- 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
Method game_point
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def game_point
return if finished?
if highest_score >= 10 && score_differential > 0
leader == home_player ? :home : :away
end
- 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"