tekulvw/Squid-Plugins

View on GitHub

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
Severity: Major
Found in permissions/permissions.py - About 1 day to fix

    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
    Severity: Minor
    Found in hublinker/hublinker.py - About 6 hrs to fix

      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
      Severity: Minor
      Found in admin/admin.py - About 5 hrs to fix

        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 *
        Severity: Minor
        Found in scheduler/scheduler.py - About 2 hrs to fix

          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(
          Severity: Minor
          Found in permissions/permissions.py - About 2 hrs to fix

          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):
          Severity: Minor
          Found in runescape/runescape.py - About 1 hr to fix

          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()
          Severity: Minor
          Found in admin/admin.py - About 1 hr to fix

          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!
          Severity: Minor
          Found in encoder/encoder.py - About 1 hr to fix

          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,
          Severity: Major
          Found in encoder/encoder.py - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                                    if msg is not None:
                                        await self.bot.send_message(channel, msg)
                        await asyncio.sleep(300)
            Severity: Major
            Found in rss/rss.py - About 45 mins to fix

              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,
              Severity: Major
              Found in rss/rss.py - About 45 mins to fix

                Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def __init__(self, esong, audio_instance, connected, player, after=None):
                Severity: Minor
                Found in encoder/encoder.py - About 35 mins to fix

                  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?
                  Severity: Minor
                  Found in encoder/encoder.py - About 35 mins to fix

                  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
                  
                  
                  Severity: Minor
                  Found in hublinker/hublinker.py - About 35 mins to fix

                  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
                  Severity: Major
                  Found in logger/logger.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return "Debug"
                    Severity: Major
                    Found in logger/logger.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return "Not set"
                      Severity: Major
                      Found in logger/logger.py - About 30 mins to fix

                        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(
                        Severity: Minor
                        Found in tickets/tickets.py - About 25 mins to fix

                        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"
                        Severity: Minor
                        Found in logger/logger.py - About 25 mins to fix

                        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
                        Severity: Minor
                        Found in rss/rss.py - About 25 mins to fix

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language