Class PuppetLint
In: lib/puppet-lint/version.rb
lib/puppet-lint/tasks/puppet-lint.rb
lib/puppet-lint/plugins.rb
lib/puppet-lint/lexer/token.rb
lib/puppet-lint/lexer.rb
lib/puppet-lint/configuration.rb
lib/puppet-lint.rb
Parent: Object

Public: The public interface to puppet-lint.

Methods

Classes and Modules

Class PuppetLint::Bin
Class PuppetLint::CheckPlugin
Class PuppetLint::Checks
Class PuppetLint::Configuration
Class PuppetLint::Data
Class PuppetLint::Lexer
Class PuppetLint::LexerError
Class PuppetLint::NoCodeError
Class PuppetLint::NoFix
Class PuppetLint::OptParser
Class PuppetLint::Plugins
Class PuppetLint::RakeTask

Constants

VERSION = '1.1.0'

Attributes

code  [RW]  Public: Gets/Sets the String manifest code to be checked.
manifest  [R]  Public: Gets the String manifest with the errors fixed.
path  [RW]  Public: Gets/Sets the String path to the manifest to be checked.
problems  [R]  Public: Returns an Array of Hashes describing the problems found in the manifest.

Each Hash will contain *at least*:

  :check   - The Symbol name of the check that generated the problem.
  :kind    - The Symbol kind of the problem (:error, :warning, or
             :fixed).
  :line    - The Integer line number of the location of the problem in
             the manifest.
  :column  - The Integer column number of the location of the problem in
             the manifest.
  :message - The String message describing the problem that was found.
statistics  [R]  Public: Returns a Hash of linter statistics
  :error   - An Integer count of errors found in the manifest.
  :warning - An Integer count of warnings found in the manifest.
  :fixed   - An Integer count of problems found in the manifest that were
             automatically fixed.

Public Class methods

Public: Access PuppetLint‘s configuration from outside the class.

Returns a PuppetLint::Configuration object.

Public: Initialise a new PuppetLint object.

Public: Define a new check.

name - A unique name for the check as a Symbol. block - The check logic. This must contain a `check` method and optionally

        a `fix` method.

Returns nothing.

Examples

  PuppetLint.new_check(:foo) do
    def check
    end
  end

Public Instance methods

Public: Access PuppetLint‘s configuration from inside the class.

Returns a PuppetLint::Configuration object.

Public: Determine if PuppetLint found any errors in the manifest.

Returns true if errors were found, otherwise returns false.

Public: Set the path of the manifest file to be tested and read the contents of the file.

Returns nothing.

Internal: Format a problem message and print it to STDOUT.

message - A Hash containing all the information about a problem.

Returns nothing.

Internal: Retrieve the format string to be used when writing problems to STDOUT. If the user has not specified a custom log format, build one for them.

Returns a format String to be used with String#%.

Internal: Print out the line of the manifest on which the problem was found as well as a marker pointing to the location on the line.

message - A Hash containing all the information about a problem.

Returns nothing.

Public: Print any problems that were found out to stdout.

Returns nothing.

Internal: Print the reported problems with a manifest to stdout.

problems - An Array of problem Hashes as returned by

           PuppetLint::Checks#run.

Returns nothing.

Public: Run the loaded manifest code through the lint checks and print the results of the checks to stdout.

Returns nothing. Raises PuppetLint::NoCodeError if no manifest code has been loaded.

Public: Determine if PuppetLint found any warnings in the manifest.

Returns true if warnings were found, otherwise returns false.

[Validate]