Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
def_node_search
method to MethodDefineMacros
option
Follow up for rubocop#4862. As with `def_node_matcher`, this commit added `def_node_search` method used for internal affair. The following are the use cases. ```console % git grep def_node_search .rubocop.yml: - def_node_search lib/rubocop/cop/bundler/duplicated_gem.rb: def_node_search: gem_declarations, '(send nil? :gem str ...)' lib/rubocop/cop/bundler/ordered_gems.rb: def_node_search :gem_declarations, <<-PATTERN lib/rubocop/cop/internal_affairs/useless_message_assertion.rb: def_node_search :described_class_msg, <<-PATTERN lib/rubocop/cop/mixin/unused_argument.rb: def_node_search :uses_var?, '(lvar %)' lib/rubocop/cop/performance/redundant_block_call.rb: def_node_search :blockarg_calls, <<-PATTERN lib/rubocop/cop/performance/redundant_block_call.rb: def_node_search :blockarg_assigned?, <<-PATTERN lib/rubocop/cop/performance/regexp_match.rb: def_node_search :search_match_nodes, MATCH_NODE_PATTERN lib/rubocop/cop/performance/regexp_match.rb: def_node_search :last_matches, <<-PATTERN lib/rubocop/cop/rails/file_path.rb: def_node_search :rails_root_nodes?, <<-PATTERN lib/rubocop/cop/style/parallel_assignment.rb: def_node_search :uses_var?, '{({lvar ivar cvar gvar} %) (const _ %)}' lib/rubocop/cop/style/parallel_assignment.rb: def_node_search :matching_calls, '(send %1 %2 $...)' lib/rubocop/cop/style/signal_exception.rb: def_node_search :custom_fail_methods, lib/rubocop/node_pattern.rb: def def_node_search(method_name, pattern_str) ``` There are no offenses now, it will be set for the future.
- Loading branch information