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

An error occurred while Style/TrailingCommaInArguments cop was inspecting... #6755

Closed
Domon opened this issue Feb 10, 2019 · 3 comments
Closed
Assignees
Labels

Comments

@Domon
Copy link

Domon commented Feb 10, 2019

Expected behavior

RuboCop reports offenses (if any) without any unknown error.

Actual behavior

RuboCop reports no offenses but ends with an unknown error.

Steps to reproduce the problem

$ cat test.rb
foo.bar(
  x: 1,
)&.fetch(:y)

$ bundle exec rubocop test.rb
Inspecting 1 file
An error occurred while Style/TrailingCommaInArguments cop was inspecting /Users/domon/src/elements-revenue-period-finalizer/test.rb:1:0.
To see the complete backtrace run rubocop -d.
.

1 file inspected, no offenses detected

1 error occurred:
An error occurred while Style/TrailingCommaInArguments cop was inspecting /Users/domon/src/elements-revenue-period-finalizer/test.rb:1:0.
Errors are usually caused by RuboCop bugs.
Please, report your problems to RuboCop's issue tracker.
https://github.com/rubocop-hq/rubocop/issues

Mention the following information in the issue report:
0.64.0 (using Parser 2.6.0.0, running on ruby 2.6.0 x86_64-darwin18)

RuboCop version

$ bundle exec rubocop -V
0.64.0 (using Parser 2.6.0.0, running on ruby 2.6.0 x86_64-darwin18)
@Drenmi Drenmi added the bug label Feb 11, 2019
@Drenmi Drenmi self-assigned this Feb 11, 2019
@Drenmi Drenmi removed the bug label Feb 11, 2019
@Drenmi
Copy link
Collaborator

Drenmi commented Feb 11, 2019

Hi, @Domon!

What is your configured TargetRubyVersion? To be able to parse the lonely operator (&.), it needs to be 2.3 or higher. When using TargetRubyVersion: 2.6, this doesn't generate an error on current master, but it does when using TargetRubyVersion: 2.2.

@Domon
Copy link
Author

Domon commented Feb 11, 2019

Hi @Drenmi 👋

I can reproduce the error with TargetRubyVersion: 2.6 and RuboCop 0.64.0.

The following is my minimal .rubocop.yml to reproduce the error.

AllCops:
  TargetRubyVersion: 2.6
Style/TrailingCommaInArguments:
  EnforcedStyleForMultiline: comma
Style/FrozenStringLiteralComment:
  Enabled: false

@Drenmi
Copy link
Collaborator

Drenmi commented Feb 11, 2019

Thanks! I was able to reproduce the issue on master with the settings you provided. 🙇

@Drenmi Drenmi added the bug label Feb 11, 2019
Drenmi added a commit to Drenmi/rubocop that referenced this issue Feb 11, 2019
…g when a safe method call is chained on the offending method

This cop would error out on code like:

```
foo.bar(
  baz: 1,
)&.fetch(:qux)
```

This was happening because the cop wasn't taking `csend` (safe navigation)
node types into consideration.
@Drenmi Drenmi closed this as completed in e81e7a2 Feb 19, 2019
Drenmi added a commit that referenced this issue Feb 19, 2019
…ts-cop

[Fix #6755] Prevent Style/TrailingCommaInArgument from breaking when a safe method call is chained on the offending method
@Drenmi Drenmi mentioned this issue Feb 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants