Showing 27 of 40 total issues
Method request
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
def request(method, path, body, options)
unless authenticated?
authenticate
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_date_start_and_end_times
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def parse_date_start_and_end_times(attributes)
# Transform the date strings
unless attributes['Date'].nil? || attributes['Date'].empty?
date = Date.strptime attributes['Date'], '%m/%d/%Y'
['StartTime','EndTime'].each do |time|
- 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
Class Listing
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class Listing < Base
extend Finders
attr_accessor :photos, :videos, :virtual_tours, :documents, :open_houses, :tour_of_homes, :rental_calendars, :floplans
attr_accessor :constraints
self.element_name="listings"
Method setup_options
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.setup_options(stdout,arguments)
env_options = {
:oauth2 => false,
:endpoint => ENV[OPTIONS_ENV[:endpoint]],
# OAUTH2 Options
Class Base
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Base
extend Paginate
include Dirty
attr_accessor :attributes, :errors, :parent
Method method_missing
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(method_symbol, *arguments)
method_name = method_symbol.to_s
if method_name =~ /(=|\?|_will_change!)$/
case $1
- 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 18 (exceeds 5 allowed). Consider refactoring. Open
def on_complete(env)
env[:body] = decompress_body(env)
body = MultiJson.decode(env[:body])
SparkApi.logger.debug{ "Response Body: #{body.inspect}" }
- 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 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def request(method, path, body, options)
unless authenticated?
authenticate
end
Method on_complete
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
def on_complete(env)
env[:body] = decompress_body(env)
body = MultiJson.decode(env[:body])
SparkApi.logger.debug{ "Response Body: #{body.inspect}" }
File listing.rb
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
module SparkApi
module Models
class Listing < Base
extend Finders
attr_accessor :photos, :videos, :virtual_tours, :documents, :open_houses, :tour_of_homes, :rental_calendars, :floplans
Method initialize
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(attributes={})
@photos = []
@videos = []
@virtual_tours = []
@rental_calendars = []
Method parse_date_start_and_end_times
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_date_start_and_end_times(attributes)
# Transform the date strings
unless attributes['Date'].nil? || attributes['Date'].empty?
date = Date.strptime attributes['Date'], '%m/%d/%Y'
['StartTime','EndTime'].each do |time|
Method initialize
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def initialize(attributes={})
@photos = []
@videos = []
@virtual_tours = []
@rental_calendars = []
- 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 primary_img
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def primary_img(typ)
if @images.is_a?(Array)
matches = @images.select {|i| i.Type == typ}
matches.sort do |a,b|
if a.Name.nil? && !b.Name.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 connection
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def connection(force_ssl = false)
opts = {
:headers => headers
}
if(force_ssl || self.ssl)
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def request(method, path, body, options={})
escaped_path = Addressable::URI.escape(path)
connection = @client.connection(true) # SSL Only!
connection.headers.merge!(options.delete(:override_headers) || {})
connection.headers.merge!(self.auth_header)
- 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 method_missing
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(method_symbol, *arguments)
method_name = method_symbol.to_s
if method_name =~ /(=|\?)$/
case $1
- 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 vimeo_video_code
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def vimeo_video_code
html = self.ObjectHtml
if html.match(/(src=)('|")((https:)?\/\/player\.vimeo\.com\/video\/)/)
new_url = html.split(/(src=')|(src=")/)
if new_url[2]
- 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 load_file
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def load_file(file)
@file = file
@name = File.basename(file, ".yml")
erb_file = ERB.new(File.read(file)).result
- 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def respond_to?(method_symbol, include_all=false)
if super
return true
else
method_name = method_symbol.to_s
- 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"