class RuboCop::Cop::Chef::Correctness::ScopedFileExist
Scope file exist to access the correct ‘File` class by using `::File.exist?` not `File.exist?`.
@example
#### incorrect not_if { File.exist?('/etc/foo/bar') } #### correct not_if { ::File.exist?('/etc/foo/bar') }
Constants
- MSG
Public Instance Methods
on_block(node)
click to toggle source
# File lib/rubocop/cop/chef/correctness/scoped_file_exist.rb, line 41 def on_block(node) unscoped_file_exist?(node) do |m| add_offense(m, severity: :refactor) do |corrector| corrector.replace(m, '::File') end end end