rmosolgo/graphql-ruby

View on GitHub

Showing 427 of 444 total issues

Method parse_type has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def parse_type(type_expr, null:)
          list_type = false

          return_type = case type_expr
          when String
Severity: Major
Found in lib/graphql/schema/member/build_type.rb - About 2 hrs to fix

    Method platform_trace has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

          def platform_trace(platform_key, key, data)
            if key == "execute_query"
              query = data[:query]
              title = query.selected_operation_name || "<anonymous>"
              category = platform_key
    Severity: Minor
    Found in lib/graphql/tracing/skylight_tracing.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

    File fields_will_merge.rb has 287 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module GraphQL
      module StaticValidation
        module FieldsWillMerge
          # Validates that a selection set is valid if all fields (including spreading any
          # fragments) either correspond to distinct response names or can be merged
    Severity: Minor
    Found in lib/graphql/static_validation/rules/fields_will_merge.rb - About 2 hrs to fix

      Class Runtime has 25 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

        Class Field has 25 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class Field
              if !String.method_defined?(:-@)
                using GraphQL::StringDedupBackport
              end
        
        
        Severity: Minor
        Found in lib/graphql/schema/field.rb - About 2 hrs to fix

          Class DocumentFromSchemaDefinition has 25 methods (exceeds 20 allowed). Consider refactoring.
          Open

              class DocumentFromSchemaDefinition
                def initialize(
                  schema, context: nil, only: nil, except: nil, include_introspection_types: false,
                  include_built_in_directives: false, include_built_in_scalars: false, always_include_schema: false
                )
          Severity: Minor
          Found in lib/graphql/language/document_from_schema_definition.rb - About 2 hrs to fix

            File query.rb has 284 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require "graphql/query/arguments"
            require "graphql/query/arguments_cache"
            require "graphql/query/context"
            require "graphql/query/executor"
            require "graphql/query/literal_input"
            Severity: Minor
            Found in lib/graphql/query.rb - About 2 hrs to fix

              Method resolve_dependencies has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                    def resolve_dependencies
                      dependency_map = DependencyMap.new
                      # Don't allow the loop to run more times
                      # than the number of fragments in the document
                      max_loops = 0
              Severity: Minor
              Found in lib/graphql/static_validation/definition_dependencies.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 load_value has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                      def load_value(value)
                        if value.is_a?(Array)
                          value.map{|item| load_value(item)}
                        elsif value.is_a?(Hash)
                          if value.size == 1 && value.key?(GLOBALID_KEY)
              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 on_argument has 68 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def on_argument(node, parent)
                      parent_defn = case parent
                      when GraphQL::Language::Nodes::InputObject
                        arg_defn = context.argument_definition
                        if arg_defn.nil?

                Class Warden has 24 methods (exceeds 20 allowed). Consider refactoring.
                Open

                    class Warden
                      # @param filter [<#call(member)>] Objects are hidden when `.call(member, ctx)` returns true
                      # @param context [GraphQL::Query::Context]
                      # @param schema [GraphQL::Schema]
                      # @param deep_check [Boolean]
                Severity: Minor
                Found in lib/graphql/schema/warden.rb - About 2 hrs to fix

                  Function prepareProject has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function prepareProject(filenames, addTypename) {
                    if(!filenames.length) { return []; }
                    var allGraphQL = ""
                    filenames.forEach(function(filename) {
                      allGraphQL += fs.readFileSync(filename)
                  Severity: Major
                  Found in javascript_client/sync/prepareProject.js - About 2 hrs to fix

                    Method visit has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def visit(schema, member, context_description)
                            case member
                            when GraphQL::Schema
                              member.directives.each { |name, directive| visit(schema, directive, "Directive #{name}") }
                              # Find the starting points, then visit them
                    Severity: Major
                    Found in lib/graphql/schema/traversal.rb - About 2 hrs to fix

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

                            def find_selections(subselections_by_type, selections_on_type, selected_type, ast_selections, arguments)
                              ast_selections.each do |ast_selection|
                                case ast_selection
                                when GraphQL::Language::Nodes::Field
                                  response_key = ast_selection.alias || ast_selection.name
                      Severity: Minor
                      Found in lib/graphql/execution/lookahead.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 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 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 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 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

                        Method add_type has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              def add_type(type, owner:, late_types:)
                                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})"
                        Severity: Major
                        Found in lib/graphql/schema.rb - About 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language