puppet-lint
puppet-lint copied to clipboard
vars without defaults are not recognized as declaration in defines
class a {
define b($var) {
...
}
}
creates the error '[variable_scope] top-scope variable being used without an explicit namespace' for line 2.
If it has a default value, all is fine:
class a {
define b($var=5) {
...
}
}
Adding the optional data type (https://docs.puppetlabs.com/puppet/latest/reference/lang_defined_types.html#defining-a-type) brings even more problems:
class a {
define b(Integer $var) {
...
}
}
-> Syntax error at 'Integer'; expected ')'
At the time of writing this, i recognized that define in class is not best practice (https://docs.puppetlabs.com/puppet/latest/reference/lang_defined_types.html#location) but that's another problem...
@arlt It would be nice for this to parse properly, which is something we can look at later. But I don't think it has high value, given the other style guide issues that are impacted, so it might be a while before anyone gets to it. PRs are welcome, of course.