Sha256: e0445de416cd3f421b4658bb06b038850d9a3d942cc68b6d556876fcf43ad4c4

Contents?: true

Size: 597 Bytes

Versions: 5

Compression:

Stored size: 597 Bytes

Contents

require 'puppet-ghostbuster/puppetdb'

PuppetLint.new_check(:ghostbuster_classes) do
  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
end

Version data entries

5 entries across 5 versions & 1 rubygems

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