Skip to content


puppet-lint documentation

puppet-lint - GitHub

Configuration in MegaLinter

Variable Description Default value
PUPPET_PUPPET_LINT_ARGUMENTS User custom arguments to add in linter CLI call
Ex: -s --foo "bar"
Ex: (src\|lib)
Include every file
Ex: (test\|examples)
Exclude no file
PUPPET_PUPPET_LINT_CLI_LINT_MODE Override default CLI lint mode
- file: Calls the linter for each file
- list_of_files: Call the linter with the list of files as argument
- project: Call the linter from the root of the project
PUPPET_PUPPET_LINT_FILE_EXTENSIONS Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all files
Ex: [".py", ""]
PUPPET_PUPPET_LINT_FILE_NAMES_REGEX File name regex filters. Regular expression list for filtering files by their base names using regex full match. Empty list includes all files
Ex: ["Dockerfile(-.+)?", "Jenkinsfile"]
Include every file
PUPPET_PUPPET_LINT_PRE_COMMANDS List of bash commands to run before the linter None
PUPPET_PUPPET_LINT_POST_COMMANDS List of bash commands to run after the linter None
PUPPET_PUPPET_LINT_CONFIG_FILE puppet-lint configuration file name
Use LINTER_DEFAULT to let the linter find it
PUPPET_PUPPET_LINT_RULES_PATH Path where to find linter configuration file Workspace folder, then MegaLinter default rules
PUPPET_PUPPET_LINT_DISABLE_ERRORS Run linter but consider errors as warnings false
PUPPET_PUPPET_LINT_DISABLE_ERRORS_IF_LESS_THAN Maximum number of errors allowed 0

IDE Integration

Use puppet-lint in your favorite IDE to catch errors before MegaLinter !

IDE Extension Name Install
Visual Studio Code Puppet VsCode Extension Visit Web Site

MegaLinter Flavours

This linter is available in the following flavours

Flavor Description Embedded linters Info
all Default MegaLinter Flavor 95 Docker Image Size (tag) Docker Pulls

Behind the scenes

How are identified applicable files

  • File extensions: .pp

How the linting is performed

  • puppet-lint is called one time by identified file

Example calls

puppet-lint --fail-on-warnings --no-autoloader_layout-check myfile.pp
puppet-lint --fail-on-warnings --no-autoloader_layout-check --fix myfile.pp

Help content


    Basic Command Line Usage:
      puppet-lint [OPTIONS] PATH

            PATH                         The path to the Puppet manifest.

        --version                    Display the current version.
        --no-config                  Do not load default puppet-lint option files.
    -c, --config FILE                Load puppet-lint options from file.
        --with-context               Show where in the manifest the problem is.
        --with-filename              Display the filename before the warning.
        --fail-on-warnings           Return a non-zero exit status for warnings
        --error-level LEVEL          The level of error to return (warning, error or all).
        --show-ignored               Show problems that have been ignored by control comments
        --relative                   Compare module layout relative to the module root
    -l, --load FILE                  Load a file containing custom puppet-lint checks.
        --load-from-puppet MODULEPATH
                                     Load plugins from the given Puppet module path.
    -f, --fix                        Attempt to automatically fix errors
        --log-format FORMAT          Change the log format.
                                     Overrides --with-filename.
                                     The following placeholders can be used:
                                     %{filename} - Filename without path.
                                     %{path}     - Path as provided to puppet-lint.
                                     %{fullpath} - Expanded path to the file.
                                     %{line}     - Line number.
                                     %{column}   - Column number.
                                     %{kind}     - The kind of message (warning, error).
                                     %{KIND}     - Uppercase version of %{kind}.
                                     %{check}    - The name of the check.
                                     %{message}  - The message.
        --json                       Log output as JSON
        --list-checks                List available check names.

        --only-checks CHECKS         A comma separated list of checks that should be run
        --ignore-paths PATHS         A comma separated list of patterns to ignore
                                     Skip the unquoted_node_name check.
                                     Skip the right_to_left_relationship check.
                                     Skip the class_inherits_from_params_class check.
                                     Enable the class_inherits_from_params_class check.
        --no-autoloader_layout-check Skip the autoloader_layout check.
                                     Skip the names_containing_dash check.
        --no-variable_scope-check    Skip the variable_scope check.
                                     Skip the arrow_on_right_operand_line check.
        --no-code_on_top_scope-check Skip the code_on_top_scope check.
        --code_on_top_scope-check    Enable the code_on_top_scope check.
                                     Skip the nested_classes_or_defines check.
                                     Skip the inherits_across_namespaces check.
        --no-parameter_order-check   Skip the parameter_order check.
                                     Skip the names_containing_uppercase check.
        --no-slash_comments-check    Skip the slash_comments check.
        --no-star_comments-check     Skip the star_comments check.
                                     Skip the ensure_not_symlink_target check.
        --no-file_mode-check         Skip the file_mode check.
                                     Skip the ensure_first_param check.
        --no-duplicate_params-check  Skip the duplicate_params check.
                                     Skip the unquoted_file_mode check.
                                     Skip the unquoted_resource_title check.
                                     Skip the single_quote_string_with_variables check.
                                     Skip the double_quoted_strings check.
                                     Skip the variables_not_enclosed check.
        --no-quoted_booleans-check   Skip the quoted_booleans check.
        --quoted_booleans-check      Enable the quoted_booleans check.
                                     Skip the only_variable_string check.
                                     Skip the puppet_url_without_modules check.
                                     Skip the variable_contains_dash check.
                                     Skip the variable_is_lowercase check.
        --no-80chars-check           Skip the 80chars check.
        --80chars-check              Enable the 80chars check.
        --no-hard_tabs-check         Skip the hard_tabs check.
        --no-2sp_soft_tabs-check     Skip the 2sp_soft_tabs check.
        --no-arrow_alignment-check   Skip the arrow_alignment check.
                                     Skip the trailing_whitespace check.
        --no-140chars-check          Skip the 140chars check.
        --no-documentation-check     Skip the documentation check.
                                     Skip the case_without_default check.
                                     Skip the selector_inside_resource check.

Installation on mega-linter Docker image

Example success log

Results of puppet-lint linter (version 2.4.2)
See documentation on

[SUCCESS] .automation/test/puppet/puppet_good_1.pp

Example error log

Results of puppet-lint linter (version 2.4.2)
See documentation on

[ERROR] .automation/test/puppet/puppet_bad_1.pp
    WARNING: class not documented on line 1
    WARNING: line has more than 140 characters on line 7
    WARNING: double quoted string containing no variables on line 4
    WARNING: double quoted string containing no variables on line 5