You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yoda condition cop is fired in a situation where the left side is an interpolated string and right hand side is a constant. It works fine if string interpolation is removed.
Expected behavior
I expect YodaCondition not to be reported when comparing an interpolated string (left side) to a constant (right side).
Actual behavior
YodaCondition gets triggered.
Steps to reproduce the problem
The following triggers the cop: "/#{foo}" == CONSTANT and I don't think it should as the right hand side is constant and left hand side is not.
RuboCop version
0.85.1
The text was updated successfully, but these errors were encountered:
Fixesrubocop#8185.
This PR fixes a false positive for `Style/YodaCondition` when
interpolation is used on the left side.
String interpolation (and Regexp interpolation) contains variables,
I think it's acceptable to use it on the left hand side.
Fixes#8185.
This PR fixes a false positive for `Style/YodaCondition` when
interpolation is used on the left side.
String interpolation (and Regexp interpolation) contains variables,
I think it's acceptable to use it on the left hand side.
Yoda condition cop is fired in a situation where the left side is an interpolated string and right hand side is a constant. It works fine if string interpolation is removed.
Expected behavior
I expect YodaCondition not to be reported when comparing an interpolated string (left side) to a constant (right side).
Actual behavior
YodaCondition gets triggered.
Steps to reproduce the problem
The following triggers the cop:
"/#{foo}" == CONSTANT
and I don't think it should as the right hand side is constant and left hand side is not.RuboCop version
0.85.1
The text was updated successfully, but these errors were encountered: