alfa-jpn/BotHeaven

View on GitHub

Showing 7 of 7 total issues

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

    def initialize(bot_id, callback, method, url, params)
      raise 'bot_id should be kind of Integer' unless bot_id.kind_of?(Integer)
      raise 'callback should be kind of String' unless callback.kind_of?(String)
      raise 'method should be :get or :post.' unless [:get, :post].include?(method)
      raise 'url should be kind of String' unless url.kind_of?(String)
Severity: Minor
Found in app/daemons/job_daemons/http_request_job.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 check_permission! has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def check_permission!
    case action_name
      when 'show'
        redirect_to root_path unless @bot.readable?(current_user)
      when 'edit', 'update', 'show_storage'
Severity: Minor
Found in app/controllers/bots_controller.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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(channel_id, name, icon_emoji, message)
      raise 'channel_id should be kind of String' unless channel_id.kind_of?(String)
      raise 'name should be kind of String' unless name.kind_of?(String)
      raise 'icon_emoji should be kind of String' unless icon_emoji.kind_of?(String)
      raise 'message should be kind of String' unless message.kind_of?(String)
Severity: Minor
Found in app/daemons/job_daemons/slack_talk_job.rb - 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

Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def initialize(bot_id, callback, method, url, params)
Severity: Minor
Found in app/daemons/job_daemons/http_request_job.rb - About 35 mins to fix

    Method set! has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def self.set!(alarm_name, bot, callback_function, minutes, repeat)
    Severity: Minor
    Found in app/models/alarm.rb - About 35 mins to fix

      Method check_permission! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def check_permission!
          case action_name
            when 'show'
              redirect_to root_path unless @bot_module.readable?(current_user)
            when 'edit', 'update', 'destroy'
      Severity: Minor
      Found in app/controllers/bot_modules_controller.rb - 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

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

          def initialize(bot_id, function, arguments)
            raise 'bot_id should be kind of Integer' unless bot_id.kind_of?(Integer)
            raise 'function should be kind of String' unless function.kind_of?(String)
            raise 'arguments should be kind of Array' unless arguments.kind_of?(Array)
      
      
      Severity: Minor
      Found in app/daemons/job_daemons/bot_job.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

      Severity
      Category
      Status
      Source
      Language