{"id":13533054,"url":"https://github.com/rodjek/puppet-lint","last_synced_at":"2025-10-20T02:59:50.716Z","repository":{"id":47699333,"uuid":"2211397","full_name":"rodjek/puppet-lint","owner":"rodjek","description":"Check that your Puppet manifests conform to the style guide","archived":false,"fork":false,"pushed_at":"2023-08-29T13:24:08.000Z","size":2018,"stargazers_count":816,"open_issues_count":57,"forks_count":208,"subscribers_count":45,"default_branch":"master","last_synced_at":"2025-04-13T03:06:24.780Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rodjek.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2011-08-15T18:38:07.000Z","updated_at":"2025-04-10T18:34:51.000Z","dependencies_parsed_at":"2024-01-15T09:57:48.743Z","dependency_job_id":"aa089775-a1ec-4f9e-8278-e5ae6c888ef1","html_url":"https://github.com/rodjek/puppet-lint","commit_stats":{"total_commits":1055,"total_committers":88,"mean_commits":"11.988636363636363","dds":"0.28625592417061607","last_synced_commit":"9608bd01aac81fda8ddf951f68119fc81288ba77"},"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodjek%2Fpuppet-lint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodjek%2Fpuppet-lint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodjek%2Fpuppet-lint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodjek%2Fpuppet-lint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rodjek","download_url":"https://codeload.github.com/rodjek/puppet-lint/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248657912,"owners_count":21140846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T07:01:16.161Z","updated_at":"2025-10-20T02:59:45.667Z","avatar_url":"https://github.com/rodjek.png","language":"Ruby","funding_links":[],"categories":["Linters","Ruby","Build Tools","Awesome Ruby CLIs"],"sub_categories":["Puppet","Linting"],"readme":"# Puppet Lint\n\n--------\n\nNote that as of release 2.5.0, this project is being maintained in the main [`puppetlabs namespace`](https://github.com/puppetlabs/puppet-lint).\n\n--------\n\n\n[![Build\nStatus](https://secure.travis-ci.org/rodjek/puppet-lint.png)](http://travis-ci.org/rodjek/puppet-lint)\n[![Inline docs](http://inch-ci.org/github/rodjek/puppet-lint.png?branch=master)](http://inch-ci.org/github/rodjek/puppet-lint)\n\nPuppet Lint tests Puppet code against the recommended [Puppet language style\nguide](http://puppet.com/docs/puppet/latest/style_guide.html). Puppet Lint validates only code style; it does not validate syntax. To test syntax, use Puppet's `puppet parser validate` command.\n\n## Compatibility warning\n\nPuppet Lint version 2 is the last planned version with support for Puppet 3 and Ruby 1.8.7. The next major version of Puppet Lint will drop support for these versions.\n\n## Installation\n\nInstall the Puppet Lint gem by running:\n\n```\ngem install puppet-lint\n```\n\n## Testing with Puppet Lint\n\nTo test manifests for correct Puppet style, run the `puppet-lint` command with the path to the files you want to test.\n\nFor example:\n\n```\npuppet-lint ~/modules/puppetlabs-java/manifests/init.pp\n```\n\n```\npuppet-lint ~/modules/puppetlabs-mysql/manifests\n```\n\n### Fix issues automatically\n\nTo instruct Lint to automatically fix any issues that it detects, use the `--fix` flag:\n\n```\npuppet-lint --fix /modules\n```\n\n### Modify which checks to run\n\nPuppet Lint options allow you to modify which checks to run. You can disable any of the checks temporarily or permanently, or you can limit testing to specific checks.\n\n#### List all available checks\n\nTo list all available checks along with basic usage documentation, use the `--list-checks` option.\n\n#### Run specific checks\n\nTo run only specific checks, use the `--only-checks` option, with a comma-separated list of arguments specifying which checks to make:\n\n```\npuppet-lint --only-checks trailing_whitespace,140chars modules/\n```\n\nTo avoid enormous patch sets when using the `--fix` flag, use the `--only-checks` option to limit which checks Puppet Lint makes:\n\n```\npuppet-lint --only-checks trailing_whitespace --fix modules/\n```\n\n### Disable Lint checks\n\nYou can disable specific Lint checks on the command line, disable them permanently with a configuration file, or disable them with control comments within your Puppet code.\n\n#### Disable checks on the command line\n\nTo disable any of the checks when running the `puppet-lint` command, add a `--no-\u003ccheck_name\u003e-check` flag to the command. For example, to skip the 140-character check, run:\n\n```\npuppet-lint --no-140chars-check modules/\n```\n\n#### Disable checks within Puppet code\n\nTo disable checks from within your Puppet code itself, use [control comments](http://puppet-lint.com/controlcomments/). Disable checks on either a per-line or per-block basis using `#lint:ignore:\u003ccheck_name\u003e`.\n\nFor example:\n\n```puppet\nclass foo {\n  $bar = 'bar'\n\n  # This ignores the double_quoted_strings check over multiple lines\n\n  # lint:ignore:double_quoted_strings\n  $baz = \"baz\"\n  $gronk = \"gronk\"\n  # lint:endignore\n\n  # This ignores the 140chars check on a single line\n\n  $this_line_has_a_really_long_name_and_value_that_is_much_longer_than_the_style_guide_recommends = \"I mean, a really, really long line like you can't believe\" # lint:ignore:140chars\n}\n```\n\n## Configuration file\n\nEach time Puppet Lint starts up, it loads configuration from three files in order:\n\n1. `/etc/puppet-lint.rc`\n1. `~/.puppet-lint.rc`\n1. `.puppet-lint.rc`\n\nThis means that a flag in the local `.puppet-lint.rc` will take precedence over a flag in the global `/etc/puppet-lint.rc`, for example. Flags specified on the command line take final precedence and override all config file options.\n\nAny flag that can be specified on the command line can also be specified in the configuration file. For example, to always skip the hard tab character check, create `~/.puppet-lint.rc` and include the line:\n\n```\n--no-hard_tabs-check\n```\n\nOr to specify a whitelist of allowed checks, include a line like:\n\n```\n--only-checks=trailing_whitespace,hard_tabs,duplicate_params,double_quoted_strings,unquoted_file_mode,only_variable_string,variables_not_enclosed,single_quote_string_with_variables,variable_contains_dash,ensure_not_symlink_target,unquoted_resource_title,relative_classname_inclusion,file_mode,resource_reference_without_title_capital,leading_zero,arrow_alignment,variable_is_lowercase,ensure_first_param,resource_reference_without_whitespace,file_ensure,trailing_comma,leading_zero\n```\n\nPlease note that there is an important difference between reading options from the command line and reading options from a configuration file: In the former case the shell interprets one level of quotes. That does not happen in the latter case. So, it would make sense to quote some configuration values on the command line, like so:\n\n```\n$ puppet-lint --ignore-paths 'modules/stdlib/*' modules/\n```\n\nWhen reading from a configuration file those quotes would be passed on to the option parser -- probably not giving the expected result. Instead the line should read\n\n```\n--ignore-paths=modules/stdlib/*\n```\n\n## Testing with Puppet Lint as a Rake task\n\nTo test your entire Puppet manifest directory, add `require 'puppet-lint/tasks/puppet-lint'` to your Rakefile and then run:\n\n```\nrake lint\n```\n\nTo modify the default behaviour of the Rake task, modify the Puppet Lint configuration by defining the task yourself. For example:\n\n```ruby\nPuppetLint::RakeTask.new :lint do |config|\n  # Pattern of files to check, defaults to `**/*.pp`\n  config.pattern = 'modules'\n\n  # Pattern of files to ignore\n  config.ignore_paths = ['modules/apt', 'modules/stdlib']\n\n  # List of checks to disable\n  config.disable_checks = ['documentation', '140chars']\n\n  # Should puppet-lint prefix it's output with the file being checked,\n  # defaults to true\n  config.with_filename = false\n\n  # Should the task fail if there were any warnings, defaults to false\n  config.fail_on_warnings = true\n\n  # Format string for puppet-lint's output (see the puppet-lint help output\n  # for details\n  config.log_format = '%{filename} - %{message}'\n\n  # Print out the context for the problem, defaults to false\n  config.with_context = true\n\n  # Enable automatic fixing of problems, defaults to false\n  config.fix = true\n\n  # Show ignored problems in the output, defaults to false\n  config.show_ignored = true\n\n  # Compare module layout relative to the module root\n  config.relative = true\nend\n```\n\n### Disable checks in the Lint Rake task\n\nYou can also disable checks when running Puppet Lint through the supplied Rake task by modifying your `Rakefile`.\n\n* To disable a check, add the following line after the `require` statement in your `Rakefile`:\n\n  ```ruby\n  PuppetLint.configuration.send(\"disable_\u003ccheck name\u003e\")\n  ```\n\n  For example, to disable the 140-character check, add:\n\n  ```ruby\n  PuppetLint.configuration.send(\"disable_140chars\")\n  ```\n\n* To set the Lint Rake task to ignore certain paths:\n\n  ```ruby\n  PuppetLint.configuration.ignore_paths = [\"vendor/**/*.pp\"]\n  ```\n\n* To set a pattern of files that Lint should check:\n\n  ```ruby\n  # Defaults to `**/*.pp`\n  PuppetLint.configuration.pattern = \"modules\"\n  ```\n\n## Testing with Puppet Lint as a GitHub Action\n\nThere is a GitHub Actions action available to get linter feedback in workflows:\n\n* [puppet-lint-action](https://github.com/marketplace/actions/puppet-lint-action)\n\n## Options\n\nSee `puppet-lint --help` for a full list of command line options and checks.\n\n## Checks\n\nFor a complete list of checks, and how to resolve errors on each check, see the Puppet Lint [checks](http://puppet-lint.com/checks/) page.\n\n### Spacing, Indentation, and Whitespace\n\n* Must use two-space soft tabs.\n* Must not use literal tab characters.\n* Must not contain trailing white space.\n* Should not exceed an 140-character line width.\n  * An exception has been made for `source =\u003e 'puppet://...'` lines as splitting these over multiple lines decreases the readability of the manifests.\n* Should align arrows (`=\u003e`) within blocks of attributes.\n\n### Quoting\n\n* All strings that do not contain variables should be enclosed in single quotes.\n  * An exception has been made for double-quoted strings containing \\n or \\t.\n* All strings that contain variables must be enclosed in double quotes.\n* All variables should be enclosed in braces when interpolated in a string.\n* Variables standing by themselves should not be quoted.\n\n### Capitalization\n\n* All variables should be in lowercase.\n\n### Resources\n\n* All resource titles should be quoted.\n  * An exception has been made for resource titles that consist of only a variable standing by itself.\n* If a resource declaration includes an `ensure` attribute, it should be the first attribute specified.\n* Symbolic links should be declared by using an ensure value of `link` and explicitly specifying a value for the `target` attribute.\n* File modes should be represented as a 4-digit string enclosed in single quotes or use symbolic file modes.\n\n### Conditionals\n\n* You should not intermingle conditionals inside resource declarations (that is, selectors inside resources).\n* Case statements should have a default case.\n\n### Classes\n\n* Relationship declarations with the chaining syntax should only be used in the 'left to right' direction.\n* Classes should not be defined inside a class.\n* Defines should not be defined inside a class.\n* Classes should not inherit between namespaces.\n* Required parameters in class \u0026 defined type definitions should be listed before optional parameters.\n* When using top-scope variables, including facts, Puppet modules should explicitly specify the empty namespace.\n* Chaining operators should appear on the same line as the right hand operand.\n\n## Reporting bugs or incorrect results\n\nIf you find a bug in Puppet Lint or its results, please create an issue in the\n[repo issues tracker](https://github.com/rodjek/puppet-lint/issues/). Bonus\npoints will be awarded if you also include a patch that fixes the issue.\n\n## Thank you\n\nMany thanks to the following people for contributing to puppet-lint\n\n* James Turnbull (@kartar)\n* Jan Vansteenkiste (@vStone)\n* Julian Simpson (@simpsonjulian)\n* S. Zachariah Sprackett (@zsprackett)\n\nAs well as the many people who have reported the issues they've had!\n\n## License\n\nCopyright (c) 2011-2016 Tim Sharpe\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frodjek%2Fpuppet-lint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frodjek%2Fpuppet-lint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frodjek%2Fpuppet-lint/lists"}