Sha256: ab93f15bc2021374001005099923e16388c59b6e58785439ea80b240c51e0454

Contents?: true

Size: 498 Bytes

Versions: 1

Compression:

Stored size: 498 Bytes

Contents

PuppetLint.new_check(:ghostbuster_types) do
  def manifests
    Dir.glob('./**/manifests/**/*.pp')
  end

  def check
    m = path.match(%r{.*/[^/]+/lib/puppet/type/(.+)\.rb$})
    return if m.nil?

    type_name = m.captures[0]

    manifests.each do |manifest|
      return if File.readlines(manifest).grep(%r{^\s*#{type_name}\s*\{}).size > 0
    end

    notify :warning, {
      :message => "Type #{type_name.capitalize} seems unused",
      :line    => 1,
      :column  => 1,
    }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
puppet-ghostbuster-0.7.0 lib/puppet-lint/plugins/check_ghostbuster_types.rb