Showing 43 of 43 total issues
Function create_sql
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def create_sql(self):
if not self.name:
raise RuntimeError('Column should be defined inside a table subclass.')
builder = [self.name, self.type.sql]
- 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_emoji_message
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_emoji_message(self, message, stars):
emoji = self.star_emoji(stars)
if stars > 1:
content = f'{emoji} **{stars}** {message.channel.mention} ID: {message.id}'
- 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 _create_embed
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _create_embed(self, number, action, mod, targets, reason, extra, time=None):
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, type, *, primary_key=False, nullable=False, unique=False, default=None):
Avoid deeply nested control flow statements. Open
if match:
author_ids.append(int(match.group('id')))
continue
Function __init_subclass__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init_subclass__(cls, *, game_cls, name=None, cmd=None, aliases=(), **kwargs):
Function _build_command_requirements
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _build_command_requirements(command):
requirements = []
# All commands in this cog are owner-only anyways
if command.cog_name == 'Owner':
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, ctx, entries, *, per_page=15, title=discord.Embed.Empty, color=None):
Function __new__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __new__(cls, time, event, args=None, kwargs=None, created=None, id=None):
Function _split_params
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _split_params(command):
"""Splits a command's parameters into required and optional parts."""
params = command.clean_params.values()
required = list(itertools.takewhile(_is_required_parameter, params))
- 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 instructions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def instructions(self):
"""Table of Contents."""
self._index = -1
ctx = self.ctx
- 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 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, destination, content=None, *, file=None, embed=None):
Function __init_subclass__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init_subclass__(cls, *, board_factory, move_pattern=None, timeout=120):
Function _add_to_cache
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _add_to_cache(self, name, guild_id, member_id, *, seconds=2):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, column, *, type=None, on_delete='CASCADE', on_update='NO ACTION'):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, ctx, entries, *, inline=True, **kwargs):
Function trigger
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def trigger(emoji, pattern=None, *, blocking=False, fallback=None):
Function _create_embed
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _create_embed(self, number, action, mod, targets, reason, extra, time=None):
time = time or datetime.utcnow()
action = _mod_actions[action]
bot_avatar = self.bot.user.avatar_url
- 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 legal_moves
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def legal_moves(self):
"""Generates all legal moves in the current position.
If there are any jumps one could make, those get generated instead,
as jumps must be made according to the rules of Checkers.
- 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 move
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def move(self, move):
"""Takes a move and apply it to the game."""
if move not in self.legal_moves():
raise ValueError(f'illegal move: {move!r}')
- 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"