Showing 35 of 211 total issues
Function score_games
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def score_games() -> set:
"""Score all unscored games."""
start = time.time()
scored_players = set()
s = orm.get_session()
- 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 _reraise_dberror
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _reraise_dberror(function: Callable) -> Callable:
"""Re-raise errors from decorated function as DBError or DBIntegrityError.
Doesn't re-wrap DBError/DBIntegrityError exceptions.
"""
- 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 is_grief
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def is_grief(s: sqlalchemy.orm.session.Session, game: orm.Game) -> bool:
"""Check if the game is a streak-breaking grief.
This involves experimental anti-griefing heuristics.
"""
- 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 generic_highscores_to_table
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def generic_highscores_to_table(
Function fastest_wins
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def fastest_wins(
Function write_website
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def write_website(
players: Optional[Iterable], urlbase: str, extra_player_pages: int
) -> None:
"""Write all website files.
- 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 streakstotable
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def streakstotable(
streaks: Sequence[orm.Streak],
show_player: bool = True,
show_loss: bool = True,
limit: Optional[int] = 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"
Further reading
Function version_url
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def version_url(version: str) -> str:
"""Cleans up version strings for use in morgue URLs."""
if version[-2:] == "a0":
return "trunk"
if len(version) > 4:
- 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 too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return True
Avoid too many return
statements within this function. Open
return False
Function combo_highscores
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def combo_highscores(s: sqlalchemy.orm.session.Session) -> Sequence[Game]:
"""Return the top score for each playable combo.
Not every combo may have a game in the database.
"""
- 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 rsync_replacement
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def rsync_replacement(src: str, dst: str) -> None:
"""Poor replacement for rsync on win32.
Needed because shutil.copytree can't handle already existing dest dir.
"""
- 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 fastest_wins
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def fastest_wins(
s: sqlalchemy.orm.session.Session,
*,
limit: int = const.GLOBAL_TABLE_LENGTH,
exclude_bots: bool = True,
- 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 setup_achievements
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def setup_achievements(s: sqlalchemy.orm.session.Session) -> None:
"""Load manual achievements into the database."""
for proto in const.ACHIEVEMENTS:
if (
not s.query(Achievement)
- 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"