rmosolgo/graphql-ruby

View on GitHub
lib/graphql/query.rb

Summary

Maintainability
D
1 day
Test Coverage

Class Query has 33 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Query
    include Tracing::Traceable
    extend Forwardable

    class OperationNameMissingError < GraphQL::ExecutionError
Severity: Minor
Found in lib/graphql/query.rb - About 4 hrs to fix

    File query.rb has 304 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/fingerprint"
    Severity: Minor
    Found in lib/graphql/query.rb - About 3 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 prepare_ast has a Cognitive Complexity of 15 (exceeds 5 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: Minor
        Found in lib/graphql/query.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 initialize has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def initialize(schema, query_string = nil, query: nil, document: nil, context: nil, variables: nil, validate: true, subscription_topic: nil, operation_name: nil, root_value: nil, max_depth: schema.max_depth, max_complexity: schema.max_complexity, except: nil, only: nil, warden: nil)
              # Even if `variables: nil` is passed, use an empty hash for simpler logic
              variables ||= {}
        
              # Use the `.graphql_definition` here which will return legacy types instead of classes
        Severity: Minor
        Found in lib/graphql/query.rb - About 1 hr to fix

          Method initialize has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def initialize(schema, query_string = nil, query: nil, document: nil, context: nil, variables: nil, validate: true, subscription_topic: nil, operation_name: nil, root_value: nil, max_depth: schema.max_depth, max_complexity: schema.max_complexity, except: nil, only: nil, warden: nil)
                # Even if `variables: nil` is passed, use an empty hash for simpler logic
                variables ||= {}
          
                # Use the `.graphql_definition` here which will return legacy types instead of classes
          Severity: Minor
          Found in lib/graphql/query.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

          There are no issues that match your filters.

          Category
          Status