Skip to content

puppet-lint

GitHub stars autofix GitHub release (latest SemVer) GitHub last commit GitHub commit activity GitHub contributors

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"
PUPPET_PUPPET_LINT_FILTER_REGEX_INCLUDE Custom regex including filter
Ex: (src\|lib)
Include every file
PUPPET_PUPPET_LINT_FILTER_REGEX_EXCLUDE Custom regex excluding filter
Ex: (test\|examples)
Exclude no file
PUPPET_PUPPET_LINT_CLI_LINT_MODE Override default CLI lint mode
- file: Calls the linter for each file
- project: Call the linter from the root of the project
file
PUPPET_PUPPET_LINT_FILE_EXTENSIONS Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all files
Ex: [".py", ""]
[".pp"]
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 nameUse LINTER_DEFAULT to let the linter find it .puppet-lint.rc
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 114 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 (file CLI lint mode)

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

    puppet-lint

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

            PATH                         The path to the Puppet manifest.

    Option:
        --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
        --sarif                      Log output as SARIF
        --codeclimate-report-file FILE
                                     Save a code climate compatible report to this file
        --list-checks                List available check names.

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

Installation on mega-linter Docker image