-
-
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
Safe navigator operator (&.) breaks ABC check? #3578
Comments
I think this line is the issue: We need to add |
savef
added a commit
to savef/rubocop
that referenced
this issue
Oct 7, 2016
This cop wasn't correctly counting method calls that happen with the safe navigation operator (`x&.y`), it has been changed so that they are treated the same as other method calls (like `x.y`). Adds a test which checks the score of a method with the safe navigation operator. The test would fail without the change in the cop.
Neodelf
pushed a commit
to Neodelf/rubocop
that referenced
this issue
Oct 15, 2016
…ubocop#3581) This cop wasn't correctly counting method calls that happen with the safe navigation operator (`x&.y`), it has been changed so that they are treated the same as other method calls (like `x.y`). Adds a test which checks the score of a method with the safe navigation operator. The test would fail without the change in the cop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I just noticed that when I added a safe navigator operator (
&.
)rubocop
stopped reporting a method's ABC size. If anything, there should be even more branches, not less.I updated to the latest version of rubocop and still see the problem.
Fortunately, I was able to reproduce it with bogus code.
With the safe navigator I have no warning, but without it, I get
C: Assignment Branch Condition size for why? is too high. [15.07/15]
, as expected. Snippets are available on the steps to reproduce section.Expected behavior
It should report
C: Assignment Branch Condition size for why? is too high. [15.07/15]
Actual behavior
It finds no issues with the method after I introduce a
&.
.Steps to reproduce the problem
C: Assignment Branch Condition size for why? is too high. [15.07/15]
RuboCop version
The text was updated successfully, but these errors were encountered: