rmosolgo/graphql-ruby

View on GitHub

Showing 302 of 302 total issues

Method build_suite has 494 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.build_suite(&block)
        Class.new(Minitest::Test) do
          @@parse_fn = block

          def parse(query_string)
Severity: Major
Found in lib/graphql/compatibility/schema_parser_specification.rb - About 2 days to fix

    Class Schema has 91 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Schema
        extend Forwardable
        extend GraphQL::Schema::Member::AcceptsDefinition
        include GraphQL::Define::InstanceDefinable
        accepts_definitions \
    Severity: Major
    Found in lib/graphql/schema.rb - About 1 day to fix

      File schema.rb has 742 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require "graphql/schema/base_64_encoder"
      require "graphql/schema/catchall_middleware"
      require "graphql/schema/default_parse_error"
      require "graphql/schema/default_type_error"
      require "graphql/schema/finder"
      Severity: Major
      Found in lib/graphql/schema.rb - About 1 day to fix

        Method build_suite has 345 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def self.build_suite(execution_strategy)
                Class.new(Minitest::Test) do
                  class << self
                    attr_accessor :counter_schema, :specification_schema
                  end
        Severity: Major
        Found in lib/graphql/compatibility/execution_specification.rb - About 1 day to fix

          File member.rb has 664 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          begin
            require 'parser/current'
          rescue LoadError
            raise LoadError, "GraphQL::Upgrader requires the 'parser' gem, please install it and/or add it to your Gemfile"
          end
          Severity: Major
          Found in lib/graphql/upgrader/member.rb - About 1 day to fix

            File schema_parser_specification.rb has 525 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            module GraphQL
              module Compatibility
                # This asserts that a given parse function turns a string into
                # the proper tree of {{GraphQL::Language::Nodes}}.
                module SchemaParserSpecification
            Severity: Major
            Found in lib/graphql/compatibility/schema_parser_specification.rb - About 1 day to fix

              Method build_suite has 186 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def self.build_suite(execution_strategy)
                      Class.new(Minitest::Test) do
                        class << self
                          attr_accessor :lazy_schema
                        end
              Severity: Major
              Found in lib/graphql/compatibility/lazy_execution_specification.rb - About 7 hrs to fix

                File nodes.rb has 431 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.
                      #
                Severity: Minor
                Found in lib/graphql/language/nodes.rb - About 6 hrs to fix

                  Method apply has a Cognitive Complexity of 41 (exceeds 5 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: Minor
                  Found in lib/graphql/upgrader/member.rb - About 6 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 has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def build(document, default_resolve: DefaultResolve)
                            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)
                  Severity: Minor
                  Found in lib/graphql/schema/build_from_definition.rb - About 5 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 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
                  Severity: Minor
                  Found in lib/graphql/schema/resolver.rb - About 5 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 has 123 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          def self.build(execution_strategy)
                            organization_type = nil
                  
                            timestamp_type = GraphQL::ScalarType.define do
                              name "Timestamp"

                    File execution_specification.rb has 355 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
                    Severity: Minor
                    Found in lib/graphql/compatibility/execution_specification.rb - About 4 hrs to fix

                      Class Printer has 34 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                          class Printer
                            # Turn an arbitrary AST node back into a string.
                            #
                            # @example Turning a document into a query string
                            #    document = GraphQL.parse(query_string)
                      Severity: Minor
                      Found in lib/graphql/language/printer.rb - About 4 hrs to fix

                        Method visit has a Cognitive Complexity of 29 (exceeds 5 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: Minor
                        Found in lib/graphql/schema/traversal.rb - About 4 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 104 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function sync(options) {
                          if (!options) {
                            options = {}
                          }
                          var logger = new Logger(options.quiet)
                        Severity: Major
                        Found in javascript_client/sync/index.js - About 4 hrs to fix

                          Identical blocks of code found in 2 locations. Consider refactoring.
                          Open

                            request(operation, forward) {
                              return new Observable((observer) => {
                                // Check the result of the operation
                                forward(operation).subscribe({ next: (data) => {
                                  // If the operation has the subscription header, it's a subscription
                          Severity: Major
                          Found in javascript_client/subscriptions/PusherLink.js and 1 other location - About 4 hrs to fix
                          javascript_client/subscriptions/AblyLink.js on lines 49..67

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 118.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Identical blocks of code found in 2 locations. Consider refactoring.
                          Open

                            request(operation, forward) {
                              return new Observable((observer) => {
                                // Check the result of the operation
                                forward(operation).subscribe({ next: (data) => {
                                  // If the operation has the subscription header, it's a subscription
                          Severity: Major
                          Found in javascript_client/subscriptions/AblyLink.js and 1 other location - About 4 hrs to fix
                          javascript_client/subscriptions/PusherLink.js on lines 47..65

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 118.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Method parse_type has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                          Open

                                  def parse_type(type_expr, null:)
                                    list_type = false
                          
                                    return_type = case type_expr
                                    when String
                          Severity: Minor
                          Found in lib/graphql/schema/member/build_type.rb - About 4 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_arguments has a Cognitive Complexity of 28 (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
                          
                          
                          Severity: Minor
                          Found in lib/graphql/query/literal_input.rb - About 4 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