Skip to content

Commit

Permalink
Move enforced styles to top in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
koic committed Jun 9, 2022
1 parent 6d82181 commit 4403b05
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
14 changes: 7 additions & 7 deletions lib/rubocop/cop/rails/date.rb
Expand Up @@ -22,26 +22,26 @@ module Rails
# And you can set a warning for `to_time` with `AllowToTime: false`.
# `AllowToTime` is `true` by default to prevent false positive on `DateTime` object.
#
# @example EnforcedStyle: strict
# @example EnforcedStyle: flexible (default)
# # bad
# Date.current
# Date.yesterday
# Date.today
#
# # good
# Time.zone.today
# Time.zone.today - 1.day
# Date.current
# Date.yesterday
# date.in_time_zone
#
# @example EnforcedStyle: flexible (default)
# @example EnforcedStyle: strict
# # bad
# Date.current
# Date.yesterday
# Date.today
#
# # good
# Time.zone.today
# Time.zone.today - 1.day
# Date.current
# Date.yesterday
# date.in_time_zone
#
# @example AllowToTime: true (default)
# # good
Expand Down
12 changes: 6 additions & 6 deletions lib/rubocop/cop/rails/file_path.rb
Expand Up @@ -7,23 +7,23 @@ module Rails
# to use `Rails.root.join` clause. It is used to add uniformity when
# joining paths.
#
# @example EnforcedStyle: arguments
# @example EnforcedStyle: slashes (default)
# # bad
# Rails.root.join('app/models/goober')
# Rails.root.join('app', 'models', 'goober')
# File.join(Rails.root, 'app/models/goober')
# "#{Rails.root}/app/models/goober"
#
# # good
# Rails.root.join('app', 'models', 'goober')
# Rails.root.join('app/models/goober')
#
# @example EnforcedStyle: slashes (default)
# @example EnforcedStyle: arguments
# # bad
# Rails.root.join('app', 'models', 'goober')
# Rails.root.join('app/models/goober')
# File.join(Rails.root, 'app/models/goober')
# "#{Rails.root}/app/models/goober"
#
# # good
# Rails.root.join('app/models/goober')
# Rails.root.join('app', 'models', 'goober')
#
class FilePath < Base
include ConfigurableEnforcedStyle
Expand Down
12 changes: 6 additions & 6 deletions lib/rubocop/cop/rails/time_zone.rb
Expand Up @@ -28,17 +28,17 @@ module Rails
# Time.zone.parse('2015-03-02T19:05:37')
# Time.zone.parse('2015-03-02T19:05:37Z') # Respect ISO 8601 format with timezone specifier.
#
# @example EnforcedStyle: strict
# # `strict` means that `Time` should be used with `zone`.
#
# # bad
# Time.at(timestamp).in_time_zone
#
# @example EnforcedStyle: flexible (default)
# # `flexible` allows usage of `in_time_zone` instead of `zone`.
#
# # good
# Time.at(timestamp).in_time_zone
#
# @example EnforcedStyle: strict
# # `strict` means that `Time` should be used with `zone`.
#
# # bad
# Time.at(timestamp).in_time_zone
class TimeZone < Base
include ConfigurableEnforcedStyle
extend AutoCorrector
Expand Down

0 comments on commit 4403b05

Please sign in to comment.