rmosolgo/graphql-ruby

View on GitHub

Showing 447 of 459 total issues

Method from_options has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

      def self.from_options(name = nil, type = nil, desc = nil, resolver: nil, mutation: nil, subscription: nil,**kwargs, &block)
        if kwargs[:field]
          if kwargs[:field] == GraphQL::Relay::Node.field
            warn("Legacy-style `GraphQL::Relay::Node.field` is being added to a class-based type. See `GraphQL::Types::Relay::NodeField` for a replacement.")
            return GraphQL::Types::Relay::NodeField
Severity: Minor
Found in lib/graphql/schema/field.rb - About 2 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 accepts_definition has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

          def accepts_definition(name)
            own_accepts_definition_methods << name

            ivar_name = "@#{name}_args"
            if self.is_a?(Class)
Severity: Minor
Found in lib/graphql/schema/member/accepts_definition.rb - About 2 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 build_rows has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

      def build_rows(context_entry, rows:, top: false)
        case context_entry
        when GraphQL::Query::Context::FieldResolutionContext
          ctx = context_entry
          field_name = "#{ctx.irep_node.owner_type.name}.#{ctx.field.name}"
Severity: Minor
Found in lib/graphql/backtrace/table.rb - About 2 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 normalize_type_expression has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

      def self.normalize_type_expression(type_expression, mode:, null: true)
        if type_expression.start_with?("!")
          normalize_type_expression(type_expression[1..-1], mode: mode, null: false)
        elsif type_expression.end_with?("!")
          normalize_type_expression(type_expression[0..-2], mode: mode, null: false)
Severity: Minor
Found in lib/generators/graphql/type_generator.rb - About 2 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 print_node has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def print_node(node, indent: "")
        case node
        when Nodes::Document
          print_document(node)
        when Nodes::Argument
Severity: Major
Found in lib/graphql/language/printer.rb - About 2 hrs to fix

    Class Runtime has 23 methods (exceeds 20 allowed). Consider refactoring.
    Open

          class Runtime
            # @return [GraphQL::Query]
            attr_reader :query
    
            # @return [Class<GraphQL::Schema>]
    Severity: Minor
    Found in lib/graphql/execution/interpreter/runtime.rb - About 2 hrs to fix

      Method resolve has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

              def self.resolve(parent_type, field_defn, field_type, value, selection, query_ctx)
                if value.nil? || value.is_a?(GraphQL::ExecutionError)
                  if field_type.kind.non_null?
                    if value.nil?
                      type_error = GraphQL::InvalidNullError.new(parent_type, field_defn, value)
      Severity: Minor
      Found in lib/graphql/query/serial_execution/value_resolution.rb - About 2 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 proxy_to_depth has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

                def proxy_to_depth(inner_obj, depth, ctx)
                  if depth > 0
                    inner_obj.map { |i| proxy_to_depth(i, depth - 1, ctx) }
                  else
                    ctx.schema.after_lazy(inner_obj) do |inner_obj|
      Severity: Minor
      Found in lib/graphql/schema/member/instrumentation.rb - About 2 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 continue_field has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def continue_field(path, value, field, type, ast_node, next_selections, is_non_null, owner_object, arguments) # rubocop:disable Metrics/ParameterLists
                case type.kind.name
                when "SCALAR", "ENUM"
                  r = type.coerce_result(value, context)
                  write_in_response(path, r)
      Severity: Major
      Found in lib/graphql/execution/interpreter/runtime.rb - About 2 hrs to fix

        Method from_arguments has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def self.from_arguments(ast_arguments, argument_owner, variables)
                context = variables ? variables.context : nil
                values_hash = {}
                defaults_used = Set.new
        
        
        Severity: Major
        Found in lib/graphql/query/literal_input.rb - About 2 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 subtype? has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                  def self.subtype?(parent_type, child_type)
                    if parent_type == child_type
                      # Equivalent types are subtypes
                      true
                    elsif child_type.is_a?(GraphQL::NonNullType)
            Severity: Minor
            Found in lib/graphql/execution/typecast.rb - About 2 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 continue_field has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                    def continue_field(path, value, field, type, ast_node, next_selections, is_non_null, owner_object, arguments) # rubocop:disable Metrics/ParameterLists
                      case type.kind.name
                      when "SCALAR", "ENUM"
                        r = type.coerce_result(value, context)
                        write_in_response(path, r)
            Severity: Minor
            Found in lib/graphql/execution/interpreter/runtime.rb - About 2 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 continue_value has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                    def continue_value(path, value, field, is_non_null, ast_node)
                      if value.nil?
                        if is_non_null
                          err = GraphQL::InvalidNullError.new(field.owner, field, value)
                          write_invalid_null_in_response(path, err)
            Severity: Minor
            Found in lib/graphql/execution/interpreter/runtime.rb - About 2 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_with_support has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                  def resolve_with_support(**inputs)
                    # Without the interpreter, the inputs are unwrapped by an instrumenter.
                    # But when using the interpreter, no instrumenters are applied.
                    if context.interpreter?
                      input = inputs[:input].to_kwargs
            Severity: Minor
            Found in lib/graphql/schema/relay_classic_mutation.rb - About 2 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 initialize has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                  def initialize(values = nil, ruby_kwargs: nil, context:, defaults_used:)
                    @context = context
                    if ruby_kwargs
                      @ruby_style_hash = ruby_kwargs
                    else
            Severity: Minor
            Found in lib/graphql/schema/input_object.rb - About 2 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 paged_nodes has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                  def paged_nodes
                    return @paged_nodes if defined? @paged_nodes
            
                    items = sliced_nodes
            
            
            Severity: Minor
            Found in lib/graphql/relay/relation_connection.rb - About 2 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 validate has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                  def validate(ast_value, type)
                    if type.nil?
                      # this means we're an undefined argument, see #present_input_field_values_are_valid
                      maybe_raise_if_invalid(ast_value) do
                        false
            Severity: Minor
            Found in lib/graphql/static_validation/literal_validator.rb - About 2 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 on_variable_definition has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                  def on_variable_definition(node, parent)
                    if !node.default_value.nil?
                      value = node.default_value
                      if node.type.is_a?(GraphQL::Language::Nodes::NonNullType)
                        add_error(GraphQL::StaticValidation::VariableDefaultValuesAreCorrectlyTypedError.new(

            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 reachable_type_set has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def reachable_type_set
                    return @reachable_type_set if defined?(@reachable_type_set)
            
                    @reachable_type_set = Set.new
            
            
            Severity: Major
            Found in lib/graphql/schema/warden.rb - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language