puppetlabs/puppetlabs_spec_helper — pull request #73 by dcarley (2014-07-28 08:57:40+00:00)
Title: Replace syntax checks with puppet-syntax

Use an external gem to check the syntax of Puppet manifests and templates
(and hiera YAML files, but these won't exist in most modules).

This gem has some additional features from the original checks:

- Configurable exclude paths.
- Catches logged warnings from Puppet and Ruby.
- Outputs any errors encountered.
- Test coverage (in addition to the parser face).

I wasn't previously aware that these checks were in puppetlabs_spec_helper
until we got a bug report in gds-operations/puppet-syntax#13 to say that
`PuppetSyntax.exclude_paths` wasn't working correctly.

It turns out that Rake was running the :syntax tasks from both projects and
that psh, where you can't configure exclude paths and no error message is
printed, was returning a non-zero exit code.

The :syntax task has been replaced by a require for puppet-syntax and the
exclude paths setup to match puppet-lint. I haven't wrapped this in a task
like :lint because it behaves non-deterministically; if the task from
puppet-syntax is run before this one then `exclude_paths` won't be set
correctly.

The :validate task still checks Ruby files and then calls :syntax in place
of the shell commands it previously ran. There's quite a lot of overlap
between :validate and :syntax. In the future it might be worth adding Ruby
syntax checks for Puppet plugins to puppet-syntax and deprecating the
:validate task.

---

Also enabled support for the `FUTURE_PARSER` environment variable.

---

/cc @dalen @cmurphy who originally added these checks.
/cc @treydock who reported the error on puppet-syntax.