Sha256: d0ade96d185367f63ff3cedfe38a955d07b26834134912fe541e9e2a29418b20

Contents?: true

Size: 647 Bytes

Versions: 5

Compression:

Stored size: 647 Bytes

Contents

require 'puppet-ghostbuster/puppetdb'

PuppetLint.new_check(:ghostbuster_defines) do
  def check
    return if path.match(%r{^\./(:?[^/]+/){2}?manifests/.+$}).nil?

    puppetdb = PuppetGhostbuster::PuppetDB.new

    defined_type_indexes.each do |define_idx|
      title_token = define_idx[:name_token]
      type = title_token.value.split('::').map(&:capitalize).join('::')

      return if puppetdb.client.request('resources', [:'=', 'type', type]).data.size > 0

      notify :warning, {
        :message => "Define #{type} seems unused",
        :line    => title_token.line,
        :column  => title_token.column,
      }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
puppet-ghostbuster-0.7.1 lib/puppet-lint/plugins/check_ghostbuster_defines.rb
puppet-ghostbuster-0.7.0 lib/puppet-lint/plugins/check_ghostbuster_defines.rb
puppet-ghostbuster-0.6.0 lib/puppet-lint/plugins/check_ghostbuster_defines.rb
puppet-ghostbuster-0.5.1 lib/puppet-lint/plugins/check_ghostbuster_defines.rb
puppet-ghostbuster-0.5.0 lib/puppet-lint/plugins/check_ghostbuster_defines.rb