Showing 8 of 8 total issues
Class Client
has 44 methods (exceeds 20 allowed). Consider refactoring. Open
class Client # rubocop:disable ClassLength
extend Forwardable
OPTION_CALLBACKS = [:close,
:delete,
File client.rb
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'em-twitter'
require 'eventmachine'
require 'multi_json'
require 'twitter'
require 'forwardable'
Method respond_to
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def respond_to(hash, callbacks, &block) # rubocop:disable CyclomaticComplexity, PerceivedComplexity
if hash[:control] && hash[:control][:control_uri]
@control_uri = hash[:control][:control_uri]
require 'tweetstream/site_stream_client'
@control = TweetStream::SiteStreamClient.new(@control_uri, 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 request
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def request(method, path, options, &block) # rubocop:disable CyclomaticComplexity, PerceivedComplexity
error_msg = options.delete(:error_msg)
http = connection.send(method, options.merge(:path => path))
http.callback do
if http.response_header.status == 200 && block && block.is_a?(Proc)
- 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 respond_to
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def respond_to(hash, callbacks, &block) # rubocop:disable CyclomaticComplexity, PerceivedComplexity
if hash[:control] && hash[:control][:control_uri]
@control_uri = hash[:control][:control_uri]
require 'tweetstream/site_stream_client'
@control = TweetStream::SiteStreamClient.new(@control_uri, options)
Method connect
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def connect(path, options = {}, &block)
stream_parameters, callbacks = connection_options(path, options)
@stream = EM::Twitter::Client.connect(stream_parameters)
@stream.each do |item|
Method connect
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def connect(path, options = {}, &block)
stream_parameters, callbacks = connection_options(path, options)
@stream = EM::Twitter::Client.connect(stream_parameters)
@stream.each do |item|
- 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 start
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def start(path, query_parameters = {}, &block)
if EventMachine.reactor_running?
connect(path, query_parameters, &block)
else
if EventMachine.epoll?
- 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"