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

case statements over enums should not require/allow a default statement #865

Open
kasimon opened this issue Jul 8, 2019 · 2 comments
Open
Labels

Comments

@kasimon
Copy link

kasimon commented Jul 8, 2019

Given a variable defined like

Enum['up','down'] $elevator_direction

a case statement over this variable should not require or even allow a default field

case $elevator_direction {
    'up'    => { ... do up stuff ... }
    'down'  => { ... do down stuff ...
    default => { ... will never happen ... }
}

The same exception could be made when using case with a boolean variable.

@ardrigh
Copy link

ardrigh commented Oct 8, 2019

Surely this is answered by the README?

Puppet Lint tests Puppet code against the recommended Puppet language style guide. Puppet Lint validates only code style; it does not validate syntax. To test syntax, use Puppet's puppet parser validate command.

puppet-lint doesn't understand data typing to my knowledge. I have run into similar questions before about how to test data typing.

@rodjek
Copy link
Owner

rodjek commented Feb 8, 2020

That's correct, puppet-lint doesn't currently have any knowledge of the data type being stored in the variable. It's possible that it could be added in a limited form in the future though it would still be limited to variables defined within the current manifest.

@rodjek rodjek added the feature label Feb 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants