Showing 251 of 4,109 total issues
Function scrape_status_description
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def scrape_status_description(self):
return (
"Scraped all game data"
if self.scraped_all_game_data
else (
- 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 describe_at_bat
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def describe_at_bat(self, at_bat_id, final_event_in_at_bat, pfx_data, missing_pitch_numbers):
if missing_pitch_numbers:
pfx_data = None
pitch_sequence = final_event_in_at_bat["pitch_sequence"]
result = self.get_total_pitches_in_sequence(pitch_sequence)
- 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 parse_scraped_html
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def parse_scraped_html(self):
parsed = 0
for game_date in self.date_range:
pitch_logs_for_date = self.scraped_data.get_all_brooks_pitch_logs_for_date(game_date)
if not pitch_logs_for_date:
- 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 view_boxscore
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def view_boxscore(self, team_id, player_type):
boxscore = self.get_boxscore(team_id, player_type)
while True:
subprocess.run(["clear"])
result = self.select_player_prompt(player_type, boxscore)
- 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 sanitize_value_for_csv
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def sanitize_value_for_csv(val, date_format):
if isinstance(val, str):
val = val.replace(",", ";")
return (
val.strftime(date_format).strip()
- 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 parse_scraped_html
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def parse_scraped_html(self):
parsed = 0
for game_date in self.date_range:
brooks_games_for_date = self.scraped_data.get_brooks_games_for_date(game_date)
if not brooks_games_for_date:
- 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 combine_pbp_events_with_pfx_data
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def combine_pbp_events_with_pfx_data(self):
(self.at_bat_ids, at_bat_ids_invalid_pfx) = self.reconcile_at_bat_ids()
all_removed_pfx = {}
all_pfx_ab_ids = []
self.game_events_combined_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 patch_invalid_pfx_single_game
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def patch_invalid_pfx_single_game(self):
result = self.patch_invalid_pfx.execute(self.game_id)
if result.failure:
header = f"Invalid PitchFX Data for {self.game_id}\n"
subprocess.run(["clear"])
- 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 from_dict
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def from_dict(cls, bbref_game_id, bat_stats_dict):
bbref_data = bat_stats_dict.pop("bbref_data", {})
bbref_data["bbref_game_id"] = bbref_game_id
bbref_data["player_id_mlb"] = bat_stats_dict["batter_id_mlb"]
bbref_data["player_id_bbref"] = bat_stats_dict["batter_id_bbref"]
- 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 parse_scraped_html
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def parse_scraped_html(self):
parsed = 0
self.spinner.text = self.url_tracker.parse_html_report(parsed)
for urls_for_date in self.url_tracker.all_urls.values():
for url_details in urls_for_date:
- 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 calc_pitch_metrics_for_at_bat
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def calc_pitch_metrics_for_at_bat(self, half_inning, at_bat, ab_num, prev_inn_pfx, prev_ab_pfx):
pitch_samples = []
at_bat_samples = []
inning_samples = []
for count, pfx in enumerate(at_bat["pitchfx"], start=1):
- 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 launch
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def launch(self):
subprocess.run(["clear"])
print_message("*** Job Details ***", fg="bright_yellow", bold=True)
job_details = report_dict(self.job_details, title="", title_prefix="", title_suffix="")
print_message(f"{job_details}\n", wrap=False, fg="bright_yellow")
- 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 _parse_starting_lineup_for_team
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def _parse_starting_lineup_for_team(page_content, team_id, is_home_team, reverse_home_away_status):
lineup = []
if is_home_team:
bat_order_xpath = _HOME_LINEUP_ORDER_XPATH if not reverse_home_away_status else _AWAY_LINEUP_ORDER_XPATH
player_link_xpath = _HOME_LINEUP_PLAYER_XPATH if not reverse_home_away_status else _AWAY_LINEUP_PLAYER_XPATH
- 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 _update_at_bat_result_stats
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def _update_at_bat_result_stats(self, final_pitch_of_ab, game_event):
final_pitch_of_ab["is_final_pitch_of_ab"] = True
at_bat_result = final_pitch_of_ab["des"].lower()
if at_bat_result in AT_BAT_RESULTS_UNCLEAR:
- 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 launch
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def launch(self):
subprocess.run(["clear"])
self.subscribe_to_events()
result = self.select_patch_prompt()
if result.failure:
- 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 retry
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def retry(
*,
max_attempts=2,
delay=1,
exceptions=(Exception,),
- 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 get_all_pbp_events_for_game
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def get_all_pbp_events_for_game(self):
result = self.get_player_id_dict_for_game()
if result.failure:
return result
self.player_id_dict = result.value
- 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 parse_brooks_dashboard_page
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def parse_brooks_dashboard_page(db_session, scraped_html, game_date, url, bbref_games_for_date):
page_content = html.fromstring(scraped_html, base_url=url)
games_for_date = BrooksGamesForDate()
games_for_date.game_date = game_date
games_for_date.game_date_str = game_date.strftime(DATE_ONLY)
- 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 launch
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def launch(self):
while True:
result = self.prompt_user_choose_method_to_select_game()
if result.failure:
break
- 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 calc_pitch_metrics
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def calc_pitch_metrics(self, combined_data):
all_pitch_samples = []
all_at_bat_samples = []
all_inning_samples = []
prev_ab_pfx = None
- 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"