rmosolgo/graphql-ruby

View on GitHub

Showing 476 of 488 total issues

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

      def create_folder_structure
        create_dir("#{options[:directory]}/types")
        template("schema.erb", schema_file_path)

        ["base_object", "base_argument", "base_field", "base_enum", "base_input_object", "base_interface", "base_scalar", "base_union"].each do |base_type|
Severity: Major
Found in lib/generators/graphql/install_generator.rb - About 2 hrs to fix

    File document_from_schema_definition.rb has 263 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module GraphQL
      module Language
        # @api private
        #
        # {GraphQL::Language::DocumentFromSchemaDefinition} is used to convert a {GraphQL::Schema} object
    Severity: Minor
    Found in lib/graphql/language/document_from_schema_definition.rb - About 2 hrs to fix

      Method define_type has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def define_type(type, type_resolver)
                loader = self
                case type.fetch("kind")
                when "ENUM"
                  Class.new(GraphQL::Schema::Enum) do
      Severity: Major
      Found in lib/graphql/schema/loader.rb - About 2 hrs to fix

        Method coerce_arguments has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def coerce_arguments(parent_object, values, context)
                  argument_values = {}
                  kwarg_arguments = {}
                  # Cache this hash to avoid re-merging it
                  arg_defns = self.arguments
        Severity: Major
        Found in lib/graphql/schema/member/has_arguments.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 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(arguments = nil, ruby_kwargs: nil, context:, defaults_used:)
                    @context = context
                    if ruby_kwargs
                      @ruby_style_hash = ruby_kwargs
                      @arguments = arguments
            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 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
                          parent_type = field.owner_type
                          err = parent_type::InvalidNullError.new(parent_type, field, value)
            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 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 dump_value has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                    def dump_value(obj)
                      if obj.is_a?(Array)
                        obj.map{|item| dump_value(item)}
                      elsif obj.is_a?(Hash)
                        symbol_keys = nil
            Severity: Minor
            Found in lib/graphql/subscriptions/serialize.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 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

              Class Context has 21 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class Context
                    module SharedMethods
                      # @return [Object] The target for field resolution
                      attr_accessor :object
              
              
              Severity: Minor
              Found in lib/graphql/query/context.rb - About 2 hrs to fix

                Class Resolver has 21 methods (exceeds 20 allowed). Consider refactoring.
                Open

                    class Resolver
                      include Schema::Member::GraphQLTypeNames
                      # Really we only need description from here, but:
                      extend Schema::Member::BaseDSLMethods
                      extend GraphQL::Schema::Member::HasArguments
                Severity: Minor
                Found in lib/graphql/schema/resolver.rb - About 2 hrs to fix

                  Method prepare_ast has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def prepare_ast
                        @prepared_ast = true
                        @warden ||= GraphQL::Schema::Warden.new(@filter, schema: @schema, context: @context)
                        parse_error = nil
                        @document ||= begin
                  Severity: Major
                  Found in lib/graphql/query.rb - About 2 hrs to fix

                    Method to_graphql has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def to_graphql
                            field_defn = if @field
                              @field.dup
                            elsif @function
                              GraphQL::Function.build_field(@function)
                    Severity: Major
                    Found in lib/graphql/schema/field.rb - About 2 hrs to fix

                      Method apply has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            def apply(input_text)
                              input_text.scan(/(?:input_field|field|return_field|connection|argument) .*$/).each do |field|
                                matches = /(?<field_type>input_field|return_field|field|connection|argument) :(?<name>[a-zA-Z_0-9_]*)?(:?, +(?<return_type>([A-Za-z\[\]\.\!_0-9\(\)]|::|-> ?\{ ?| ?\})+))?(?<remainder>( |,|$).*)/.match(field)
                                if matches
                                  name = matches[:name]
                      Severity: Major
                      Found in lib/graphql/upgrader/member.rb - About 2 hrs to fix

                        Method trim_whitespace has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def self.trim_whitespace(str)
                                lines = str.split("\n")
                                common_indent = nil
                        
                                # find the common whitespace
                        Severity: Minor
                        Found in lib/graphql/language/block_string.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

                        Function sync has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function sync(options: SyncOptions) {
                          var logger = new Logger(!!options.quiet)
                          var verbose = !!options.verbose
                          var url = options.url
                          if (!url) {
                        Severity: Minor
                        Found in javascript_client/src/sync/index.ts - 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 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def validate(query, validate: true)
                                query.trace("validate", { validate: validate, query: query }) do
                                  can_skip_rewrite = query.context.interpreter? && query.schema.using_ast_analysis? && query.schema.is_a?(Class)
                                  errors = if validate == false && can_skip_rewrite
                                    []
                        Severity: Minor
                        Found in lib/graphql/static_validation/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

                        Severity
                        Category
                        Status
                        Source
                        Language