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.
>
> 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?

This is one of cops that make to me.
+1 to forbid mixed syntax but allow both styles otherwise.

··· On 08/24/2016 05:28 PM, David Davis wrote:

[1] https://en.wikipedia.org/wiki/There's_more_than_one_way_to_do_it

David

On Wed, Aug 24, 2016 at 10:38 AM, Ewoud Kohl van Wijngaarden > <ewoud@kohlvanwijngaarden.nl mailto: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 Python[1]:

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 8[2] 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.

[1]: https://www.python.org/dev/peps/pep-0020/
<https://www.python.org/dev/peps/pep-0020/>
[2]: https://www.youtube.com/watch?v=wf-BqAjZb8M
<https://www.youtube.com/watch?v=wf-BqAjZb8M>

--
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
<mailto:foreman-dev%2Bunsubscribe@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout
<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
mailto:foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

https://github.com/bbatsov/ruby-style-guide which is the closest thing
to a "ruby community style guide" we have, gave birth to Rubocop, it is
meant to be precisely a way to enforce the "ruby community style guide"

··· On 08/24, Marek Hulán wrote: > > Also, I am not a huge fan of Github’s style guide since it has some weird > > things like using TomDoc: https://github.com/styleguide/ruby/documentation > > That's fine, we never required this styleguide in our PRs. I'm just saying the > fact that there is a cop that (even though can be configured either way) > doesn't mean all ruby devs enable it. Rubocop is not "ruby community style > guide".


Daniel Lobato Garcia

@dLobatog
blog.daniellobato.me
daniellobato.me

GPG: http://keys.gnupg.net/pks/lookup?op=get&search=0x7A92D6DD38D6DE30
Keybase: https://keybase.io/elobato