class PuppetLint::CheckPlugin

Public: A class that contains and provides information for the puppet-lint checks.

This class should not be used directly, but instead should be inherited.

Examples

class PuppetLint::Plugin::CheckFoo < PuppetLint::CheckPlugin
end

Public Class Methods

new() click to toggle source

Internal: Initialise a new PuppetLint::CheckPlugin.

# File lib/puppet-lint/checkplugin.rb, line 12
def initialize
  @problems = []
end

Public Instance Methods

fix_problems() click to toggle source

Internal: Fix any problems the check plugin has detected.

Returns an Array of problem Hashes.

# File lib/puppet-lint/checkplugin.rb, line 37
def fix_problems
  @problems.each do |problem|
    if self.respond_to?(:fix)
      begin
        fix(problem)
      rescue PuppetLint::NoFix
        # noop
      else
        problem[:kind] = :fixed
      end
    end
  end

  @problems
end
run() click to toggle source

Internal: Check the manifest for problems and filter out any problems that should be ignored.

Returns an Array of problem Hashes.

# File lib/puppet-lint/checkplugin.rb, line 20
def run
  check

  @problems.each do |problem|
    if PuppetLint::Data.ignore_overrides[problem[:check]].has_key?(problem[:line])
      problem[:kind] = :ignored
      problem[:reason] = PuppetLint::Data.ignore_overrides[problem[:check]][problem[:line]]
      next
    end
  end

  @problems
end