Skip to content

Bad detection of optional parameters out of order #122

Closed
@tiandrey

Description

@tiandrey

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions