class RuboCop::Cop::Facter::FacterUtil

Check that custom facts do not require files in facter/util, as they’ve all been removed in cfacter.

@example

# bad
Facter::Util::Macaddress.standardize('eth1')

# good
Facter::Core::Resolution.exec('ip  addr show eth1|sed -n 2p').split(' ')[1]

Constants

MSG

rubocop:disable Metrics/LineLength

Public Instance Methods

on_send(node) click to toggle source

rubocop:enable Metrics/LineLength

# File lib/rubocop/cop/facter/facter_util.rb, line 17
def on_send(node)
  _receiver, method_name, *args = *node

  add_offense(node, :selector) if (method_name == :require && _receiver == nil && args.first.children.first =~ /facter\/util/)
end