andreasronge/neo4j-core

View on GitHub
lib/neo4j/core/query.rb

Summary

Maintainability
C
1 day
Test Coverage

Class Query has 33 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Query
      include Neo4j::Core::QueryClauses
      include Neo4j::Core::QueryFindInBatches
      DEFINED_CLAUSES = {}

Severity: Minor
Found in lib/neo4j/core/query.rb - About 4 hrs to fix

    File query.rb has 278 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'neo4j/core/query_clauses'
    require 'neo4j/core/query_find_in_batches'
    require 'active_support/notifications'
    
    module Neo4j
    Severity: Minor
    Found in lib/neo4j/core/query.rb - About 2 hrs to fix

      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?
      Severity: Minor
      Found in lib/neo4j/core/query.rb - About 1 hr to fix

      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 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def each
              response = self.response
              if defined?(Neo4j::Server::CypherResponse) && response.is_a?(Neo4j::Server::CypherResponse)
                response.unwrapped! if unwrapped?
                response.to_node_enumeration
      Severity: Minor
      Found in lib/neo4j/core/query.rb - About 45 mins to fix

      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 response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def response
              return @response if @response
      
              @response = if session_is_new_api?
                            @session.query(self, transaction: Transaction.current_for(@session), wrap_level: (:core_entity if unwrapped?))
      Severity: Minor
      Found in lib/neo4j/core/query.rb - About 35 mins to fix

      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_nodes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def match_nodes(hash, optional_match = false)
              hash.inject(self) do |query, (variable, node_object)|
                neo_id = (node_object.respond_to?(:neo_id) ? node_object.neo_id : node_object)
      
                match_method = optional_match ? :optional_match : :match
      Severity: Minor
      Found in lib/neo4j/core/query.rb - About 25 mins to fix

      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_cypher has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def to_cypher(options = {})
              join_string = options[:pretty] ? NEWLINE : EMPTY
      
              cypher_string = partitioned_clauses.map do |clauses|
                clauses_by_class = clauses.group_by(&:class)
      Severity: Minor
      Found in lib/neo4j/core/query.rb - About 25 mins to fix

      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

      There are no issues that match your filters.

      Category
      Status