Rubocop: Problems when using Ruby 2.3's safe navigation operator

Created on 29 Dec 2015  路  11Comments  路  Source: rubocop-hq/rubocop

By adding a &., aka. safe navigation operator (released in Ruby 2.3.0), it causes the following error:

<file>:<line>:<column>: E: unexpected token tDOT

Most helpful comment

For anybody wondering... you need to set the following to add squiggly heredoc support:

#.rubocop.yml
AllCops:
  TargetRubyVersion: 2.3

# If you are using the --enable-frozen-string-literal flag
# You might also want to add this:
Style/FrozenStringLiteralComment:
  Enabled: false

All 11 comments

Yeah, that's normal. We haven't release a version of RuboCop that supports Ruby 2.3 yet. If you build the gem from the master branch this will work. Hopefully a new stable release will land early next week.

Awesome, thanks!

@bbatsov You still planning to release this week? I'm hoping to see this on Hound CI soon. :)

Thanks!

This release is blocked by the unfinished parser support for Ruby 2.3. I'll wait a bit more, if there aren't signs that parser 2.3.0 will be released we'll go live with what we have.

It doesn't look like any squiggly heredoc progress has been made on parser. What should we do here?

This is in @whitequark's hands. Someone can probably lend him a hand with this.

I'll try to get this out today...

I'm working on some other parser-related stuff (soon to be revealed), otherwise I'd do it.

This feature has an impressive amount of moving parts for something so seemingly simple... sigh

This is proving to be a real pain to spec (the discussion doesn't match the implementation...), implement and test, so probably tomorrow.

For anybody wondering... you need to set the following to add squiggly heredoc support:

#.rubocop.yml
AllCops:
  TargetRubyVersion: 2.3

# If you are using the --enable-frozen-string-literal flag
# You might also want to add this:
Style/FrozenStringLiteralComment:
  Enabled: false
Was this page helpful?
0 / 5 - 0 ratings

Related issues

deivid-rodriguez picture deivid-rodriguez  路  3Comments

AndreiMotinga picture AndreiMotinga  路  3Comments

cabello picture cabello  路  3Comments

lepieru picture lepieru  路  3Comments

mlammers picture mlammers  路  3Comments