Showing 525 of 537 total issues
File field.rb
has 544 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "graphql/schema/field/connection_extension"
require "graphql/schema/field/scope_extension"
module GraphQL
class Schema
File runtime.rb
has 522 lines of code (exceeds 250 allowed). Consider refactoring. Open
module GraphQL
module Execution
class Interpreter
# I think it would be even better if we could somehow make
# `continue_field` not recursive. "Trampolining" it somehow.
File nodes.rb
has 477 lines of code (exceeds 250 allowed). Consider refactoring. Open
module GraphQL
module Language
module Nodes
# {AbstractNode} is the base class for all nodes in a GraphQL AST.
#
Method build
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
def build(document, default_resolve:, using: {}, relay:)
raise InvalidDocumentError.new('Must provide a document ast.') if !document || !document.is_a?(GraphQL::Language::Nodes::Document)
if default_resolve.is_a?(Hash)
default_resolve = ResolveMap.new(default_resolve)
- Read upRead up
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 from_arguments
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
def self.from_arguments(ast_arguments, argument_owner, variables)
context = variables ? variables.context : nil
values_hash = {}
defaults_used = Set.new
- Read upRead up
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 run
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
def run
# At a high level, the algorithm is:
#
# A) Inside Fibers, run jobs from the queue one-by-one
# - When one of the jobs yields to the dataloader (`Fiber.yield`), then that fiber will pause
- Read upRead up
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 add_type
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def add_type(type, owner:, late_types:, path:)
if type.respond_to?(:metadata) && type.metadata.is_a?(Hash)
type_class = type.metadata[:type_class]
if type_class.nil?
raise ArgumentError, "Can't add legacy type: #{type} (#{type.class})"
- Read upRead up
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
Function sync
has 153 lines of code (exceeds 25 allowed). Consider refactoring. Open
function sync(options: SyncOptions) {
var logger = new Logger(!!options.quiet)
var verbose = !!options.verbose
var url = options.url
if (!url) {
File createAblyHandlerTest.ts
has 403 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { createAblyHandler } from "../createAblyHandler"
import { Realtime, Types } from "ably"
const dummyOperation = { text: "", name: "" }
File build_from_definition.rb
has 388 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "graphql/schema/build_from_definition/resolve_map"
module GraphQL
class Schema
# TODO Populate `.directive(...)` from here
Method resolve_with_support
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def resolve_with_support(**args)
# First call the ready? hook which may raise
ready_val = if args.any?
ready?(**args)
else
- Read upRead up
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 35 (exceeds 5 allowed). Consider refactoring. Open
def initialize(type: nil, name: nil, owner: nil, null: nil, field: nil, function: nil, description: nil, deprecation_reason: nil, method: nil, hash_key: nil, resolver_method: nil, resolve: nil, connection: nil, max_page_size: :not_given, scope: nil, introspection: false, camelize: true, trace: nil, complexity: 1, ast_node: nil, extras: EMPTY_ARRAY, extensions: EMPTY_ARRAY, connection_extension: self.class.connection_extension, resolver_class: nil, subscription_scope: nil, relay_node_field: false, relay_nodes_field: false, method_conflict_warning: true, broadcastable: nil, arguments: EMPTY_HASH, directives: EMPTY_HASH, validates: EMPTY_ARRAY, legacy_edge_class: nil, &definition_block)
if name.nil?
raise ArgumentError, "missing first `name` argument or keyword `name:`"
end
if !(field || function || resolver_class)
- Read upRead up
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 33 (exceeds 5 allowed). Consider refactoring. Open
def build_rows(context_entry, rows:, top: false)
case context_entry
when Backtrace::Frame
field_alias = context_entry.ast_node.respond_to?(:alias) && context_entry.ast_node.alias
value = if top && @override_value
- Read upRead up
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
Function createAblyHandler
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createAblyHandler(options: AblyHandlerOptions) {
const { ably, fetchOperation } = options
const isAnonymousClient = () =>
!ably.auth.clientId || ably.auth.clientId === "*"
Method evaluate_selection_with_args
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def evaluate_selection_with_args(kwarg_arguments, field_defn, next_path, ast_node, field_ast_nodes, scoped_context, owner_type, object, is_eager_field) # rubocop:disable Metrics/ParameterLists
context.scoped_context = scoped_context
return_type = field_defn.type
after_lazy(kwarg_arguments, owner: owner_type, field: field_defn, path: next_path, ast_node: ast_node, scoped_context: context.scoped_context, owner_object: object, arguments: kwarg_arguments) do |resolved_arguments|
if resolved_arguments.is_a?(GraphQL::ExecutionError) || resolved_arguments.is_a?(GraphQL::UnauthorizedError)
- Read upRead up
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_arguments
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def normalize_arguments(event_name, arg_owner, args)
case arg_owner
when GraphQL::Field, GraphQL::InputObjectType, GraphQL::Schema::Field, Class
if arg_owner.is_a?(Class) && !arg_owner.kind.input_object?
# it's a type, but not an input object
- Read upRead up
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 execution_specification.rb
has 356 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "graphql/compatibility/execution_specification/counter_schema"
require "graphql/compatibility/execution_specification/specification_schema"
module GraphQL
module Compatibility
Class Query
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
class Query
include Tracing::Traceable
extend Forwardable
class OperationNameMissingError < GraphQL::ExecutionError
Method initialize
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def initialize(ctx, ast_variables, provided_variables)
schema = ctx.schema
@context = ctx
@provided_variables = GraphQL::Argument.deep_stringify(provided_variables)
- Read upRead up
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 30 (exceeds 5 allowed). Consider refactoring. Open
def continue_field(path, value, owner_type, field, current_type, ast_node, next_selections, is_non_null, owner_object, arguments) # rubocop:disable Metrics/ParameterLists
case current_type.kind.name
when "SCALAR", "ENUM"
r = current_type.coerce_result(value, context)
write_in_response(path, r)
- Read upRead up
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"