-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore symbols ending with ?/! in Style/HashSyntax
#3149
Ignore symbols ending with ?/! in Style/HashSyntax
#3149
Conversation
8d6a563
to
68b4e10
Compare
As this is subjective it should be controlled via some config option. |
a80c1ff
to
8ef1c40
Compare
@bbatsov good point - done, and rebased |
8ef1c40
to
9a963d8
Compare
UseHashRocketsWithSymbolValues: false | ||
# Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style | ||
AllowHashRocketsWithSymbolValuesEndingInNonAlnum: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a mouthful. :-) Probably we can shorten it a bit.
I'm also not sure we should set it to true by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha, yeah definitely, I struggled with it! What about
AllowNonAlnumEndingSymbolHashRockets
AllowHashRocketsForPunctuationEndingSymbols
HashRocketsAllowedWithEndingPunctuation
PreferHashRocketsForNonAlnumEndingSymbols
contrasting with the current
AllowHashRocketsWithSymbolValuesEndingInNonAlnum
Ok, I'll rebase and make it false by default and for now use 4.
80ab698
to
1a55467
Compare
I'll repaste my reply to @bbatsov since it was hidden by my change: haha, yeah definitely, I struggled with it! What about
contrasting with the current
Ok, I'll rebase and make it false by default and for now use 4. |
@@ -19,6 +19,10 @@ | |||
* [#3140](https://github.com/bbatsov/rubocop/pull/3140): `Style/FrozenStringLiteralComment` works with file doesn't have any tokens. ([@pocke][]) | |||
* [#3154](https://github.com/bbatsov/rubocop/issues/3154): Fix handling of `()` in `Style/RedundantParentheses`. ([@lumeet][]) | |||
|
|||
### Changes | |||
|
|||
* [#3149](https://github.com/bbatsov/rubocop/pull/3149): Do not report symbols ending with ? or ! when using hash rocket syntax in `Style/HashSyntax`. ([@owst][]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changelog entry is a bit misleading after the last round of changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point @bbatsov - done
1a55467
to
ec350db
Compare
Perhaps a slightly personal taste, but I think
reads better/is clearer than
and therefore Rubocop shouldn't suggest changing the former to the latter. (Similarly for symbols ending in
!
e.g.{ :raise_on_invalid! => true }
.As an example, the original line I wrote that triggered this was:
I'd be interested to know what others think of this one.
Before submitting the PR make sure the following are checked:
master
(if not - rebase it)and description in grammatically correct, complete sentences.