Skip to content

Commit

Permalink
fix duplicate method in G::A::A::QueryComplexity
Browse files Browse the repository at this point in the history
with rubocop settings for it
  • Loading branch information
gfx committed Feb 21, 2019
1 parent d5da369 commit 6372704
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Expand Up @@ -26,6 +26,9 @@ Layout/EndAlignment:
Lint/UselessAssignment:
Enabled: true

Lint/DuplicateMethods:
Enabled: true

Metrics/ParameterLists:
Max: 7
CountKeywordArgs: false
Expand Down
2 changes: 1 addition & 1 deletion lib/graphql/analysis/ast/max_query_complexity.rb
Expand Up @@ -9,7 +9,7 @@ class MaxQueryComplexity < QueryComplexity
def result
return if query.max_complexity.nil?

total_complexity = super
total_complexity = max_possible_complexity

if total_complexity > query.max_complexity
GraphQL::AnalysisError.new("Query has complexity of #{total_complexity}, which exceeds max complexity of #{query.max_complexity}")
Expand Down
3 changes: 2 additions & 1 deletion lib/graphql/analysis/ast/query_complexity.rb
Expand Up @@ -57,7 +57,8 @@ def on_leave_fragment_spread(node, _, visitor)
visitor.leave_fragment_spread_inline(node)
end

def result
# @return [Integer]
def max_possible_complexity
@complexities_on_type.last.max_possible_complexity
end

Expand Down

0 comments on commit 6372704

Please sign in to comment.