class Object
Public Instance Methods
check()
click to toggle source
# File lib/puppet-lint/plugins/check_ghostbuster_classes.rb, line 18 def check return if path.match(%r{^\./(:?[^/]+/){2}?manifests/.+$}).nil? puppetdb = PuppetGhostbuster::PuppetDB.new class_indexes.each do |class_idx| title_token = class_idx[:name_token] title = title_token.value.split('::').map(&:capitalize).join('::') return if puppetdb.classes.include? title notify :warning, { :message => "Class #{title} seems unused", :line => title_token.line, :column => title_token.column, } end end
manifests()
click to toggle source
# File lib/puppet-lint/plugins/check_ghostbuster_facts.rb, line 16 def manifests Dir.glob('./**/manifests/**/*.pp') end
regexprs()
click to toggle source
# File lib/puppet-lint/plugins/check_ghostbuster_hiera_files.rb, line 17 def regexprs hiera_yaml_file = ENV['HIERA_YAML_PATH'] || '/etc/puppetlabs/code/hiera.yaml' hiera = YAML.load_file(hiera_yaml_file) regs = {} hiera[:hierarchy].each do |hierarchy| regex = hierarchy.gsub(/%\{(::)?(trusted|server_facts|facts)\.[^\}]+\}/, "(.+)").gsub(/%\{[^\}]+\}/, ".+") facts = hierarchy.match(regex).captures.map { |f| f[/%{(::)?(trusted|server_facts|facts)\.(.+)}/, 3] } regs[regex] = facts end regs end
templates()
click to toggle source
# File lib/puppet-lint/plugins/check_ghostbuster_facts.rb, line 20 def templates Dir.glob('./**/templates/**/*').select{ |f| File.file? f } end