Validating modules

Ensure that your module contains correct syntax and style by validating your module. PDK includes validations for module metadata, Puppet code syntax and style, and Ruby code syntax and style. 

When you run validations, PDK output tells you which validations it is running and notifies you of any errors or warnings it finds for each type of validation:

  • Syntax validations verify that your module code syntax works with specific versions of Puppet. If your module has syntax errors, correct them to ensure that your module works correctly.

  • Code style validations verify that your code follows style guidelines and best practices. Such errors do not prevent your module from functioning; however, fixing them makes your code readable and maintainable.

  • Metadata validations verify that module metadata is present and properly formatted. PDK unit testing relies on metadata for important information, such as operating system compatibility. Some of this information is also required if you publish your module to the Forge. Correct metadata errors to provide this information.

By default, PDK runs all available validations. You can customize PDK validation with command line options. For example, you can pass options to have PDK automatically correct some common code style problems, to validate only specific directories or files, or to run only certain types of validation, such as metadata or Puppet code.

You can output module validation results to a file in either JUnit or text format. You can specify multiple output formats and targets in the same command, as long as each target is unique.

For detailed information about module validations, see: