Showing 340 of 340 total issues
File query_clauses.rb
has 584 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveGraph
module Core
module QueryClauses
class ArgError < StandardError
attr_reader :arg_part
- Create a ticketCreate a ticket
Class QueryProxy
has 38 methods (exceeds 20 allowed). Consider refactoring. Open
class QueryProxy
# rubocop:enable Metrics/ClassLength
include ActiveGraph::Node::Query::QueryProxyEnumerable
include ActiveGraph::Node::Query::QueryProxyMethods
include ActiveGraph::Node::Query::QueryProxyMethodsOfMassUpdating
- Create a ticketCreate a ticket
File has_n.rb
has 367 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveGraph::Node
module HasN
extend ActiveSupport::Concern
class NonPersistedNodeError < ActiveGraph::Error; end
- Create a ticketCreate a ticket
Class Association
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class Association
include ActiveGraph::Shared::RelTypeConverters
include ActiveGraph::Node::Dependent::AssociationMethods
include ActiveGraph::Node::HasN::AssociationCypherMethods
- Create a ticketCreate a ticket
File type_converters.rb
has 337 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'date'
require 'bigdecimal'
require 'bigdecimal/util'
require 'active_support/core_ext/big_decimal/conversions'
require 'active_support/core_ext/string/conversions'
- Create a ticketCreate a ticket
Class Query
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class Query
include ActiveGraph::Core::QueryClauses
include ActiveGraph::Core::QueryFindInBatches
DEFINED_CLAUSES = {}
- Create a ticketCreate a ticket
Class Runner
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class Runner
STATUS_TABLE_FORMAT = '%-10s %-20s %s'.freeze
SEPARATOR = '--------------------------------------------------'.freeze
FILE_MISSING = '**** file missing ****'.freeze
STATUS_TABLE_HEADER = ['Status'.freeze, 'Migration ID'.freeze, 'Migration Name'.freeze].freeze
- Create a ticketCreate a ticket
Class DeclaredProperties
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class DeclaredProperties
include ActiveGraph::Shared::TypeConverters
attr_reader :klass
delegate :each, :each_pair, :each_key, :each_value, to: :registered_properties
- Create a ticketCreate a ticket
Class AssociationProxy
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class AssociationProxy
def initialize(query_proxy, deferred_objects = [], result_cache_proc = nil)
@query_proxy = query_proxy
@deferred_objects = deferred_objects
- Create a ticketCreate a ticket
Class Clause
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Clause
UNDERSCORE = '_'
COMMA_SPACE = ', '
AND = ' AND '
PRETTY_NEW_LINE = "\n "
- Create a ticketCreate a ticket
Method subscribe_to_query
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def subscribe_to_query
ActiveSupport::Notifications.subscribe('neo4j.core.cypher_query') do |_, _start, _finish, _id, payload|
query = payload[:query]
params_string = (query.parameters && !query.parameters.empty? ? "| #{query.parameters.inspect}" : EMPTY)
cypher = query.pretty_cypher ? (NEWLINE_W_SPACES if query.pretty_cypher.include?("\n")).to_s + query.pretty_cypher.gsub(/\n/, NEWLINE_W_SPACES) : query.cypher
- Read upRead up
- Create a ticketCreate a ticket
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
File query.rb
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'active_graph/core/query_clauses'
require 'active_graph/core/query_find_in_batches'
require 'active_support/notifications'
module ActiveGraph
- Create a ticketCreate a ticket
Assignment Branch Condition size for subscribe_to_query is too high. [23.85/18] (http://c2.com/cgi/wiki?AbcMetric) Open
def subscribe_to_query
ActiveSupport::Notifications.subscribe('neo4j.core.cypher_query') do |_, _start, _finish, _id, payload|
query = payload[:query]
params_string = (query.parameters && !query.parameters.empty? ? "| #{query.parameters.inspect}" : EMPTY)
cypher = query.pretty_cypher ? (NEWLINE_W_SPACES if query.pretty_cypher.include?("\n")).to_s + query.pretty_cypher.gsub(/\n/, NEWLINE_W_SPACES) : query.cypher
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Cyclomatic complexity for subscribe_to_query is too high. [8/6] Open
def subscribe_to_query
ActiveSupport::Notifications.subscribe('neo4j.core.cypher_query') do |_, _start, _finish, _id, payload|
query = payload[:query]
params_string = (query.parameters && !query.parameters.empty? ? "| #{query.parameters.inspect}" : EMPTY)
cypher = query.pretty_cypher ? (NEWLINE_W_SPACES if query.pretty_cypher.include?("\n")).to_s + query.pretty_cypher.gsub(/\n/, NEWLINE_W_SPACES) : query.cypher
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Cyclomatic complexity for setup! is too high. [7/6] Open
def setup!(config = empty_config)
config = final_driver_config!(config)
scheme = config.delete(:scheme) || 'bolt'
host = config.delete(:host) || 'localhost'
port = config.delete(:port) || 7687
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Assignment Branch Condition size for setup! is too high. [19.54/18] (http://c2.com/cgi/wiki?AbcMetric) Open
def setup!(config = empty_config)
config = final_driver_config!(config)
scheme = config.delete(:scheme) || 'bolt'
host = config.delete(:host) || 'localhost'
port = config.delete(:port) || 7687
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Perceived complexity for subscribe_to_query is too high. [8/7] Open
def subscribe_to_query
ActiveSupport::Notifications.subscribe('neo4j.core.cypher_query') do |_, _start, _finish, _id, payload|
query = payload[:query]
params_string = (query.parameters && !query.parameters.empty? ? "| #{query.parameters.inspect}" : EMPTY)
cypher = query.pretty_cypher ? (NEWLINE_W_SPACES if query.pretty_cypher.include?("\n")).to_s + query.pretty_cypher.gsub(/\n/, NEWLINE_W_SPACES) : query.cypher
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop tries to produce a complexity score that's a measure of the
complexity the reader experiences when looking at a method. For that
reason it considers when
nodes as something that doesn't add as much
complexity as an if
or a &&
. Except if it's one of those special
case
/when
constructs where there's no expression after case
. Then
the cop treats it as an if
/elsif
/elsif
... and lets all the when
nodes count. In contrast to the CyclomaticComplexity cop, this cop
considers else
nodes as adding complexity.
Example:
def my_method # 1
if cond # 1
case var # 2 (0.8 + 4 * 0.2, rounded)
when 1 then func_one
when 2 then func_two
when 3 then func_three
when 4..10 then func_other
end
else # 1
do_something until a && b # 2
end # ===
end # 7 complexity points
Method process_unpersisted_nodes!
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def process_unpersisted_nodes!
deferred_create_cache.dup.each do |association_name, nodes|
association_proxy = association_proxy(association_name)
nodes.each do |node|
- Read upRead up
- Create a ticketCreate a ticket
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 generate_partitioning!
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def generate_partitioning!
@partitioning = [[]]
@clauses.each do |clause|
if clause.nil? && !fresh_partition?
- Read upRead up
- Create a ticketCreate a ticket
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 match_to
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def match_to(node)
first_node = node.is_a?(Array) ? node.first : node
where_arg = if first_node.respond_to?(:neo_id)
{neo_id: node.is_a?(Array) ? node.map(&:neo_id) : node}
elsif !node.nil?
- Read upRead up
- Create a ticketCreate a ticket
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"