-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Change multiple value parameter recommendation #177
base: master
Are you sure you want to change the base?
Conversation
340b63b
to
7e4662d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with this recommendation. I never liked the x or list of x
convention that appears to be common in Ruby. The code (either Puppet or its templates) also becomes easier when you only allow arrays.
I'm not so sure about the 80 column change. With markdown I'm also fine with long lines, but I'd say at least 100 characters is a lot more flexible, especially when you have URLs in there.
@ekohl It's often to preserve backwards compatibility when adding data types to an existing module. At the very least we need to warn about using flatten with more complicated examples. |
I'm fine with whatever, I just picked 80 chars because parts of the document was already wrapped to 80 chars. |
Actually I like the existing recommendation as its easier for Hiera users, though I don't like that fact that a parameter can be two (or even more oO) data types.
vs.
Regarding the column length change: I think 80 is way to short, 200 might be better. Personally I prefer to ignore this linting warning. However we decide, can we please do that change in a separate PR? It's basically impossible to read the current git diff. |
That's a fair distinction. |
@runejuhl Ups, missed that 🙈 Sorry! |
I wouldn't see this recommendation as changing that; that's still possible and likely the easiest way to add types to old modules. I still think the recommendation is worthy, though. As long as these guidelines aren't strictly enforced anyway I don't see a problem in changing the recommendation, and I don't imagine the guidelines will be strictly enforced anytime soon... (which I personally wouldn't want anyway) |
@binford2k what do you think about this / is there an official recommendation? |
My preference is for one datatype, not a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know that there's an actual recommendation one way or the other. I personally like the one or many
ability, but I dislike having to do the casting myself. Since Puppet does not have a way to automatically cast the parameter, and since this is a recommendation, not a requirement then I'm ok with it.
I do suggest simplifying the wording that I noted though.
is `Array[String[1]]` instead of `Variant[String[1],Array[String[1]]]`. | ||
|
||
Note that previously the recommendation was to have a `Variant` type, but this | ||
causes problems with values that contain Arrays, e.g. `Variant[Tuple[String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo, the complexity of this example takes away from its readability. I think I'd word it more like this and leave the rest as a thought exercise for the reader if they care to do so.
Note that previously the recommendation was to use a
Variant
type, but this added excessive complexity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...forgot about this one. I've updated the PR with your text.
7e4662d
to
4adff96
Compare
This changes the recommendation for how to handle multiple value parameters to the following:
I know this is a personal preference, and I wouldn't be surprised if I'm a small minority, but I'm open to any arguments for/against this.