Module: RuboCop::Cop::GemspecHelp
- Extended by:
- Macros
- Included in:
- RuboCop::Cop::Gemspec::AttributeAssignment, RuboCop::Cop::Gemspec::DependencyVersion, RuboCop::Cop::Gemspec::DuplicatedAssignment, RuboCop::Cop::Gemspec::RequireMFA, RuboCop::Cop::Gemspec::RubyVersionGlobalsUsage
- Defined in:
- lib/rubocop/cop/mixin/gemspec_help.rb
Overview
Common functionality for checking gem declarations.
Instance Method Summary collapse
- #assignment_method_declarations(node) ⇒ Object
- #gem_specification(node) ⇒ Object
- #gem_specification?(node) ⇒ Object
- #indexed_assignment_method_declarations(node) ⇒ Object
- #match_block_variable_name?(receiver_name) ⇒ Boolean
Instance Method Details
#assignment_method_declarations(node) ⇒ Object
30 31 32 33 |
# File 'lib/rubocop/cop/mixin/gemspec_help.rb', line 30 def_node_search :assignment_method_declarations, <<~PATTERN (send (lvar {#match_block_variable_name? :_1 :it}) _ ...) PATTERN |
#gem_specification(node) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/rubocop/cop/mixin/gemspec_help.rb', line 20 def_node_search :gem_specification, <<~PATTERN (block (send (const (const {cbase nil?} :Gem) :Specification) :new) (args (arg $_)) ...) PATTERN |
#gem_specification?(node) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/rubocop/cop/mixin/gemspec_help.rb', line 10 def_node_matcher :gem_specification?, <<~PATTERN (block (send (const (const {cbase nil?} :Gem) :Specification) :new) (args (arg $_)) ...) PATTERN |
#indexed_assignment_method_declarations(node) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/rubocop/cop/mixin/gemspec_help.rb', line 36 def_node_search :indexed_assignment_method_declarations, <<~PATTERN (send (send (lvar {#match_block_variable_name? :_1 :it}) _) :[]= literal? _ ) PATTERN |
#match_block_variable_name?(receiver_name) ⇒ Boolean
45 46 47 48 49 |
# File 'lib/rubocop/cop/mixin/gemspec_help.rb', line 45 def match_block_variable_name?(receiver_name) gem_specification(processed_source.ast) do |block_variable_name| return block_variable_name == receiver_name end end |