Skip to content
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

Stop converting to 19 hash syntax when invalid #1765

Merged
merged 2 commits into from
Apr 16, 2015

Conversation

crimsonknave
Copy link

Version 0.30.0 is now telling me to convert to 19 hash syntax in cases when it should not. There are a few cases where you can have a valid symbol that does not convert to valid 19 hash syntax. According to this comment the regex is pretty straight forward.

Most of the time this would not come up, but I've seen it while setting the [] method in a test double.

failure.rb:2:3: C: Use the new Ruby 1.9 hash syntax.
  :[] => 'asdf'
  ^^^^^^

As requested in the contributing guidelines:

rubocop -V
0.30.0 (using Parser 2.2.0.3, running on ruby 2.0.0 x86_64-linux)

@crimsonknave
Copy link
Author

Sorry, I didn't realize there was a test for the changelog (which I added to after I ran the tests). I'm unclear what the test is actually testing and how I can fix it.

@agargiulo
Copy link
Contributor

Figured out what you forgot.

[@username]: https://github.com/username

at the end of the CHANGELOG.md file.

@@ -6,6 +6,7 @@

### New features

* [#1765](https://github.com/bbatsov/rubocop/pull/1765): Update 19 hash to stop triggering when the symbol is not valid in the 19 hash syntax. ([@crimsonknave][])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the changelog for the old version (and this is definitely not a new feature).

@crimsonknave
Copy link
Author

I'm not sure why the 1.9.3 tests started printing things after I merged (which appears to be the cause of the failure). I'm not able to reproduce it locally.

@bbatsov how does the less than, greater than filtering look to you? The names are a bit long at the moment, but I felt ruby_lte was a little too dense.

@tfausak
Copy link

tfausak commented Apr 9, 2015

👍 I would like this patch. I have encountered offenses like this:

example.rb:1:3: C: Use the new Ruby 1.9 hash syntax.
{ :@key => :value }
  ^^^^^^^^

@bbatsov
Copy link
Collaborator

bbatsov commented Apr 12, 2015

The names look ok. The commits should be squashed to just two once you fix the failing build.

@crimsonknave crimsonknave force-pushed the 19_hash_syntax_fix branch 3 times, most recently from 86e7c16 to 93d4c12 Compare April 13, 2015 17:25
@bbatsov
Copy link
Collaborator

bbatsov commented Apr 14, 2015

@crimsonknave Rebase on top of the current master. The second commit message's title should be in present simple tense.

@crimsonknave crimsonknave force-pushed the 19_hash_syntax_fix branch 2 times, most recently from a1a4817 to b7721f7 Compare April 14, 2015 20:51
bbatsov added a commit that referenced this pull request Apr 16, 2015
Stop converting to 19 hash syntax when invalid
@bbatsov bbatsov merged commit 10a9ecf into rubocop:master Apr 16, 2015
@bbatsov
Copy link
Collaborator

bbatsov commented Apr 16, 2015

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants