Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namevars detected as optional parameters #633

Closed
ntnn opened this issue Feb 18, 2017 · 2 comments
Closed

Namevars detected as optional parameters #633

ntnn opened this issue Feb 18, 2017 · 2 comments

Comments

@ntnn
Copy link

ntnn commented Feb 18, 2017

Example:

define example (
    String $somevar = $name,
    String $anothervar,
) {
    notify { $somevar: }
}

example { 'name':
  anothervar => 'something',
}

command:

puppet-lint --no-autoloader_layout-check --no-strict_indent-check --no-documentation-check example.pp

Expected output: none
Actual output:

WARNING: optional parameter listed before required parameter on line 3

I'd argue that a namevar for defined types are still required parameters, since the title of a resource is required, hence the parameter is still required, even though it has a default, which is in turn a required parameter.

@binford2k
Copy link
Collaborator

Until this is allowed by the style guide, we cannot make this change. There is a discussion ticket open puppetlabs/puppet-docs#725

@rodjek
Copy link
Owner

rodjek commented Mar 22, 2017

The unanimous decision of the discussion in puppetlabs/puppet-docs#725 was that although you're defaulting your parameter to a required value, the parameter itself is still optional as it's not necessary for someone to specify a value for it.

Given that, the check output is correct in this case and I'm going to close this issue.

@rodjek rodjek closed this as completed Mar 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants