rmosolgo/graphql-ruby

View on GitHub

Showing 446 of 458 total issues

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

      LOCATIONS = [
        QUERY =                  :QUERY,
        MUTATION =               :MUTATION,
        SUBSCRIPTION =           :SUBSCRIPTION,
        FIELD =                  :FIELD,
Severity: Minor
Found in lib/graphql/schema/directive.rb and 1 other location - About 40 mins to fix
lib/graphql/directive.rb on lines 27..46

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 38.

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

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

            items[index_from_cursor(after)..index_from_cursor(before)-1] || []
          elsif before
            items[0..index_from_cursor(before)-2] || []
          elsif after
            items[index_from_cursor(after)..-1] || []
Severity: Minor
Found in lib/graphql/pagination/array_connection.rb and 1 other location - About 40 mins to fix
lib/graphql/relay/array_connection.rb on lines 68..75

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 38.

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

Similar blocks of code found in 8 locations. Consider refactoring.
Open

  module StaticValidation
    class DirectivesAreDefinedError < StaticValidation::Error
      attr_reader :directive_name

      def initialize(message, path: nil, nodes: [], directive:)
lib/graphql/static_validation/rules/argument_names_are_unique_error.rb on lines 3..25
lib/graphql/static_validation/rules/fragment_names_are_unique_error.rb on lines 3..25
lib/graphql/static_validation/rules/fragment_types_exist_error.rb on lines 3..25
lib/graphql/static_validation/rules/fragments_are_finite_error.rb on lines 3..25
lib/graphql/static_validation/rules/fragments_are_used_error.rb on lines 3..25
lib/graphql/static_validation/rules/unique_directives_per_location_error.rb on lines 3..25
lib/graphql/static_validation/rules/variable_names_are_unique_error.rb on lines 3..25

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 38.

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

    LOCATION_DESCRIPTIONS = {
      QUERY:                    'Location adjacent to a query operation.',
      MUTATION:                 'Location adjacent to a mutation operation.',
      SUBSCRIPTION:             'Location adjacent to a subscription operation.',
      FIELD:                    'Location adjacent to a field.',
Severity: Minor
Found in lib/graphql/directive.rb and 1 other location - About 40 mins to fix
lib/graphql/schema/directive.rb on lines 112..130

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 38.

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

      def execute(query_str = nil, **kwargs)
        if query_str
          kwargs[:query] = query_str
        end
        # Some of the query context _should_ be passed to the multiplex, too
Severity: Minor
Found in lib/graphql/schema.rb and 1 other location - About 40 mins to fix
lib/graphql/schema.rb on lines 391..406

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 38.

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

Similar blocks of code found in 8 locations. Consider refactoring.
Open

  module StaticValidation
    class ArgumentNamesAreUniqueError < StaticValidation::Error
      attr_reader :name

      def initialize(message, path: nil, nodes: [], name:)
lib/graphql/static_validation/rules/directives_are_defined_error.rb on lines 3..25
lib/graphql/static_validation/rules/fragment_names_are_unique_error.rb on lines 3..25
lib/graphql/static_validation/rules/fragment_types_exist_error.rb on lines 3..25
lib/graphql/static_validation/rules/fragments_are_finite_error.rb on lines 3..25
lib/graphql/static_validation/rules/fragments_are_used_error.rb on lines 3..25
lib/graphql/static_validation/rules/unique_directives_per_location_error.rb on lines 3..25
lib/graphql/static_validation/rules/variable_names_are_unique_error.rb on lines 3..25

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 38.

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

Similar blocks of code found in 8 locations. Consider refactoring.
Open

  module StaticValidation
    class UniqueDirectivesPerLocationError < StaticValidation::Error
      attr_reader :directive_name

      def initialize(message, path: nil, nodes: [], directive:)
lib/graphql/static_validation/rules/argument_names_are_unique_error.rb on lines 3..25
lib/graphql/static_validation/rules/directives_are_defined_error.rb on lines 3..25
lib/graphql/static_validation/rules/fragment_names_are_unique_error.rb on lines 3..25
lib/graphql/static_validation/rules/fragment_types_exist_error.rb on lines 3..25
lib/graphql/static_validation/rules/fragments_are_finite_error.rb on lines 3..25
lib/graphql/static_validation/rules/fragments_are_used_error.rb on lines 3..25
lib/graphql/static_validation/rules/variable_names_are_unique_error.rb on lines 3..25

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 38.

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

Similar blocks of code found in 8 locations. Consider refactoring.
Open

  module StaticValidation
    class FragmentsAreFiniteError < StaticValidation::Error
      attr_reader :fragment_name

      def initialize(message, path: nil, nodes: [], name:)
lib/graphql/static_validation/rules/argument_names_are_unique_error.rb on lines 3..25
lib/graphql/static_validation/rules/directives_are_defined_error.rb on lines 3..25
lib/graphql/static_validation/rules/fragment_names_are_unique_error.rb on lines 3..25
lib/graphql/static_validation/rules/fragment_types_exist_error.rb on lines 3..25
lib/graphql/static_validation/rules/fragments_are_used_error.rb on lines 3..25
lib/graphql/static_validation/rules/unique_directives_per_location_error.rb on lines 3..25
lib/graphql/static_validation/rules/variable_names_are_unique_error.rb on lines 3..25

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 38.

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

      LOCATION_DESCRIPTIONS = {
        QUERY:                    'Location adjacent to a query operation.',
        MUTATION:                 'Location adjacent to a mutation operation.',
        SUBSCRIPTION:             'Location adjacent to a subscription operation.',
        FIELD:                    'Location adjacent to a field.',
Severity: Minor
Found in lib/graphql/schema/directive.rb and 1 other location - About 40 mins to fix
lib/graphql/directive.rb on lines 48..66

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 38.

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

Similar blocks of code found in 8 locations. Consider refactoring.
Open

  module StaticValidation
    class FragmentNamesAreUniqueError < StaticValidation::Error
      attr_reader :fragment_name

      def initialize(message, path: nil, nodes: [], name:)
lib/graphql/static_validation/rules/argument_names_are_unique_error.rb on lines 3..25
lib/graphql/static_validation/rules/directives_are_defined_error.rb on lines 3..25
lib/graphql/static_validation/rules/fragment_types_exist_error.rb on lines 3..25
lib/graphql/static_validation/rules/fragments_are_finite_error.rb on lines 3..25
lib/graphql/static_validation/rules/fragments_are_used_error.rb on lines 3..25
lib/graphql/static_validation/rules/unique_directives_per_location_error.rb on lines 3..25
lib/graphql/static_validation/rules/variable_names_are_unique_error.rb on lines 3..25

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 38.

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

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

          nodes[index_from_cursor(after)..index_from_cursor(before)-1] || []
        elsif before
          nodes[0..index_from_cursor(before)-2] || []
        elsif after
          nodes[index_from_cursor(after)..-1] || []
Severity: Minor
Found in lib/graphql/relay/array_connection.rb and 1 other location - About 40 mins to fix
lib/graphql/pagination/array_connection.rb on lines 38..45

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 38.

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

Similar blocks of code found in 8 locations. Consider refactoring.
Open

  module StaticValidation
    class FragmentTypesExistError < StaticValidation::Error
      attr_reader :type_name

      def initialize(message, path: nil, nodes: [], type:)
lib/graphql/static_validation/rules/argument_names_are_unique_error.rb on lines 3..25
lib/graphql/static_validation/rules/directives_are_defined_error.rb on lines 3..25
lib/graphql/static_validation/rules/fragment_names_are_unique_error.rb on lines 3..25
lib/graphql/static_validation/rules/fragments_are_finite_error.rb on lines 3..25
lib/graphql/static_validation/rules/fragments_are_used_error.rb on lines 3..25
lib/graphql/static_validation/rules/unique_directives_per_location_error.rb on lines 3..25
lib/graphql/static_validation/rules/variable_names_are_unique_error.rb on lines 3..25

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 38.

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

    def execute(query_str = nil, **kwargs)
      if query_str
        kwargs[:query] = query_str
      end
      # Some of the query context _should_ be passed to the multiplex, too
Severity: Minor
Found in lib/graphql/schema.rb and 1 other location - About 40 mins to fix
lib/graphql/schema.rb on lines 1514..1529

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 38.

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

Consider simplifying this complex logical expression.
Open

  if (typeof observerOrNext === 'function') {
    // Duck-type an observer
    return {
      next: (v: object) => observerOrNext(v),
      error: (e: object) => onError && onError(e),
Severity: Major
Found in javascript_client/src/subscriptions/PusherLink.ts - About 40 mins to fix

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

      constructor(options: { ably: Realtime }) {
        super()
        // Retain a handle to the Ably client
        this.ably = options.ably
      }
    Severity: Minor
    Found in javascript_client/src/subscriptions/AblyLink.ts and 1 other location - About 40 mins to fix
    javascript_client/src/subscriptions/PusherLink.ts on lines 46..50

    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 48.

    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

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

      constructor(options: { pusher: Pusher }) {
        super()
        // Retain a handle to the Pusher client
        this.pusher = options.pusher
      }
    Severity: Minor
    Found in javascript_client/src/subscriptions/PusherLink.ts and 1 other location - About 40 mins to fix
    javascript_client/src/subscriptions/AblyLink.ts on lines 47..51

    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 48.

    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 evaluate_selections has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            def evaluate_selections(path, scoped_context, owner_object, owner_type, selections, root_operation_type: nil)
    Severity: Minor
    Found in lib/graphql/execution/interpreter/runtime.rb - About 35 mins to fix

      Method continue_value has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              def continue_value(path, value, field, is_non_null, ast_node)
      Severity: Minor
      Found in lib/graphql/execution/interpreter/runtime.rb - About 35 mins to fix

        Method from_options has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def self.from_options(name = nil, type = nil, desc = nil, resolver: nil, mutation: nil, subscription: nil,**kwargs, &block)
        Severity: Minor
        Found in lib/graphql/schema/field.rb - About 35 mins to fix

          Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  def initialize(context, key, irep_node, parent, object)
          Severity: Minor
          Found in lib/graphql/query/context.rb - About 35 mins to fix
            Severity
            Category
            Status
            Source
            Language