Skip to content

Commit

Permalink
Rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
RStankov committed Jun 19, 2019
1 parent afc3617 commit 89761ae
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
12 changes: 12 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,22 @@ Style/EachWithObject:
Style/CollectionMethods:
Enabled: false

# Disables "Avoid the use of double negation (!!)."
Style/DoubleNegation:
Enabled: false

# Disables "Block has too many lines."
Metrics/BlockLength:
Enabled: false

# Disables "Assignment Branch Condition size for field_options is too high."
Metrics/AbcSize:
Enabled: false

# Disables "Method has too many line."
Metrics/MethodLength:
Enabled: false

# Disables "Example has too many lines."
RSpec/ExampleLength:
Enabled: false
Expand Down
6 changes: 3 additions & 3 deletions lib/search_object/plugin/graphql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def resolve_with_support(args = {})
end

module ClassMethods
KEYS = %i(type default description)
KEYS = %i[type default description].freeze
def option(name, options = {}, &block)
config[:arguments] ||= {}
config[:arguments][name.to_s] = KEYS.inject({}) do |acc, key|
Expand Down Expand Up @@ -106,12 +106,12 @@ def field_options
description: options[:description],
required: !!options[:required],
default_value: options.fetch(:default) { ::GraphQL::Schema::Argument::NO_DEFAULT },
owner: self,
owner: self
)
acc
end,
null: !!config[:null],
complexity: complexity,
complexity: complexity
}
end

Expand Down
4 changes: 2 additions & 2 deletions spec/search_object/plugin/graphql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def define_search_class_and_return_schema(&block)
end

it 'can be used as GraphQL::Function' do
post_type = GraphQL::ObjectType.define do
post_type = GraphQL::ObjectType.define do
name 'Post'

field :id, !types.ID
Expand Down Expand Up @@ -123,7 +123,7 @@ def define_search_class_and_return_schema(&block)
field :parent, parent_type, null: false
end

root = OpenStruct.new(parent: OpenStruct.new(posts: [Post.new('from_parent')]) )
root = OpenStruct.new(parent: OpenStruct.new(posts: [Post.new('from_parent')]))

result = schema.execute '{ parent { posts { id } } }', root_value: root

Expand Down

0 comments on commit 89761ae

Please sign in to comment.