slack-ruby/slack-ruby-client

View on GitHub

Showing 11 of 131 total issues

File errors.rb has 1250 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Slack
  module Web
    module Api
      module Errors
        class AccessDenied < SlackError; end
Severity: Major
Found in lib/slack/web/api/errors.rb - About 3 days to fix

    Class Client has 26 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Client
          class ClientNotStartedError < StandardError; end
    
          class ClientAlreadyStartedError < StandardError; end
    
    
    Severity: Minor
    Found in lib/slack/real_time/client.rb - About 3 hrs to fix

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

                def start_reactor(client)
                  Async do |task|
                    @restart = ::Async::Notification.new
      
                    if client.run_ping?
      Severity: Minor
      Found in lib/slack/real_time/concurrency/async.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 each has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

                def each
                  next_cursor = nil
                  retry_count = 0
                  loop do
                    query = { limit: client.default_page_size }.merge(params).merge(cursor: next_cursor)
      Severity: Minor
      Found in lib/slack/web/pagination/cursor.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 request has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

              def request(method, path, options)
                response = connection.send(method) do |request|
                  case method
                  when :get, :delete
                    request.url(path, options)
      Severity: Minor
      Found in lib/slack/web/faraday/request.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 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def initialize(attrs, options = {})
                @teams = {}
                @users = {}
                @bots = {}
                @public_channels = {}
      Severity: Minor
      Found in lib/slack/real_time/stores/store.rb - About 1 hr to fix

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

                def initialize(attrs, options = {})
                  @teams = {}
                  @users = {}
                  @bots = {}
                  @public_channels = {}
        Severity: Minor
        Found in lib/slack/real_time/stores/store.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 dispatch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

              def dispatch(event)
                return false unless event.data
        
                data = Slack::Messages::Message.new(JSON.parse(event.data))
                type = data.type
        Severity: Minor
        Found in lib/slack/real_time/client.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

        Avoid deeply nested control flow statements.
        Open

                          if channel.is_private?
                            private_channels[channel.id] =
                              private_channels.key?(channel.id) ? private_channels[channel.id].merge(channel) : channel
                          else
                            public_channels[channel.id] =
        Severity: Major
        Found in lib/slack/real_time/stores/store.rb - About 45 mins to fix

          Method on_complete has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                    def on_complete(env)
                      raise Slack::Web::Api::Errors::TooManyRequestsError, env.response if env.status == 429
          
                      return unless env.success?
          
          
          Severity: Minor
          Found in lib/slack/web/faraday/response/raise_error.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 id_for has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                    def id_for(key, name, prefix, enum_method, list_method, not_found_error)
          Severity: Minor
          Found in lib/slack/web/api/mixins/ids.id.rb - About 45 mins to fix
            Severity
            Category
            Status
            Source
            Language