rmosolgo/graphql-ruby

View on GitHub
lib/graphql/schema/member/build_type.rb

Summary

Maintainability
C
1 day
Test Coverage

Method parse_type has a Cognitive Complexity of 29 (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 constantize has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

        def constantize(string)
          names = string.split('::')

          # Trigger a built-in NameError exception including the ill-formed constant in the message.
          Object.const_get(string) if names.empty?
Severity: Minor
Found in lib/graphql/schema/member/build_type.rb - About 3 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 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 to_type_name has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

            def to_type_name(something)
              case something
              when GraphQL::BaseType, GraphQL::Schema::LateBoundType
                something.unwrap.name
              when Array
    Severity: Minor
    Found in lib/graphql/schema/member/build_type.rb - About 35 mins 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