Class: RuboCop::Cop::Itamae::CdInExecute
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Itamae::CdInExecute
- Defined in:
- lib/rubocop/cop/itamae/cd_in_execute.rb
Overview
Check that cd
in execute
.
Constant Summary collapse
- MSG =
"Insert `cwd '%<dir>s'` and remove this."
Instance Method Summary collapse
Instance Method Details
#on_block(node) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/rubocop/cop/itamae/cd_in_execute.rb', line 41 def on_block(node) find_execute_with_block(node) do |name, param_nodes| add_offence_for_execute_block_name(node, name) param_nodes.compact.each do |param_node| find_command(param_node) do |command| add_offense_for_command_param(param_node, command) end end end end |
#on_send(node) ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/rubocop/cop/itamae/cd_in_execute.rb', line 53 def on_send(node) return if node.parent&.block_type? find_execute_without_block(node) do |name| add_offense_for_execute_name(node, name) end end |