Sha256: f67fd89c254839c2f052222eff70c8de47e13890b88738b136c6a6daa9dd50a0
Contents?: true
Size: 995 Bytes
Versions: 2
Compression:
Stored size: 995 Bytes
Contents
module RuboCop module Cop module Facter # Check that custom facts do no use require_relative, as many Puppet deployments # may be using a version of Ruby that doesn't support it. require_relative was # introduced in Ruby 1.9.3, but many Puppet installations still use 1.8.7, as this # is the default version supplied with RHEL 6 # # @example # # bad # require_relative 'helpers/custom_fact_helper' # # # good # require 'helpers/custom_fact_helper' class RequireRelative < Cop # rubocop:disable Metrics/LineLength MSG = 'Avoid use of `require_relative` as it is not supported in Ruby 1.8.7, still used in many Puppet deployments'.freeze # rubocop:enable Metrics/LineLength def on_send(node) _receiver, method_name, *args = *node add_offense(node, :selector) if (method_name == :require_relative && _receiver == nil) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubocop-facter-0.2.1 | lib/rubocop/cop/facter/require_relative.rb |
rubocop-facter-0.2.0 | lib/rubocop/cop/facter/require_relative.rb |