forked from rubocop/rubocop-rails
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a false-positive with Rails/RelativeDateConstant
Prior to this, procs would only be allowed for the top-level assignment - eg FOO = 1.week.ago # bad FOO = Proc.new { 1.week.ago } # good but didn't accept cases where the Proc was nested further down, eg: FOO = { weekly: Proc.new { 1.week.ago } # bad (but should be good!) } This patch changes the RelativeDateConstant to recursive down through the child nodes of the const-assignment, stopping whenever a Proc is encountered. As a result, ranges no longer need special-casing, so I've removed the handling for those.
- Loading branch information
1 parent
98059c3
commit e0e1c9a
Showing
3 changed files
with
31 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters