Class: RuboCop::Cop::Chef::RedundantCode::DoubleCompileTime
- Extended by:
- AutoCorrector
- Defined in:
- lib/rubocop/cop/chef/redundant/double_compile_time.rb
Overview
If a resource includes the ‘compile_time` property there’s no need to also use ‘.run_action(:some_action)` on the resource block
Constant Summary collapse
- MSG =
"If a resource includes the `compile_time` property there's no need to also use `.run_action(:some_action)` on the resource block."
- RESTRICT_ON_SEND =
[:run_action].freeze
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#on_send(node) ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/rubocop/cop/chef/redundant/double_compile_time.rb', line 57 def on_send(node) compile_time_and_run_action?(node) do |resource, action, run_action| add_offense(node.loc.selector, severity: :refactor) do |corrector| corrector.replace(node, resource.source.gsub(action.to_s, run_action.to_s)) end end end |