Closed foobear closed 2 years ago
This is super useful in JS, and I think we only find it weird because it looks a bit unaesthetic with the colon. I believe we'll get used to that.
Having said that, I'm not super invested. :smile:
I agree with @kratob that it is useful and that we probably will get used to it, even though it's syntactically not pretty.
For the time being it would create a lot of noise on projects which upgrade to Ruby 3.1. Those projects can still change that setting in their .rubocop.yml
(as I've done) which is why I was unsure what we should pick as a default now. :smile:
I think our default should be what we want in new projects, not what is most compatible for existing ones.
True. I did not express myself clearly. I'm trying to learn what the desired default is. :grimacing:
So far, votes are leaning towards allowing both styles -- which sounds reasonable if we want to adopt it step by step even in new code bases.
I'm not at all against changing to always
later.
Based on the current votes, EnforcedShorthandSyntax
has been changed to either
in https://github.com/makandra/makandra-rubocop/commit/063a4be834e3f1bcf82269f29103202a9092dc6a and released with version 9.1.0.
Ruby 3.1 allows omitting hash values, if the hash key is the same as its value's variable name (
{ foo: foo }
→{ foo: }
). Rubocop's default is to enforce that style, if possible: https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/HashSyntaxI'm still uncomfortable with the new syntax and I'm not sure we want to adopt it as a default.
My suggestion is to allow both styles for the time being:
Vote: :+1: change to
either
:-1: keep defaultalways
:confused: change tonever