Showing 13 of 15 total issues
Class Service
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class Service
# The OData Service's URL
attr_reader :service_url
# Options to pass around
attr_reader :options
Class Entity
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Entity
# The Entity type name
attr_reader :type
# The OData::Service's namespace
attr_reader :namespace
Class Query
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Query
# Create a new Query for the provided EntitySet
# @param entity_set [OData::EntitySet]
def initialize(entity_set)
@entity_set = entity_set
Method process_links
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def self.process_links(entity, xml_doc)
entity.instance_eval do
service.navigation_properties[name].each do |nav_name, details|
xml_doc.xpath("./link[@title='#{nav_name}']").each do |node|
next if node.attributes['type'].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 read_metadata
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def read_metadata
response = nil
# From file, good for debugging
if options[:metadata_file]
data = File.read(options[:metadata_file])
- 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 validate_response
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def validate_response(response)
raise "Bad Request. #{error_message(response)}" if response.code == 400
raise "Access Denied" if response.code == 401
raise "Forbidden" if response.code == 403
raise "Invalid URL" if [0,404].include?(response.code)
- 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 []
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def [](association_name)
if associations[association_name].nil?
raise ArgumentError, "unknown association: #{association_name}"
elsif entity.links[association_name].nil?
association = associations[association_name]
- 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 instantiate_property
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def instantiate_property(property_name, value)
value_type = service.get_property_type(name, property_name)
klass = ::OData::PropertyRegistry[value_type]
if klass.nil? && value_type =~ /^#{namespace}\./
- 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_xml
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def to_xml
builder = Nokogiri::XML::Builder.new do |xml|
xml.entry('xmlns' => 'http://www.w3.org/2005/Atom',
'xmlns:data' => 'http://schemas.microsoft.com/ado/2007/08/dataservices',
'xmlns:metadata' => 'http://schemas.microsoft.com/ado/2007/08/dataservices/metadata',
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def each(&block)
per_page = @each_batch_size
page = 0
loop do
- 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 value
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def value
if (@value.nil? || @value.empty?) && allows_nil?
nil
else
begin
- 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 <<
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def <<(entity)
url_chunk, options = setup_entity_post_request(entity)
result = execute_entity_post_request(options, url_chunk)
if entity.is_new?
doc = ::Nokogiri::XML(result.body).remove_namespaces!
- 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_property_from_xml
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_property_from_xml(property_xml)
property_name = property_xml.attributes['Name'].value
value_type = property_xml.attributes['Type'].value
property_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"