Showing 14 of 19 total issues
Class Session
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Session
attr_accessor :logger, :base_uri
def initialize(opts={})
options = {
Method process_param_integer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def process_param_integer(name, value, param_option)
if value.kind_of?(Integer)
retval = value
retval = process_valid_values(name, value, param_option) if param_option[:valid_values]
maximum = param_option[:maximum]
- 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 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(consumer_key, consumer_secret, access_token, access_token_secret, uri=nil)
Method execute
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def execute(type, path, body, headers, &block)
Method retry_on_509
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def retry_on_509(&block)
while true
response = yield
if response_code == 509
waitfor = Random.new.rand(30..45)
- 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 parse_data_structure
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_data_structure
if self.data_type == "json"
if self.data_structure && self.data_structure.kind_of?(String)
self.data_structure = JSON.parse(self.data_structure) rescue nil
end
- 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 parse_response
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_response(response)
@response_body = response.content_type == "application/json" ? (JSON(response.body) rescue nil) : response.body
@response_code = response.code.to_i
@response_headers = response.to_hash
- 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_batch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def each_batch(params={}, &block)
check_session!
options = get_options(params)
self.page ||= 0;
- 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 process_param_boolean
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_param_boolean(name, value, param_option)
retval = nil
if value.nil?
retval = param_option[:default] ? param_option[:default] : nil
- 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 process_batch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_batch(batch)
sensors = {}
batch.each do |point|
next if point.nil? || point.sensor_id.nil?
sensor_id = point.sensor_id
- 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 get_options
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_options(input={})
options = {}
self.class.parameters.each do |name, param_option|
value = self.parameter(name) # get value from object
- 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 retrieve!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def retrieve!
check_session!
raise Error::ResourceIdError unless @id
res = session.get(get_url)
- 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 find_or_new
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find_or_new(attribute)
check_session!
self.each do |resource|
found = true
- 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 to_cs_value
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_cs_value
param = self.to_h(false)
param.delete(:sensor_id)
value = param[:value]
if value
- 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"