Skip to content

Commit 4403b05

Browse files
committed
Move enforced styles to top in docs
Follow up rubocop/rubocop#10684.
1 parent 6d82181 commit 4403b05

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

lib/rubocop/cop/rails/date.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,26 @@ module Rails
2222
# And you can set a warning for `to_time` with `AllowToTime: false`.
2323
# `AllowToTime` is `true` by default to prevent false positive on `DateTime` object.
2424
#
25-
# @example EnforcedStyle: strict
25+
# @example EnforcedStyle: flexible (default)
2626
# # bad
27-
# Date.current
28-
# Date.yesterday
2927
# Date.today
3028
#
3129
# # good
3230
# Time.zone.today
3331
# Time.zone.today - 1.day
32+
# Date.current
33+
# Date.yesterday
34+
# date.in_time_zone
3435
#
35-
# @example EnforcedStyle: flexible (default)
36+
# @example EnforcedStyle: strict
3637
# # bad
38+
# Date.current
39+
# Date.yesterday
3740
# Date.today
3841
#
3942
# # good
4043
# Time.zone.today
4144
# Time.zone.today - 1.day
42-
# Date.current
43-
# Date.yesterday
44-
# date.in_time_zone
4545
#
4646
# @example AllowToTime: true (default)
4747
# # good

lib/rubocop/cop/rails/file_path.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ module Rails
77
# to use `Rails.root.join` clause. It is used to add uniformity when
88
# joining paths.
99
#
10-
# @example EnforcedStyle: arguments
10+
# @example EnforcedStyle: slashes (default)
1111
# # bad
12-
# Rails.root.join('app/models/goober')
12+
# Rails.root.join('app', 'models', 'goober')
1313
# File.join(Rails.root, 'app/models/goober')
1414
# "#{Rails.root}/app/models/goober"
1515
#
1616
# # good
17-
# Rails.root.join('app', 'models', 'goober')
17+
# Rails.root.join('app/models/goober')
1818
#
19-
# @example EnforcedStyle: slashes (default)
19+
# @example EnforcedStyle: arguments
2020
# # bad
21-
# Rails.root.join('app', 'models', 'goober')
21+
# Rails.root.join('app/models/goober')
2222
# File.join(Rails.root, 'app/models/goober')
2323
# "#{Rails.root}/app/models/goober"
2424
#
2525
# # good
26-
# Rails.root.join('app/models/goober')
26+
# Rails.root.join('app', 'models', 'goober')
2727
#
2828
class FilePath < Base
2929
include ConfigurableEnforcedStyle

lib/rubocop/cop/rails/time_zone.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ module Rails
2828
# Time.zone.parse('2015-03-02T19:05:37')
2929
# Time.zone.parse('2015-03-02T19:05:37Z') # Respect ISO 8601 format with timezone specifier.
3030
#
31-
# @example EnforcedStyle: strict
32-
# # `strict` means that `Time` should be used with `zone`.
33-
#
34-
# # bad
35-
# Time.at(timestamp).in_time_zone
36-
#
3731
# @example EnforcedStyle: flexible (default)
3832
# # `flexible` allows usage of `in_time_zone` instead of `zone`.
3933
#
4034
# # good
4135
# Time.at(timestamp).in_time_zone
36+
#
37+
# @example EnforcedStyle: strict
38+
# # `strict` means that `Time` should be used with `zone`.
39+
#
40+
# # bad
41+
# Time.at(timestamp).in_time_zone
4242
class TimeZone < Base
4343
include ConfigurableEnforcedStyle
4444
extend AutoCorrector

0 commit comments

Comments
 (0)