From fb021ce75930e8605fa10f58cef5c7e8261e5410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Pinson?= Date: Thu, 8 Jan 2015 13:43:30 +0100 Subject: [PATCH] Add doc to README --- README.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/README.md b/README.md index 72acd44..54ef7ac 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,40 @@ puppet-lint-empty_string-check [![Coverage Status](https://img.shields.io/coveralls/camptocamp/puppet-lint-empty_string-check.svg)](https://coveralls.io/r/camptocamp/puppet-lint-empty_string-check?branch=master) A puppet-lint plugin to check for variables assigned to the empty string. + + +## Checks + +### Variable assigned to the empty string + +The empty string is true in the future parser. `undef` should be used instead for a false value for strings. + + +#### What you have done + +```puppet +$foo = '' +``` + +#### What you should have done + +```puppet +$foo = undef +``` + +Note: There are valid cases of assigning a variable to the empty string. You should use [control comment](http://puppet-lint.com/controlcomments/) to disable checks for these. + + +#### Disabling the check + +To disable this check, you can add `--no-empty_string_assignment-check` to your puppet-lint command line. + +```shell +$ puppet-lint --no-empty_string_assignment-check path/to/file.pp +``` + +Alternatively, if you’re calling puppet-lint via the Rake task, you should insert the following line to your `Rakefile`. + +```ruby +PuppetLint.configuration.send('disable_empty_string_assignment') +```