Jonxslays/Yami

View on GitHub

Showing 18 of 18 total issues

File bot.py has 566 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Yami - A command handler that complements Hikari.
# Copyright (C) 2021-present Jonxslays
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Severity: Major
Found in yami/bot.py - About 1 day to fix

    File context.py has 332 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # Yami - A command handler that complements Hikari.
    # Copyright (C) 2021-present Jonxslays
    #
    # This program is free software: you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    Severity: Minor
    Found in yami/context.py - About 4 hrs to fix

      File commands.py has 329 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # Yami - A command handler that complements Hikari.
      # Copyright (C) 2021-present Jonxslays
      #
      # This program is free software: you can redistribute it and/or modify
      # it under the terms of the GNU General Public License as published by
      Severity: Minor
      Found in yami/commands.py - About 3 hrs to fix

        File checks.py has 328 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # Yami - A command handler that complements Hikari.
        # Copyright (C) 2021-present Jonxslays
        #
        # This program is free software: you can redistribute it and/or modify
        # it under the terms of the GNU General Public License as published by
        Severity: Minor
        Found in yami/checks.py - About 3 hrs to fix

          Bot has 27 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Bot(hikari.GatewayBot):
              """A subclass of :obj:`~hikari.impl.bot.GatewayBot` that provides an
              interface for handling commands.
          
              This is the class you will instantiate to utilize command features
          Severity: Minor
          Found in yami/bot.py - About 3 hrs to fix

            Function add_command has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def add_command(
                    self,
                    command: typing.Callable[..., typing.Any] | commands_.MessageCommand,
                    *,
                    name: str | None = None,
            Severity: Minor
            Found in yami/bot.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 __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(
            Severity: Major
            Found in yami/commands.py - About 1 hr to fix

              Function subcommand has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def subcommand(
              Severity: Major
              Found in yami/commands.py - About 50 mins to fix

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

                    def __init__(
                Severity: Major
                Found in yami/bot.py - About 50 mins to fix

                  Function command has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def command(
                  Severity: Minor
                  Found in yami/bot.py - About 45 mins to fix

                    Function add_command has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def add_command(
                    Severity: Minor
                    Found in yami/bot.py - About 45 mins to fix

                      Function command has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def command(
                      Severity: Minor
                      Found in yami/commands.py - About 45 mins to fix

                        Function load_all_modules has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def load_all_modules(self, *paths: str | Path, recursive: bool = True) -> None:
                                """Loads all modules from each of the given paths.
                        
                                .. note::
                                    This method looks for all ``.py`` files that do not begin
                        Severity: Minor
                        Found in yami/bot.py - About 45 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 add_subcommand has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def add_subcommand(
                        Severity: Minor
                        Found in yami/commands.py - About 45 mins to fix

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

                              def __init__(
                          Severity: Minor
                          Found in yami/context.py - About 35 mins to fix

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

                                def __init__(
                            Severity: Minor
                            Found in yami/context.py - About 35 mins to fix

                              Function add_subcommand has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def add_subcommand(
                                      self,
                                      command: typing.Callable[..., typing.Any] | MessageCommand,
                                      *,
                                      name: str | None = None,
                              Severity: Minor
                              Found in yami/commands.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 unload_module has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def unload_module(self, name: str) -> modules_.Module:
                                      """Unloads a single module class with the given name. It will
                                      remain in :obj:`Bot.modules`, but just in an unloaded state and
                                      its commands will no longer be executable until it is loaded
                                      again.
                              Severity: Minor
                              Found in yami/bot.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