[chef] Re: Re: Re: Re: Re: FC001, attributes as strings vs symbols


Chronological Thread 
  • From: John Dyer < >
  • To:
  • Subject: [chef] Re: Re: Re: Re: Re: FC001, attributes as strings vs symbols
  • Date: Tue, 16 Oct 2012 16:28:29 -0400

Actually, symbols do work w/ -'s, you just have to wrap them in quotes:

1.9.3-p194 :002 >  :"a-b"
 => :"a-b" 
1.9.3-p194 :003 > 

-John

On Tue, Oct 16, 2012 at 4:23 PM, Jesse Nelson < " target="_blank"> > wrote:
 symbols will break in ruby when using  -'s

[1] pry(main)> :a-b
NameError: undefined local variable or method `b' for main:Object
from (pry):1:in `__pry__'
[2] pry(main)> :a_b
=> :a_b

On Tue, Oct 16, 2012 at 1:16 PM, Paul Graydon < "> > wrote:
> Why add unnecessary constraints?
> What do we gain by stopping people from using -'s and other marks in
> attributes?
>
> It doesn't particularly affect me either way because I don't do it, but I'm
> not sure I see a particular benefit in restricting such practices.
>
> Paul
>
>
> On 10/16/2012 10:13 AM, Jesse Nelson wrote:
>>
>> I agree with the too noisy sentiment. I think that being consistent in
>> a cook is good, but I personally prefer symbols and enforcing a no -'s
>> in attrib names. Of course there are exceptions that you run into, and
>> you have to use strings. I find symbols easier on the eyes and
>> fingers.
>>
>> -
>> Jesse Nelson
>>
>>
>> On Tue, Oct 16, 2012 at 12:21 PM, Jeremy Voorhis < "> >
>> wrote:
>>>
>>> As a maintainer of in-house and 3rd party cookbooks for my organization,
>>> I
>>> find FC001 too noisy to be useful. We haven't yet modernized our repo to
>>> include every single cookbook as a self-contained repo, and in some cases
>>> find little benefit in doing so. New cookbooks follow FC001 and other
>>> best
>>> practices that didn't yet exist or weren't widely known at the time, so
>>> this
>>> rule is mostly ignored for now and we test for the desired outcome
>>> instead.
>>>
>>> Jeremy
>>>
>>>
>>> On Tue, Oct 16, 2012 at 11:28 AM, Joshua Timberman < "> >
>>> wrote:
>>>>
>>>> Ohai, Chefs!
>>>>
>>>> We want to hear from you: which way of using node attributes do you
>>>> prefer? Please take this single question survey:
>>>>
>>>>
>>>>
>>>> http://www.surveygizmo.com/s3/1059291/FC001-Use-strings-in-preference-to-symbols-to-access-node-attributes
>>>>
>>>> This is in response to a longer twitter discussion today on the subject.
>>>> The survey will be left open for awhile, letting as many people as
>>>> possible
>>>> answer. We *really* value this feedback.
>>>>
>>>> If you want an explanation of why this rule came about the way it did,
>>>> and
>>>> our rationale for preferring strings to symbols, see this issue in the
>>>> Foodcritic project:
>>>>
>>>> https://github.com/acrmp/foodcritic/issues/1
>>>>
>>>> If you're going to be at the Chef summit next week, I'm happy to discuss
>>>> this in greater detail, too :-).
>>>
>>>
>




Archive powered by MHonArc 2.6.16.

§