maxiperezc/graphoid

View on GitHub

Showing 12 of 21 total issues

Method generate has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def generate
        Graphoid::Scalars::DateTime ||= GraphQL::ScalarType.define do
          name 'DateTime'
          description 'DateTime ISO8601 formated'

Severity: Major
Found in lib/graphoid/scalars.rb - About 2 hrs to fix

    Method generate has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def generate(model)
            Graphoid::Types::Meta ||= GraphQL::ObjectType.define do
              name('xMeta')
              description('xMeta Type')
              field('count', types.Int)
    Severity: Major
    Found in lib/graphoid/definitions/types.rb - About 2 hrs to fix

      Method eager_load has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

            def eager_load(selection, model, first = true)
              referenced_relations = [
                mongo_constants[:many_to_many],
                mongo_constants[:has_many],
                mongo_constants[:has_one],
      Severity: Minor
      Found in lib/graphoid/drivers/mongoid.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 relate_many has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def relate_many(scope, relation, value, operator)
              parsed = {}
              field_name = relation.inverse_name || scope.name.underscore
              target = Graphoid::Queries::Processor.execute(relation.klass, value).to_a
      
      
      Severity: Minor
      Found in lib/graphoid/drivers/active_record.rb - About 1 hr to fix

        Method relate_many has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

              def relate_many(scope, relation, value, operator)
                parsed = {}
                field_name = relation.inverse_name || scope.name.underscore
                target = Graphoid::Queries::Processor.execute(relation.klass, value).to_a
        
        
        Severity: Minor
        Found in lib/graphoid/drivers/active_record.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 generate has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def generate(model)
                LIST[model] ||= GraphQL::InputObjectType.define do
                  name("#{Utils.graphqlize(model.name)}Filter")
                  description("Generated model filter for #{model.name}")
        
        
        Severity: Minor
        Found in lib/graphoid/definitions/filters.rb - About 1 hr to fix

          Method eager_load has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def eager_load(selection, model, first = true)
                  referenced_relations = [
                    mongo_constants[:many_to_many],
                    mongo_constants[:has_many],
                    mongo_constants[:has_one],
          Severity: Minor
          Found in lib/graphoid/drivers/mongoid.rb - About 1 hr to fix

            Method process has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                    def process(scope, value, key = nil)
                      if key && %w[OR AND].exclude?(key)
                        operation = Operation.new(scope, key, value)
                        filter = operation.resolve
                        return Graphoid.driver.execute_and(scope, filter)
            Severity: Minor
            Found in lib/graphoid/queries/processor.rb - About 55 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 generate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                  def generate
                    Graphoid::Scalars::DateTime ||= GraphQL::ScalarType.define do
                      name 'DateTime'
                      description 'DateTime ISO8601 formated'
            
            
            Severity: Minor
            Found in lib/graphoid/scalars.rb - About 55 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 resolve_many has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def resolve_many(field, _model, association)
                    field.resolve lambda { |obj, args, _ctx|
                      filter = args['where'].to_h
                      order = args['order'].to_h
                      limit = args['limit']
            Severity: Minor
            Found in lib/graphoid/definitions/types.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 relate_many has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def relate_many(scope, relation, value, operator)
                    field_name = relation.inverse_name || scope.name.underscore
                    target = Graphoid::Queries::Processor.execute(relation.klass, value).to_a
            
                    if relation.embeds_many?
            Severity: Minor
            Found in lib/graphoid/drivers/mongoid.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 parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def parse(attribute, value, operator, prefix = nil)
                    field = attribute.name
                    field = "#{prefix}.#{field}" if prefix
                    parsed = {}
                    case operator
            Severity: Minor
            Found in lib/graphoid/drivers/mongoid.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

            Severity
            Category
            Status
            Source
            Language