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
Constants defined with a conditional assignment operator (we do this to prevent specs from trying to redefine constants if a file is required more than once) caused the Rails/RelativeDateConstant cop to error.
Expected behavior
The cop should allow code like the following, because it doesn't contain a relative date:
@bbatsov Thanks ❤️ (I wasn't planning a drive-by issue and was going to look at fixing this myself, but am very thankful that you got a chance before me!)
Well, it turned out this cop wasn't even supporting ||=. :-) Thought the problem was a missing nil check, turned out it it was more complex, but it was fun to fix it.
Constants defined with a conditional assignment operator (we do this to prevent specs from trying to redefine constants if a file is required more than once) caused the
Rails/RelativeDateConstant
cop to error.Expected behavior
The cop should allow code like the following, because it doesn't contain a relative date:
Actual behavior
Rubocop errors like this:
Steps to reproduce the problem
Use the conditional assignment operator (
||=
) to define a constantRuboCop version
The text was updated successfully, but these errors were encountered: