rmosolgo/graphql-ruby

View on GitHub
lib/graphql/execution/execute.rb

Summary

Maintainability
D
2 days
Test Coverage

Method resolve_value has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

        def resolve_value(value, field_type, field_ctx)
          field_defn = field_ctx.field

          if value.nil?
            if field_type.kind.non_null?
Severity: Minor
Found in lib/graphql/execution/execute.rb - About 4 hrs 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_value has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def resolve_value(value, field_type, field_ctx)
          field_defn = field_ctx.field

          if value.nil?
            if field_type.kind.non_null?
Severity: Major
Found in lib/graphql/execution/execute.rb - About 3 hrs to fix

    File execute.rb has 261 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module GraphQL
      module Execution
        # A valid execution strategy
        # @api private
        class Execute
    Severity: Minor
    Found in lib/graphql/execution/execute.rb - About 2 hrs to fix

      Method continue_resolve_field has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

              def continue_resolve_field(raw_value, field_type, field_ctx)
                if field_ctx.parent.invalid_null?
                  return nil
                end
                query = field_ctx.query
      Severity: Minor
      Found in lib/graphql/execution/execute.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 resolve_field has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

              def resolve_field(object, field_ctx)
                query = field_ctx.query
                irep_node = field_ctx.irep_node
                parent_type = irep_node.owner_type
                field = field_ctx.field
      Severity: Minor
      Found in lib/graphql/execution/execute.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 resolve_field has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def resolve_field(object, field_ctx)
                query = field_ctx.query
                irep_node = field_ctx.irep_node
                parent_type = irep_node.owner_type
                field = field_ctx.field
      Severity: Minor
      Found in lib/graphql/execution/execute.rb - About 1 hr to fix

        Method continue_resolve_field has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def continue_resolve_field(raw_value, field_type, field_ctx)
                  if field_ctx.parent.invalid_null?
                    return nil
                  end
                  query = field_ctx.query
        Severity: Minor
        Found in lib/graphql/execution/execute.rb - About 1 hr to fix

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

                  def resolve_selection(object, current_type, current_ctx, mutation: false )
                    # Assign this _before_ resolving the children
                    # so that when a child propagates null, the selection result is
                    # ready for it.
                    current_ctx.value = {}
          Severity: Minor
          Found in lib/graphql/execution/execute.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 continue_or_wait has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                  def continue_or_wait(raw_value, field_type, field_ctx)
                    if field_ctx.schema.lazy?(raw_value)
                      field_ctx.value = Execution::Lazy.new {
                        inner_value = begin
                            begin
          Severity: Minor
          Found in lib/graphql/execution/execute.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

          Avoid deeply nested control flow statements.
          Open

                      case field_type.kind
                      when GraphQL::TypeKinds::SCALAR, GraphQL::TypeKinds::ENUM
                        field_type.coerce_result(value, field_ctx)
                      when GraphQL::TypeKinds::LIST
                        inner_type = field_type.of_type
          Severity: Major
          Found in lib/graphql/execution/execute.rb - About 45 mins to fix

            Method call has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    def self.call(_parent_type, parent_object, field_definition, field_args, context, _next = nil)
            Severity: Minor
            Found in lib/graphql/execution/execute.rb - About 45 mins to fix

              There are no issues that match your filters.

              Category
              Status