-
-
Notifications
You must be signed in to change notification settings - Fork 263
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
Rails/RelativeDateConstant does not detect some types of relative dates #451
Labels
bug
Something isn't working
Comments
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
Mar 25, 2021
Fixes rubocop#451. This commit fixes a false negative for `Rails/RelativeDateConstant` when a method is chained after a relative method.
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
Mar 25, 2021
…ay` and `tomorrow` methods.
9 tasks
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
Mar 25, 2021
Fixes rubocop#451. This commit fixes a false negative for `Rails/RelativeDateConstant` when a method is chained after a relative method.
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
Mar 25, 2021
…ay` and `tomorrow` methods.
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
Mar 25, 2021
Fixes rubocop#451. This commit fixes a false negative for `Rails/RelativeDateConstant` when a method is chained after a relative date method.
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
Mar 25, 2021
…ay` and `tomorrow` methods.
koic
added a commit
that referenced
this issue
Mar 27, 2021
…ve_date_constant [Fix #451] Fix a false negative for `Rails/RelativeDateConstant`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
RelativeDateConstant looks for constants in a particular format like
CONST = <offset>.ago
but doesn't consider other forms, such asI looked briefly at the matchers, but I wasn't sure if using
`
(as described here) would be appropriate to match the relative methods likeago
orsince
with arbitrary levels of nesting.Expected behavior
RelativeDateConstant adds offenses for a wider variety of relative date constants.
Actual behavior
None of the examples above produce offenses.
Steps to reproduce the problem
RuboCop version
rubocop-rails version is 2.6.0, the logic for this particular cop doesn't seem to have changed since then.
The text was updated successfully, but these errors were encountered: