lib/rubocop/cop/chef/deprecation/run_command_helper.rb in cookstyle-6.15.9 vs lib/rubocop/cop/chef/deprecation/run_command_helper.rb in cookstyle-6.16.4

- old
+ new

@@ -31,29 +31,29 @@ # run_command_with_systems_locale('/bin/foo') # # # good # shell_out!('/bin/foo') # - class UsesRunCommandHelper < Cop + class UsesRunCommandHelper < Base MSG = "Use 'shell_out!' instead of the legacy 'run_command' or 'run_command_with_systems_locale' helpers for shelling out. The run_command helper was removed in Chef Infra Client 13." def_node_matcher :calls_run_command?, '(send nil? {:run_command :run_command_with_systems_locale} ...)' def_node_matcher :require_mixin_command?, '(send nil? :require (str "chef/mixin/command"))' def_node_matcher :include_mixin_command?, '(send nil? :include (const (const (const nil? :Chef) :Mixin) :Command))' def_node_search :defines_run_command?, '(def {:run_command :run_command_with_systems_locale} ...)' def on_send(node) calls_run_command?(node) do - add_offense(node, location: :expression, message: MSG, severity: :warning) unless defines_run_command?(processed_source.ast) + add_offense(node, message: MSG, severity: :warning) unless defines_run_command?(processed_source.ast) end require_mixin_command?(node) do - add_offense(node, location: :expression, message: MSG, severity: :warning) + add_offense(node, message: MSG, severity: :warning) end include_mixin_command?(node) do - add_offense(node, location: :expression, message: MSG, severity: :warning) + add_offense(node, message: MSG, severity: :warning) end end end end end