Showing 23 of 27 total issues
Class VertexInstance
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class VertexInstance
include Enumerable
extend Oriented::Core::TransactionWrapper
def initialize(vertex, rel_type)
File type_converters.rb
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Oriented
# This module was copied from neo4j-wrapper
module TypeConverters
Method destroy_relationship_to
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def destroy_relationship_to(other)
relationships().each do |e|
javaobj = (e.respond_to?(:__java_obj) ? e.__java_obj : e)
if javaobj
if e.start_vertex.id == other.id || e.end_vertex.id == other.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 update
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def update(struct_or_hash, options={})
protected_keys = self.class.protected_keys if options[:strict]
protected_keys ||= options[:protected_keys].map(&:to_s) if options[:protected_keys]
keys_to_delete = props.keys - protected_keys if protected_keys
- 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_from_string
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def parse_date_from_string(value)
return value unless value.class == String
match = value.match(/[-|\/]\d{2}$/)
if match
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"
Further reading
Method get!
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get!(rid)
if rid.kind_of?(Hash)
if rid.count > 1
else
- 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 property
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def property(*props)
options = props.last.kind_of?(Hash) ? props.pop : {}
props.each do |prop|
raise RestrctedPropertyError if RESTRICTED_PROPERTIES.include?(prop)
next if _props.has_key?(prop)
- 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 create
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def create
raise ArgumentError.new "Start vertex not supplied" unless start_vertex
raise ArgumentError.new "Start vertex is not a vertex" unless start_vertex.is_a?(Vertex)
raise ArgumentError.new "End vertex not supplied" unless end_vertex
- 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_one
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def has_one(rel_label, options={})
method_name = rel_label.downcase
unless method_defined?(method_name)
class_eval <<-RUBY, __FILE__, __LINE__
def #{method_name}
Method initialize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize(*args)
return initialize_attributes(nil) if args.size < 3 # then we have been loaded
start_vertex, end_vertex, label, props = *args
- 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_constructor_args
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_constructor_args(*args)
start_vertex, end_vertex, label, props = *args
raise ArgumentError.new "Start vertex not supplied" unless start_vertex
raise ArgumentError.new "Start vertex is not a vertex" unless start_vertex.is_a?(Vertex)
raise ArgumentError.new "End vertex not supplied" unless end_vertex
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def []=(key, value)
raise "Not valid OrientDB Property value #{value.class}, valid: #{VALID_PROPERTY_VALUE_CLASSES.to_a.join(', ')}" unless valid_property?(value)
k = key.to_s
if value.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 run
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.run connection = Oriented.connection, options={}, &block
puts options.inspect if options[:commit_on_sucess]
ensure_connection(connection)
ret = yield
connection.commit if options.fetch(:commit_on_success, false) == 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 read_attribute
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def read_attribute(key)
@_properties ||= {}
key = key.to_s
if @_properties.has_key?(key)
@_properties[key]
- 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 new
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def new(*args)
# the first argument can be an hash of properties to set
props = args[0].respond_to?(:each_pair) && args[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 create_or_update
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_or_update
# since the same model can be created or updated twice from a relationship we have to have this guard
@_create_or_updating = true
result = persisted? ? update : create
unless result != false
- 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 too many return
statements within this method. Open
return Date.strptime(value, '%m-%d-%Y')
Method write_attribute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def write_attribute(key, value)
@_properties ||= {}
key_s = key.to_s
if !@_properties.has_key?(key_s) || @_properties[key_s] != value
attribute_will_change!(key_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"
Further reading
Method destroy_all
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def destroy_all(only_unpersisted=false)
relationships().each do |e|
rm_unpersisted_rel(e)
javaobj = (e.respond_to?(:__java_obj) ? e.__java_obj : e)
- 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 destroy_relationship
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def destroy_relationship
relationships().each {|e|
javaobj = (e.respond_to?(:__java_obj) ? e.__java_obj : e)
if javaobj
other = e.other_vertex(@vertex)
- 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"