Skip to content

Commit

Permalink
Add def_node_search method to MethodDefineMacros option
Browse files Browse the repository at this point in the history
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
koic committed Oct 18, 2017
1 parent 110e28c commit 2af023c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Naming/PredicateName:
- define_method
- define_singleton_method
- def_node_matcher
- def_node_search

Style/FrozenStringLiteralComment:
EnforcedStyle: always
Expand Down

0 comments on commit 2af023c

Please sign in to comment.