Duplicate class parameters check for puppet-lint

In versions of Puppet under 3.8.5 it’s been possible to have the same parameter name specified multiple times in a class definition without error. Although allowed it was a little misleading as only the last value assigned to that parameter was taken and so in the name of simplicity it was decided in the No error on duplicate parameters ticket that this behaviour should change and now return an error. Puppet itself will start to throw an error in 3.8.5 and above and now with this puppet-lint plugin you can hopefully catch those issues before you upgrade.

An exaggerated example of the previously valid, but awkward, behaviour can be found below -

    class file_resource(
      $duplicated = { 'a' => 1 },
      $duplicated = 'foo',
      $not_unique = 'bar',
      $not_unique = '2nd bar',
      $unique     = 'baz'
    ) {

      file { '/tmp/my-file':
        mode => '0600',
      }
    }

With this extension installed puppet-lint will return

found duplicate parameter 'duplicated' in class 'file_resource'
found duplicate parameter 'not_unique' in class 'file_resource'

Installing the plugin is done in the usual way -

    # add this line to your `Gemfile`
    gem 'puppet-lint-duplicate_class_parameters-check'

    # install the gem
    bundle install