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
Class Client
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Client
class ClientNotStartedError < StandardError; end
class ClientAlreadyStartedError < StandardError; end
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?
- Read upRead up
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)
- Read upRead up
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)
- Read upRead up
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 = {}
Method initialize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize(attrs, options = {})
@teams = {}
@users = {}
@bots = {}
@public_channels = {}
- Read upRead up
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
- Read upRead up
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 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?
- Read upRead up
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] =
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)