Class: GraphQL::Modernize::Rules::PropertyOption
- Defined in:
- lib/graphql/modernize/rules/legacy.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#initialize, node_pattern, node_types, rule, #visit
Constructor Details
This class inherits a constructor from GraphQL::Modernize::Rules::Base
Instance Method Details
#on_match(node, _captures) ⇒ Object
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/graphql/modernize/rules/legacy.rb', line 243 def on_match(node, _captures) return unless inside?(node, :object, :interface) arguments = keyword_arguments(node, :property) return if arguments.empty? argument = arguments.first if arguments.length > 1 || keyword_arguments(node, :method).any? || dynamic_keyword_arguments?(node) return add_offense(argument.location, safety: :manual, message: "Resolve duplicate `property:` and `method:` manually") end add_offense(argument.key.location, message: "Replace `property:` with `method:`") do |rw| rw.replace_keyword_key(argument, :method) end end |