Re: [Puppet Users] Style regarding param data types

2018-03-08 Thread Gabriel Filion
On 2018-03-07 01:23 PM, Henrik Lindberg wrote:
> On 07/03/18 17:17, Gabriel Filion wrote:
>> I'm wondering if there's a current trend around style with parameter
>> data types. I couldn't find a clear mention of how this is generally
>> done in the community in the coding style guide on puppet.com.
>>
>> Is it better to align param names to the right of all data types in
>> class/define definitions like this?
>>
>> class blah (
>>    String[1]  $input,
>>    Boolean    $manage_x = true,
>>    Enum['hello', 'there'] $text = 'hello',
>> }
>>
>> it seems to make things a lot clearer, however it can push arguments
>> quite far to the right side of the screen (and column count).

> Use type aliases if data type is long (having a name for the data type
> also makes it a lot easier to understand by a reader).

both Christopher and you are right about this one, aliases would help to
keep the width more manageable. I'll start playing around with those

> If you mix long and short names, an alternative to pushing all of them
> out is to cluster them at around 20 chars (if > 20 chars longer) let
> those be a group of their own.
> 
> class blah (
>    String[1] $input,
>    Boolean   $manage_x = true,
> 
>    Enum['hello', 'there', 'this', 'enum', 'long'] $text = 'hello',
>    Enum['also', 'fish', 'sea', 'boat', ]  $text2    = 'boat',
> }

ah that's an interesting suggestion. thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/d5e05625-e1d3-634c-ee48-6883ec4bb66e%40lelutin.ca.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: [Puppet Users] Style regarding param data types

2018-03-07 Thread Henrik Lindberg

On 07/03/18 17:17, Gabriel Filion wrote:

Hiya!

I'm wondering if there's a current trend around style with parameter
data types. I couldn't find a clear mention of how this is generally
done in the community in the coding style guide on puppet.com.

Is it better to align param names to the right of all data types in
class/define definitions like this?

class blah (
   String[1]  $input,
   Boolean$manage_x = true,
   Enum['hello', 'there'] $text = 'hello',
}

it seems to make things a lot clearer, however it can push arguments
quite far to the right side of the screen (and column count).

what are your experiences wrt this?



Use type aliases if data type is long (having a name for the data type 
also makes it a lot easier to understand by a reader).


If you mix long and short names, an alternative to pushing all of them 
out is to cluster them at around 20 chars (if > 20 chars longer) let 
those be a group of their own.


class blah (
   String[1] $input,
   Boolean   $manage_x = true,

   Enum['hello', 'there', 'this', 'enum', 'long'] $text = 'hello',
   Enum['also', 'fish', 'sea', 'boat', ]  $text2= 'boat',
}

- henrik

--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/p7pajf%248eb%241%40blaine.gmane.org.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Style regarding param data types

2018-03-07 Thread Christopher Wood
Somebody in the office here loves their complicated restrictive parameters. 
Those go in type aliases which cuts down a bit on the class parameter width.

https://puppet.com/docs/puppet/5.4/lang_type_aliases.html

On Wed, Mar 07, 2018 at 11:17:19AM -0500, Gabriel Filion wrote:
> Hiya!
> 
> I'm wondering if there's a current trend around style with parameter
> data types. I couldn't find a clear mention of how this is generally
> done in the community in the coding style guide on puppet.com.
> 
> Is it better to align param names to the right of all data types in
> class/define definitions like this?
> 
> class blah (
>   String[1]  $input,
>   Boolean$manage_x = true,
>   Enum['hello', 'there'] $text = 'hello',
> }
> 
> it seems to make things a lot clearer, however it can push arguments
> quite far to the right side of the screen (and column count).
> 
> what are your experiences wrt this?
> 
> Cheers
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/puppet-users/03de82e3-cc27-901d-e878-4ae8b83bebb5%40lelutin.ca.
> For more options, visit https://groups.google.com/d/optout.



-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/20180307181335.cs4rbm7xjauhik4t%40iniquitous.heresiarch.ca.
For more options, visit https://groups.google.com/d/optout.