Hash rocket syntax

> I agree for the most part that Ruby is a TMTOWTDI 1 language but I think
> most people would argue for some level of consistency (i.e.
> TIMTOWTDIBSCINABTE). A rather extreme example would be indentation. You can
> use whatever indentation in Ruby you want but you should probably try to
> use the same number of spaces in a project. As such, Rubocop tries to
> ensure consistency by allowing you to configure IndentationWidth cop.

Like I said, I'm mostly a Python guy and prefer a single way so you
don't have to convince me. Pushing that on a Ruby project may be
swimming against the current.

> Speaking of consistency: the Cop for HashSyntax can be configured to
> prevent mixed syntax. For example, it would prevent:
>
> { a: 1,
> :b => 2,
> c: 3,
> }
>
> Maybe we should at least enforce this?

One style per hash sounds totally reasonable to me.

··· On Wed, Aug 24, 2016 at 11:28:49AM -0400, David Davis wrote:

1 Perl - Wikipedia

David

On Wed, Aug 24, 2016 at 10:38 AM, Ewoud Kohl van Wijngaarden < > ewoud@kohlvanwijngaarden.nl> wrote:

On Wed, Aug 24, 2016 at 07:43:31AM -0400, David Davis wrote:

I would hope that all foreman and foreman-related projects would have
some
level of rubocop checking even if it’s just basic stuff like whitespace
(I
tried to do this for dynflow but closed my PR out after it had conflicts
and no activity).

Correct me if I’m wrong, but I think the core of the problem is that
some people prefer one and only one way of doing things. You see this in
the Zen of Python1:

There should be one-- and preferably only one --obvious way to do it.

Ruby is heavily influenced by Perl which does the opposite and to me
appears to support doing things in as many ways as possible.

This particular case (hash rockets) is allowing logically equal
statements to be written in two different ways. Here the two
philosophies collide causing conflict.

Beyond PEP 82 is a related talk that’s great. The speaker goes into
simple syntax issues vs real style. While the subject is PEP 8, it
applies to non-Python as well. The summary is embrace the language and
follow the conventions, but focus on the bigger API instead of the
details.

While personally I’m in the Python camp here (pick one way and stick
with it), I don’t feel like I submit sufficient code to have a say in
this. My feeling is that there’s no logical or quality difference and
Ruby allows both styles which is common among Ruby code. Therefor both
should be allowed.


You received this message because you are subscribed to the Google Groups
“foreman-dev” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups “foreman-dev” group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.