Showing 88 of 88 total issues
File permissions.py
has 715 lines of code (exceeds 250 allowed). Consider refactoring. Open
import discord
from discord.ext import commands
from discord.ext.commands import CommandNotFound
from cogs.utils.dataIO import dataIO
from cogs.utils import checks
File hublinker.py
has 417 lines of code (exceeds 250 allowed). Consider refactoring. Open
import discord
from discord.ext import commands
from cogs.utils import checks
from cogs.utils.dataIO import fileIO
from __main__ import send_cmd_help
File admin.py
has 387 lines of code (exceeds 250 allowed). Consider refactoring. Open
import discord
from discord.ext import commands
from cogs.utils import checks
from cogs.utils.dataIO import dataIO
from cogs.utils.chat_formatting import box, pagify
File scheduler.py
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
import discord
from discord.ext import commands
from cogs.utils import checks
from cogs.utils.dataIO import fileIO
from cogs.utils.chat_formatting import *
Function resolve_permission
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def resolve_permission(self, ctx):
command = ctx.command.qualified_name.replace(' ', '.')
server = ctx.message.server
channel = ctx.message.channel
roles = reversed(self._get_ordered_role_list(
- 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 _fmt_hs
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _fmt_hs(self, data):
ret = "```"
retlist = [['Skill', 'Rank', 'Level', 'Experience']]
for i in range(len(data)):
if i < len(self.skill_list):
- 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_default_channel_or_other
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_default_channel_or_other(self, server,
ctype: discord.ChannelType=None,
**perms_required):
perms = discord.Permissions.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 create_ffmpeg_player
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def create_ffmpeg_player(self, filename, *, use_avconv=False, pipe=False,
options=None, before_options=None, headers=None,
after=None):
"""
Stolen from Rapptz/Danny, thanks!
- 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_ffmpeg_player
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_ffmpeg_player(self, filename, *, use_avconv=False, pipe=False,
Avoid deeply nested control flow statements. Open
if msg is not None:
await self.bot.send_message(channel, msg)
await asyncio.sleep(300)
Avoid deeply nested control flow statements. Open
if channel is None:
log.debug("response channel not found, continuing")
continue
msg = await self.get_current_feed(server, chan_id,
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, esong, audio_instance, connected, player, after=None):
Function run
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def run(self):
self.loops = 0
self._start = time.time()
while not self._end.is_set():
# are we paused?
- 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 _slave_role_check
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _slave_role_check(self, master):
mid = master.id
if mid not in self.links:
return
- 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 level_int
Avoid too many return
statements within this function. Open
return "Debug"
Avoid too many return
statements within this function. Open
return "Not set"
Function _get_ticket
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _get_ticket(self):
if len(self.tickets) > 0:
ticket = self.tickets[0]
for idnum in ticket:
ret = ticket[idnum].get(
- 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 _int_to_name
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _int_to_name(self, level_int):
if level_int == logging.CRITICAL:
return "Critical"
elif level_int == logging.ERROR:
return "Error"
- 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_time
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_time(self, server, channel, name, time):
if server in self.feeds:
if channel in self.feeds[server]:
if name in self.feeds[server][channel]:
self.feeds[server][channel][name]['last'] = time
- 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"