-
-
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
Cop idea: use all_day instead of manually creating the day range #486
Labels
feature request
Request for new functionality
Comments
Implementation note: Available since Rails 5.1 |
There’s also |
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
May 17, 2021
Fixes rubocop#486. This PR adds new `Rails/ExpandedDateRange` cop that checks for expanded date range. It only compatible `..` range is targeted. Incompatible `...` range is ignored. ```ruby # bad date.beginning_of_day..date.end_of_day date.beginning_of_week..date.end_of_week date.beginning_of_month..date.end_of_month date.beginning_of_quarter..date.end_of_quarter date.beginning_of_year..date.end_of_year # good date.all_day date.all_week date.all_month date.all_quarter date.all_year ```
9 tasks
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
May 17, 2021
Fixes rubocop#486. This PR adds new `Rails/ExpandedDateRange` cop that checks for expanded date range. It only compatible `..` range is targeted. Incompatible `...` range is ignored. ```ruby # bad date.beginning_of_day..date.end_of_day date.beginning_of_week..date.end_of_week date.beginning_of_month..date.end_of_month date.beginning_of_quarter..date.end_of_quarter date.beginning_of_year..date.end_of_year # good date.all_day date.all_week date.all_month date.all_quarter date.all_year ```
koic
added a commit
that referenced
this issue
May 23, 2021
[Fix #486] Add new `Rails/ExpandedDateRange` cop
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
I've seen (and wrote) a lot of the
.where(some_date_field: date.beginning_of_day..date.end_of_day)
code.Today I learned there is
.all_day
shortcut for that.Describe the solution you'd like
A cop to promote the above would be nice
The text was updated successfully, but these errors were encountered: