Showing 24 of 45 total issues
File game.py
has 565 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
"""Module that is used for getting basic information about a game
such as the scoreboard and the box score.
"""
File info.py
has 434 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
"""Module that is used for getting information
about the (MLB) league and the teams in it.
"""
Function scoreboard
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def scoreboard(year, month, day, home=None, away=None):
"""Return the scoreboard information for games matching the parameters
as a dictionary.
"""
# get data
- 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 stats.py
has 286 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
"""Module that controls getting stats and creating objects to hold that
information."""
Function games
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def games(years, months=None, days=None, home=None, away=None):
"""Return a list of lists of games for multiple days.
If home and away are the same team, it will return all games for that team.
"""
- 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
Function __raw_player_stats_info
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def __raw_player_stats_info(data):
home_pitchers = []
away_pitchers = []
home_batters = []
away_batters = []
- 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
Function players
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def players(game_id):
"""Gets player/coach/umpire information for the game with matching id."""
# get data
data = mlbgame.data.get_players(game_id)
# parse data
- 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
Function __inning_info
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def __inning_info(inning, part, endpoint):
# info
info = []
# loop through the half
# Added more robust exception handling to catch final innings'
- 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
Function __raw_team_stats_info
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def __raw_team_stats_info(data, output):
for team in data.findall('team'):
home_flag = team.attrib['team_flag'] == 'home'
pitching = team.find('pitching')
stats = {}
- 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
Function __player_stats_info
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def __player_stats_info(data, name):
home = []
away = []
for y in data:
# loops through pitchers and batters
- 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
Function standings
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def standings(date):
DIVISIONS = {
'AL': {
'201': 'AL East',
'202': 'AL Central',
- 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
Avoid deeply nested control flow statements. Open
if game:
results.append(game)
return results
Function __init__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, data):
"""Creates a `GameScoreboard` object.
data is expected to come from the `scoreboard()` function.
"""
- 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
Function __init__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, data, inning):
"""Creates an inning object that matches the corresponding
info in `data`.
`data` should be a dictionary of values.
- 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
Consider simplifying this complex logical expression. Open
if (home_name == home and home is not None) \
or (away_name == away and away is not None) \
or (away is None and home is None):
# throw all the data into a complicated dictionary
game_tag = game.tag
Function games
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def games(years, months=None, days=None, home=None, away=None):
Function scoreboard
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def scoreboard(year, month, day, home=None, away=None):
Function day
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def day(year, month, day, home=None, away=None):
Function __init__
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, data):
"""Creates an at bat object that matches the corresponding
info in `data`.
`data` should be a dictionary of values.
- 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
Function __init__
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, data, game_id, player):
"""Creates a players object that matches the corresponding info in `data`.
`data` should be an dictionary of values.
'game_id' should be the id for the game.
"""
- 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"