discorb-lib/discorb

View on GitHub

Showing 136 of 137 total issues

Method edit has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

    def edit(
      name: Discorb::Unset,
      position: Discorb::Unset,
      category: Discorb::Unset,
      parent: Discorb::Unset,
Severity: Minor
Found in lib/discorb/channel/forum.rb - About 1 day 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

File message.rb has 376 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Discorb
  #
  # Represents a message.
  #
  class Message < DiscordModel
Severity: Minor
Found in lib/discorb/message.rb - About 5 hrs to fix

    File forum.rb has 346 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Discorb
      #
      # Represents a forum channel.
      #
      class ForumChannel < GuildChannel
    Severity: Minor
    Found in lib/discorb/channel/forum.rb - About 4 hrs to fix

      File gateway_events.rb has 343 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module Discorb
        module Gateway
          #
          # Represents an event.
          # @abstract
      Severity: Minor
      Found in lib/discorb/gateway_events.rb - About 4 hrs to fix

        Method to_hash has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

                def to_hash
                  options_payload =
                    options.map do |name, value|
                      ret = {
                        type:
        Severity: Minor
        Found in lib/discorb/app_command/command.rb - About 3 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

        Method edit has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            def edit(
              name: Discorb::Unset,
              position: Discorb::Unset,
              category: Discorb::Unset,
              parent: Discorb::Unset,
        Severity: Minor
        Found in lib/discorb/channel/text.rb - About 3 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

        Method to_hash has 89 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def to_hash
                  options_payload =
                    options.map do |name, value|
                      ret = {
                        type:
        Severity: Major
        Found in lib/discorb/app_command/command.rb - About 3 hrs to fix

          Method clean_content has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

              def clean_content(
                user: true,
                channel: true,
                role: true,
                emoji: true,
          Severity: Minor
          Found in lib/discorb/message.rb - About 3 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

          File command.rb has 303 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          module Discorb
            module ApplicationCommand
              #
              # Represents a application command.
              # @abstract
          Severity: Minor
          Found in lib/discorb/app_command/command.rb - About 3 hrs to fix

            Method edit has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

                def edit(
                  type: Discorb::Unset,
                  name: Discorb::Unset,
                  description: Discorb::Unset,
                  start_time: Discorb::Unset,
            Severity: Minor
            Found in lib/discorb/event.rb - About 3 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

            Method edit_message has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

                def edit_message(
                  message_id,
                  content = Discorb::Unset,
                  embed: Discorb::Unset,
                  embeds: Discorb::Unset,
            Severity: Minor
            Found in lib/discorb/modules.rb - About 3 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

            Method edit has 79 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def edit(
                  type: Discorb::Unset,
                  name: Discorb::Unset,
                  description: Discorb::Unset,
                  start_time: Discorb::Unset,
            Severity: Major
            Found in lib/discorb/event.rb - About 3 hrs to fix

              File text.rb has 290 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module Discorb
                #
                # Represents a text channel.
                #
                class TextChannel < GuildChannel
              Severity: Minor
              Found in lib/discorb/channel/text.rb - About 2 hrs to fix

                Method create_post has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                    def create_post(
                      title,
                      content = nil,
                      embed: nil,
                      embeds: nil,
                Severity: Minor
                Found in lib/discorb/channel/forum.rb - 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

                Method _set_data has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def _set_data(data)
                      @id = Snowflake.new(data[:id])
                      @channel_id = data[:channel_id]
                
                      if data[:guild_id]
                Severity: Major
                Found in lib/discorb/message.rb - About 2 hrs to fix

                  Method post has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def post(
                          content = nil,
                          tts: false,
                          embed: nil,
                          embeds: nil,
                  Severity: Major
                  Found in lib/discorb/interaction/response.rb - About 2 hrs to fix

                    Method edit has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def edit(
                          name: Discorb::Unset,
                          position: Discorb::Unset,
                          category: Discorb::Unset,
                          parent: Discorb::Unset,
                    Severity: Major
                    Found in lib/discorb/channel/forum.rb - About 2 hrs to fix

                      Method edit has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def edit(
                              content,
                              tts: false,
                              embed: nil,
                              embeds: nil,
                      Severity: Minor
                      Found in lib/discorb/interaction/response.rb - 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

                      Method initialize has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def initialize(name, tone: 0)
                            if EmojiTable::DISCORD_TO_UNICODE.key?(name)
                              @name = name
                              @value = EmojiTable::DISCORD_TO_UNICODE[name]
                            elsif EmojiTable::UNICODE_TO_DISCORD.key?(name)
                      Severity: Minor
                      Found in lib/discorb/emoji.rb - 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

                      Method edit has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def edit(
                              name: Discorb::Unset,
                              archived: Discorb::Unset,
                              auto_archive_duration: Discorb::Unset,
                              archive_in: Discorb::Unset,
                      Severity: Minor
                      Found in lib/discorb/channel/forum.rb - 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

                      Severity
                      Category
                      Status
                      Source
                      Language