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

Bad detection of optional parameters out of order #122

Closed
tiandrey opened this issue May 4, 2023 · 0 comments
Closed

Bad detection of optional parameters out of order #122

tiandrey opened this issue May 4, 2023 · 0 comments
Labels
bug Something isn't working community

Comments

@tiandrey
Copy link

tiandrey commented May 4, 2023

Describe the Bug

Consider the following manifests:

class test (
  String $s = '',
  Custom::Type $t,
) {
}
class test (
  String $s = '',
  Optional[Boolean] $t,
) {
}

Currently puppet-lint does not recognize it as bad, because

  1. It considers parameters of type Optional[something] optional - this never was the definition of optional parameters in the Puppet docs. If you read docs thoroughly, you'll find out that optional parameters are no more than parameters with default values, whereas Optional type just allows using undef as variable value (and does not make it default value for parameter automatically!).
  2. It does not parse custom types as variable types, and effectively it just ignores such params.

One more thing - anchor in doc URL changed a bit (from #display-order-of-parameters to #params-display-order).

I've prepared a fix for this misbehavior.

@tiandrey tiandrey added the bug Something isn't working label May 4, 2023
tiandrey pushed a commit to tiandrey/puppet-lint that referenced this issue May 4, 2023
tiandrey added a commit to tiandrey/puppet-lint that referenced this issue May 4, 2023
tiandrey added a commit to tiandrey/puppet-lint that referenced this issue May 5, 2023
@chelnak chelnak closed this as completed in ddee8cc Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working community
Projects
None yet
Development

No branches or pull requests

2 participants