discorb-lib/discorb

View on GitHub
lib/discorb/interaction/root.rb

Summary

Maintainability
B
4 hrs
Test Coverage

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

    def post(
      content = nil,
      tts: false,
      embed: nil,
      embeds: nil,
Severity: Minor
Found in lib/discorb/interaction/root.rb - About 1 hr to fix

    Method edit_original_message has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def edit_original_message(
          content = nil,
          embed: nil,
          embeds: nil,
          attachment: nil,
    Severity: Minor
    Found in lib/discorb/interaction/root.rb - 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

    Method edit_original_message has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def edit_original_message(
          content = nil,
          embed: nil,
          embeds: nil,
          attachment: nil,
    Severity: Minor
    Found in lib/discorb/interaction/root.rb - About 1 hr to fix

      Method post has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

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

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

          def initialize(client, data)
            @client = client
            @id = Snowflake.new(data[:id])
            @application_id = Snowflake.new(data[:application_id])
            @type = self.class.interaction_name
      Severity: Minor
      Found in lib/discorb/interaction/root.rb - 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

      There are no issues that match your filters.

      Category
      Status