diff --git a/graphql-client.gemspec b/graphql-client.gemspec index b5324df3..dea5a8c4 100644 --- a/graphql-client.gemspec +++ b/graphql-client.gemspec @@ -18,7 +18,7 @@ Gem::Specification.new do |s| s.add_development_dependency "minitest", "~> 5.9" s.add_development_dependency "rake", "~> 13.2.1" s.add_development_dependency "rubocop-github" - s.add_development_dependency "rubocop", "~> 1.66.1" + s.add_development_dependency "rubocop", "~> 1.73.2" s.required_ruby_version = ">= 2.1.0" diff --git a/lib/rubocop/cop/graphql/heredoc.rb b/lib/rubocop/cop/graphql/heredoc.rb index 19f92d9d..43c2b4ec 100644 --- a/lib/rubocop/cop/graphql/heredoc.rb +++ b/lib/rubocop/cop/graphql/heredoc.rb @@ -5,7 +5,7 @@ module RuboCop module Cop module GraphQL # Public: Cop for enforcing non-interpolated GRAPHQL heredocs. - class Heredoc < Cop + class Heredoc < Base def on_dstr(node) check_str(node) end @@ -19,11 +19,11 @@ def check_str(node) return unless node.location.expression.source =~ /^<<(-|~)?GRAPHQL/ node.each_child_node(:begin) do |begin_node| - add_offense(begin_node, location: :expression, message: "Do not interpolate variables into GraphQL queries, " \ + add_offense(begin_node, message: "Do not interpolate variables into GraphQL queries, " \ "used variables instead.") end - add_offense(node, location: :expression, message: "GraphQL heredocs should be quoted. <<-'GRAPHQL'") + add_offense(node, message: "GraphQL heredocs should be quoted. <<-'GRAPHQL'") end def autocorrect(node) diff --git a/lib/rubocop/cop/graphql/overfetch.rb b/lib/rubocop/cop/graphql/overfetch.rb index bd98084d..182fe838 100644 --- a/lib/rubocop/cop/graphql/overfetch.rb +++ b/lib/rubocop/cop/graphql/overfetch.rb @@ -8,7 +8,7 @@ module RuboCop module Cop module GraphQL # Public: Rubocop for catching overfetched fields in ERB templates. - class Overfetch < Cop + class Overfetch < Base if defined?(RangeHelp) # rubocop 0.53 moved the #source_range method into this module include RangeHelp @@ -42,7 +42,7 @@ def investigate(processed_source) visitor.fields.each do |field, count| next if count > 0 - add_offense(nil, location: visitor.ranges[field], message: "GraphQL field '#{field}' query but was not used in template.") + add_offense(nil, message: "GraphQL field '#{field}' query but was not used in template.") end end diff --git a/test/test_client_errors.rb b/test/test_client_errors.rb index 3937d48b..f7f49af7 100644 --- a/test/test_client_errors.rb +++ b/test/test_client_errors.rb @@ -310,7 +310,7 @@ def test_errors_collection "errors" => [ { "message" => "b00m", - "locations" => [{"line" => 1, "column" => 3}], + "locations" => [{ "line" => 1, "column" => 3 }], "path" => ["nullableError"] } ] diff --git a/test/test_client_schema.rb b/test/test_client_schema.rb index 34d681e6..bb8d7fbb 100644 --- a/test/test_client_schema.rb +++ b/test/test_client_schema.rb @@ -61,7 +61,7 @@ def test_dump_schema_io def test_dump_schema_context conn = FakeConn.new - GraphQL::Client.dump_schema(conn, StringIO.new, context: { user_id: 1}) + GraphQL::Client.dump_schema(conn, StringIO.new, context: { user_id: 1 }) assert_equal({ user_id: 1 }, conn.context) end end diff --git a/test/test_query_result.rb b/test/test_query_result.rb index ed6cd83e..0930eeea 100644 --- a/test/test_query_result.rb +++ b/test/test_query_result.rb @@ -270,7 +270,7 @@ def test_snakecase_field_aliases GRAPHQL person = Temp::Person.new(@client.query(Temp::Query).data.me) - raw_result = {"firstName"=>"Joshua", "lastName"=>"Peek"} + raw_result = { "firstName" => "Joshua", "lastName" => "Peek" } assert_equal raw_result, person.to_h assert_equal raw_result, person.to_hash