Skip to content

Commit 2fb9c8f

Browse files
committed
location is not a valid keyword for add_offense
``` Scanning /Users/issyl0/repos/github/graphql-client/test/test_client.rb An error occurred while GraphQL/Heredoc cop was inspecting /Users/issyl0/repos/github/graphql-client/test/test_client.rb:724:19. unknown keyword: :location /Users/issyl0/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/rubocop-1.73.2/lib/rubocop/cop/base.rb:201:in `add_offense' /Users/issyl0/repos/github/graphql-client/lib/rubocop/cop/graphql/heredoc.rb:22:in `block in check_str' ```
1 parent ec817bb commit 2fb9c8f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/rubocop/cop/graphql/heredoc.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ def check_str(node)
1919
return unless node.location.expression.source =~ /^<<(-|~)?GRAPHQL/
2020

2121
node.each_child_node(:begin) do |begin_node|
22-
add_offense(begin_node, location: :expression, message: "Do not interpolate variables into GraphQL queries, " \
22+
add_offense(begin_node, message: "Do not interpolate variables into GraphQL queries, " \
2323
"used variables instead.")
2424
end
2525

26-
add_offense(node, location: :expression, message: "GraphQL heredocs should be quoted. <<-'GRAPHQL'")
26+
add_offense(node, message: "GraphQL heredocs should be quoted. <<-'GRAPHQL'")
2727
end
2828

2929
def autocorrect(node)

lib/rubocop/cop/graphql/overfetch.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def investigate(processed_source)
4242

4343
visitor.fields.each do |field, count|
4444
next if count > 0
45-
add_offense(nil, location: visitor.ranges[field], message: "GraphQL field '#{field}' query but was not used in template.")
45+
add_offense(nil, message: "GraphQL field '#{field}' query but was not used in template.")
4646
end
4747
end
4848

0 commit comments

Comments
 (0)