Showing 49 of 49 total issues
Class Rest
has 53 methods (exceeds 20 allowed). Consider refactoring. Open
class Rest
module Batch
include Neography::Rest::Helpers
def batch(*args)
File batch.rb
has 331 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Neography
class Rest
module Batch
include Neography::Rest::Helpers
Similar blocks of code found in 2 locations. Consider refactoring. Open
class Rest
module RelationshipProperties
def set_relationship_properties(id, properties)
properties.each do |property, value|
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 131.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
class Rest
module NodeProperties
def set_node_properties(id, properties)
properties.each do |property, value|
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 131.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method find
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def find(*args)
db = args[3] ? args.pop : Neography::Rest.new
if self <= Neography::Node
nodes = []
- 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 iterator
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def iterator
options = {
"order" => @order,
"uniqueness" => @uniqueness,
"relationships" => @relationships
- 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 return_result
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def return_result(response, code, body, parsed, path, query_body)
case code
when 200
@logger.debug "OK #{body}" if @log_enabled
parsed ? body : @parser.json(body)
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
def each
iterator.each do |path|
paths = Array.new
if @get.include?("node")
- 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 convert_cypher
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def convert_cypher(statements)
array = []
query = nil
parameters = nil
Array(statements).each do |statement|
Method create_nodes_threaded
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_nodes_threaded(nodes)
nodes = Array.new(nodes) if nodes.kind_of? Fixnum
node_queue = Queue.new
thread_pool = []
Method handle_4xx_500_response
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def handle_4xx_500_response(response, code, body, path, query_body)
index = 0
request = {:path => path, :body => query_body}
if body.nil? or body == ""
parsed_body = {"message" => "No error message returned from server.",
- 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_nodes_threaded
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def create_nodes_threaded(nodes)
nodes = Array.new(nodes) if nodes.kind_of? Fixnum
node_queue = Queue.new
thread_pool = []
- 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 save_local_configuration
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def save_local_configuration(config)
@protocol = config[:protocol]
@server = config[:server]
@port = config[:port]
@directory = config[:directory]
Method iterator
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def iterator
options = {
"order" => @order,
"uniqueness" => @uniqueness,
"relationships" => @relationships
Method []=
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def []=(key, value)
key = key.to_sym
k_str = key.to_s
if value.nil?
unless @table[key].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 create_unique
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_unique(index, key, value, type, from_node, to_node, props = nil)
Method batch_create_unique_relationship
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def batch_create_unique_relationship(index, key, value, type, from, to, props = nil)
Method create_unique_relationship
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_unique_relationship(index, key, value, type, from, to, props = nil)
Method get_shortest_weighted_path
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_shortest_weighted_path(from, to, relationships, weight_attribute = "weight", depth = 1, algorithm = "dijkstra")
Method initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(from, to, algorithm, all=false, types = nil, dir = "all" )