I''m sure everyone has read and committed the Puppet Best Practice to memory by now (I joke). One of the things I''ve written in there deals with trailing commas, which I adopted from the way I used to do multiline in Perl, but I''ve noticed that most people don''t tend to do that in Puppet. Should I revise this or should we all start using the trailing commas? <https://reductivelabs.com/trac/puppet/wiki/PuppetBestPractice#syntax-and-formatting>
On May 11, 2007, at 11:27 AM, Digant C Kasundra wrote:> I''m sure everyone has read and committed the Puppet Best Practice > to memory > by now (I joke). One of the things I''ve written in there deals with > trailing commas, which I adopted from the way I used to do > multiline in > Perl, but I''ve noticed that most people don''t tend to do that in > Puppet. > Should I revise this or should we all start using the trailing commas? > > <https://reductivelabs.com/trac/puppet/wiki/ > PuppetBestPractice#syntax-and-formatting>It seems like a pretty minor point; is it even worth standardizing? -- I don''t want the world, I just want your half. --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
On Fri, May 11, 2007 at 11:55:49AM -0500, Luke Kanies wrote:> On May 11, 2007, at 11:27 AM, Digant C Kasundra wrote: > > > I''m sure everyone has read and committed the Puppet Best Practice > > to memory > > by now (I joke). One of the things I''ve written in there deals with > > trailing commas, which I adopted from the way I used to do > > multiline in > > Perl, but I''ve noticed that most people don''t tend to do that in > > Puppet. > > Should I revise this or should we all start using the trailing commas? > > > > <https://reductivelabs.com/trac/puppet/wiki/ > > PuppetBestPractice#syntax-and-formatting> > > It seems like a pretty minor point; is it even worth standardizing?I, for one, love trailing commas. It prevents a very common set of syntax errors. I have noticed, though, that not everywhere in puppet supports trailing commas. Adam -- HJK Solutions - We Launch Startups - http://www.hjksolutions.com Adam Jacob, Senior Partner T: (206) 508-4759 E: adam@hjksolutions.com
On May 11, 2007, at 12:02 PM, Adam Jacob wrote:> > I, for one, love trailing commas. It prevents a very common set of > syntax > errors.I love supporting them, but it doesn''t bother me when they''re absent (the commas themselves, not support for them).> I have noticed, though, that not everywhere in puppet supports > trailing > commas.Feel free to file a bug against any of these -- I usually fix them when I notice them, but I don''t always notice them. -- Think twice before you speak, and then you may be able to say something more insulting than if you spoke right out at once. - Evan Esar --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
--On May 11, 2007 11:55:49 AM -0500 Luke Kanies <luke@madstop.com> wrote:>> <https://reductivelabs.com/trac/puppet/wiki/ >> PuppetBestPractice#syntax-and-formatting> > > It seems like a pretty minor point; is it even worth standardizing? >Well, at my org, I''m a formatting enforcer and I usually fix commits that don''t match. So, we''ve standardized on it. I want to continue to call that best practice as long as it doesn''t bother anything. Everyone''s personal mileage may vary, though I hope people won''t be too annoyed if I fix it in their Wiki poster recipes. ;-) (Yes, I''m anal).
On May 11, 2007, at 1:30 PM, Digant C Kasundra wrote:> Well, at my org, I''m a formatting enforcer and I usually fix > commits that > don''t match. So, we''ve standardized on it. I want to continue to > call > that best practice as long as it doesn''t bother anything. Everyone''s > personal mileage may vary, though I hope people won''t be too > annoyed if I > fix it in their Wiki poster recipes. ;-) (Yes, I''m anal).How about we have a style guide, separate from the best practice document? That way it''s clear that this isn''t a functional issue, but is still something that the community agrees on. -- I''m seventeen and I''m crazy. My uncle says the two always go together. When people ask your age, he said, always say seventeen and insane. -- Ray Bradbury --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
* Adam Jacob <adam@hjksolutions.com> [070511 10:02]:> On Fri, May 11, 2007 at 11:55:49AM -0500, Luke Kanies wrote: > > On May 11, 2007, at 11:27 AM, Digant C Kasundra wrote: > > > > > I''m sure everyone has read and committed the Puppet Best Practice > > > to memory > > > by now (I joke). One of the things I''ve written in there deals with > > > trailing commas, which I adopted from the way I used to do > > > multiline in > > > Perl, but I''ve noticed that most people don''t tend to do that in > > > Puppet. > > > Should I revise this or should we all start using the trailing commas? > > > > > > <https://reductivelabs.com/trac/puppet/wiki/ > > > PuppetBestPractice#syntax-and-formatting> > > > > It seems like a pretty minor point; is it even worth standardizing? > > I, for one, love trailing commas. It prevents a very common set of syntax > errors.Could you give some examples of these common errors? I personally find the trailing commas weird, but I''d love to know why I should standardize on them. Micah
--On Friday, May 11, 2007 15:40:59 -0600 Micah Anderson <micah@riseup.net> wrote:>> I, for one, love trailing commas. It prevents a very common set of syntax >> errors. > > Could you give some examples of these common errors? I personally find > the trailing commas weird, but I''d love to know why I should standardizeYou can add a new element to the list without ever having to remember to add an additional comma. Also, you can reorder items in the list without having to shuffle around commas. Minor things, true, but it is the practice I learned with Perl and plan to continue it in Ruby (and Puppet).
On May 11, 2007, at 4:48 PM, Digant C Kasundra wrote:> You can add a new element to the list without ever having to > remember to > add an additional comma. Also, you can reorder items in the list > without > having to shuffle around commas. > > Minor things, true, but it is the practice I learned with Perl and > plan to > continue it in Ruby (and Puppet).You will have trouble doing so in Ruby, as it seems not to support trailing commas, in any place I''ve seen. -- I don''t know the key to success, but the key to failure is trying to please everybody. -- Bill Cosby --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
On Fri, May 11, 2007 at 04:55:20PM -0500, Luke Kanies wrote:> On May 11, 2007, at 4:48 PM, Digant C Kasundra wrote: > > You can add a new element to the list without ever having to > > remember to > > add an additional comma. Also, you can reorder items in the list > > without > > having to shuffle around commas. > > > > Minor things, true, but it is the practice I learned with Perl and > > plan to > > continue it in Ruby (and Puppet). > > You will have trouble doing so in Ruby, as it seems not to support > trailing commas, in any place I''ve seen.It kills me every time, too. :) Adam -- HJK Solutions - We Launch Startups - http://www.hjksolutions.com Adam Jacob, Senior Partner T: (206) 508-4759 E: adam@hjksolutions.com
On Fri, May 11, 2007 at 04:55:20PM -0500, Luke Kanies wrote:> You will have trouble doing so in Ruby, as it seems not to support > trailing commas, in any place I''ve seen.lizzy:~% irb irb(main):001:0> a = [1, 2, 3,] => [1, 2, 3] irb(main):002:0> h = {''a'' => 1, :b => 2,} => {"a"=>1, :b=>2} irb(main):003:0> What am I missing? -- Jos Backus jos at catnook.com
On 5/14/07, Jos Backus <jos@catnook.com> wrote:> > On Fri, May 11, 2007 at 04:55:20PM -0500, Luke Kanies wrote: > > You will have trouble doing so in Ruby, as it seems not to support > > trailing commas, in any place I''ve seen. > > lizzy:~% irb > irb(main):001:0> a = [1, 2, 3,] > => [1, 2, 3] > irb(main):002:0> h = {''a'' => 1, :b => 2,} > => {"a"=>1, :b=>2} > irb(main):003:0> > > What am I missing?>> h = Net::HTTP.new("localhost", 3000,)SyntaxError: compile error (irb):6: syntax error, unexpected '')'' from (irb):6>> h = Net::HTTP.new("localhost", 3000)=> #<Net::HTTP localhost:3000 open=false> Only works in a hash/array handling I think. -Blake _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
On Mon, May 14, 2007 at 06:17:35PM -0700, Blake B wrote:> On 5/14/07, Jos Backus <jos@catnook.com> wrote: > > > > On Fri, May 11, 2007 at 04:55:20PM -0500, Luke Kanies wrote: > > > You will have trouble doing so in Ruby, as it seems not to support > > > trailing commas, in any place I''ve seen. > > > > lizzy:~% irb > > irb(main):001:0> a = [1, 2, 3,] > > => [1, 2, 3] > > irb(main):002:0> h = {''a'' => 1, :b => 2,} > > => {"a"=>1, :b=>2} > > irb(main):003:0> > > > > What am I missing? > > > >> h = Net::HTTP.new("localhost", 3000,) > SyntaxError: compile error > (irb):6: syntax error, unexpected '')'' > from (irb):6 > >> h = Net::HTTP.new("localhost", 3000) > => #<Net::HTTP localhost:3000 open=false> > > Only works in a hash/array handling I think.Right. Ruby does indeed not support this in sub argument lists (unlike Perl). Not necessarily a bad thing imo. ObPuppet: we ramping up our deployment this week to around 200 hosts. So far everything has been going smoothly. -- Jos Backus jos at catnook.com
Digant C Kasundra wrote:> Should I revise this or should we all start using the trailing commas?I also like trailing commas for the reasons others outlined. But what about in situations of multiple resources of the same type? What do folks consider a good convention for those? It seems the choices are: #1: Keep each resource separate, thus keeping to the trailing commas convention, like so: file { "/etc/passwd": owner => root, mode => 644, } file { "/etc/shadow": owner => root, mode => 440, } =OR = #2: Just use semicolons for those occasions, like so: file { "/etc/passwd": owner => root, mode => 644; "/etc/shadow": owner => root, mode => 440; } In some ways, it ties into related questions of: * indentation * one-attribute-per-line or have one long line of comma-separated attributes? * whether to keep resource type & name on the same line (as in #1) or to split them (as in #2) It''s great that puppet supports any permutation of the above questions, but, like Digant and others on the list, I like the idea of "best practices" / standards / conventions. johnn
--On Tuesday, May 15, 2007 15:23:50 -0400 Johnny Tan <jtan@limewire.com> wrote:> ># 1: Keep each resource separate, thus keeping to the > trailing commas convention, like so: > > file { "/etc/passwd": > owner => root, > mode => 644, > } > > file { "/etc/shadow": > owner => root, > mode => 440, > } >At my org, we would use one File block if all the files were related or separate blocks for logical groups of files (with a comment line above). Always keeping files separate wouln''t be that clean (unless you comment each one) and keeping them all mashed in one sucks too if you want to have notes on why those files are there in the first place, so...> => OR > => ># 2: Just use semicolons for those occasions, like so: > > file { > "/etc/passwd": > owner => root, > mode => 644; > "/etc/shadow": > owner => root, > mode => 440; > }I think this makes the most sense to me. I''d recommend the text be "When declaring multiple resources in a type block, the last parameter-value pair of each resource should end with semicolon."> In some ways, it ties into related questions of: > * indentation > * one-attribute-per-line or have one long line of > comma-separated attributes? > * whether to keep resource type & name on the same line (as > in #1) or to split them (as in #2) > > It''s great that puppet supports any permutation of the above > questions, but, like Digant and others on the list, I like > the idea of "best practices" / standards / conventions.Especially when we start making distributable modules -- a standard is nice.