Skip to content

Commit c88634f

Browse files
committed
Cut 2.20.0
1 parent 8206333 commit c88634f

File tree

6 files changed

+64
-21
lines changed

6 files changed

+64
-21
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
## master (unreleased)
1111

12+
## 2.20.0 (2023-06-18)
13+
1214
### New features
1315

1416
* [#999](https://github.com/rubocop/rubocop-rails/pull/999): Add autocorrection for `Rails/Date`. ([@r7kamura][])

config/default.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ Rails/AddColumnIndex:
160160
index might be used.
161161
Enabled: pending
162162
VersionAdded: '2.11'
163-
VersionChanged: '<<next>>'
163+
VersionChanged: '2.20'
164164
Include:
165165
- db/**/*.rb
166166

@@ -250,7 +250,7 @@ Rails/BulkChangeTable:
250250
- https://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/Table.html
251251
Enabled: true
252252
VersionAdded: '0.57'
253-
VersionChanged: '<<next>>'
253+
VersionChanged: '2.20'
254254
Database: null
255255
SupportedDatabases:
256256
- mysql
@@ -286,7 +286,7 @@ Rails/CreateTableWithTimestamps:
286286
when creating a new table.
287287
Enabled: true
288288
VersionAdded: '0.52'
289-
VersionChanged: '<<next>>'
289+
VersionChanged: '2.20'
290290
Include:
291291
- db/**/*.rb
292292
Exclude:
@@ -652,7 +652,7 @@ Rails/MigrationClassName:
652652
Description: 'The class name of the migration should match its file name.'
653653
Enabled: pending
654654
VersionAdded: '2.14'
655-
VersionChanged: '<<next>>'
655+
VersionChanged: '2.20'
656656
Include:
657657
- db/**/*.rb
658658

@@ -668,7 +668,7 @@ Rails/NotNullColumn:
668668
Description: 'Do not add a NOT NULL column without a default value.'
669669
Enabled: true
670670
VersionAdded: '0.43'
671-
VersionChanged: '<<next>>'
671+
VersionChanged: '2.20'
672672
Include:
673673
- db/**/*.rb
674674

docs/antora.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ name: rubocop-rails
22
title: RuboCop Rails
33
# We always provide version without patch here (e.g. 1.1),
44
# as patch versions should not appear in the docs.
5-
version: ~
5+
version: '2.20'
66
nav:
77
- modules/ROOT/nav.adoc

docs/modules/ROOT/pages/cops_rails.adoc

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ ActiveSupport.on_load(:active_record) { include MyClass }
418418
| Yes
419419
| Yes
420420
| 2.11
421-
| -
421+
| 2.20
422422
|===
423423

424424
Checks for migrations using `add_column` that have an `index`
@@ -444,7 +444,7 @@ add_index :table, :column
444444
| Name | Default value | Configurable values
445445

446446
| Include
447-
| `+db/migrate/*.rb+`
447+
| `+db/**/*.rb+`
448448
| Array
449449
|===
450450

@@ -960,7 +960,7 @@ end
960960
| Yes
961961
| No
962962
| 0.57
963-
| -
963+
| 2.20
964964
|===
965965

966966
Checks whether alter queries are combinable.
@@ -1039,7 +1039,7 @@ end
10391039
| `mysql`, `postgresql`
10401040

10411041
| Include
1042-
| `+db/migrate/*.rb+`
1042+
| `+db/**/*.rb+`
10431043
| Array
10441044
|===
10451045

@@ -1155,7 +1155,7 @@ tag(name, class: 'classname')
11551155
| Yes
11561156
| No
11571157
| 0.52
1158-
| -
1158+
| 2.20
11591159
|===
11601160

11611161
Checks the migration for which timestamps are not included when creating a new table.
@@ -1214,11 +1214,11 @@ end
12141214
| Name | Default value | Configurable values
12151215

12161216
| Include
1217-
| `+db/migrate/*.rb+`
1217+
| `+db/**/*.rb+`
12181218
| Array
12191219

12201220
| Exclude
1221-
| `+db/migrate/*_create_active_storage_tables.active_storage.rb+`
1221+
| `+db/**/*_create_active_storage_tables.active_storage.rb+`, `+db/**/*_create_active_storage_variant_records.active_storage.rb+`
12221222
| Array
12231223
|===
12241224

@@ -1229,7 +1229,7 @@ end
12291229

12301230
| Enabled
12311231
| Yes
1232-
| No
1232+
| Yes (Unsafe)
12331233
| 0.30
12341234
| 2.11
12351235
|===
@@ -1253,6 +1253,10 @@ When `EnforcedStyle` is `flexible` then only `Date.today` is prohibited.
12531253
And you can set a warning for `to_time` with `AllowToTime: false`.
12541254
`AllowToTime` is `true` by default to prevent false positive on `DateTime` object.
12551255

1256+
=== Safety
1257+
1258+
This cop's autocorrection is unsafe because it may change handling time.
1259+
12561260
=== Examples
12571261

12581262
==== EnforcedStyle: flexible (default)
@@ -2094,7 +2098,7 @@ date.all_year
20942098

20952099
| Enabled
20962100
| Yes
2097-
| No
2101+
| Yes
20982102
| 0.47
20992103
| 2.4
21002104
|===
@@ -2856,7 +2860,7 @@ end
28562860

28572861
| Enabled
28582862
| Yes
2859-
| No
2863+
| Yes
28602864
| 0.63
28612865
| -
28622866
|===
@@ -3466,7 +3470,7 @@ match 'photos/:id', to: 'photos#show', via: :all
34663470
| Yes
34673471
| Yes
34683472
| 2.14
3469-
| -
3473+
| 2.20
34703474
|===
34713475

34723476
Makes sure that each migration file defines a migration class
@@ -3494,7 +3498,7 @@ end
34943498
| Name | Default value | Configurable values
34953499

34963500
| Include
3497-
| `+db/migrate/*.rb+`
3501+
| `+db/**/*.rb+`
34983502
| Array
34993503
|===
35003504

@@ -3544,7 +3548,7 @@ hash.exclude?(:key)
35443548
| Yes
35453549
| No
35463550
| 0.43
3547-
| -
3551+
| 2.20
35483552
|===
35493553

35503554
Checks for add_column call with NOT NULL constraint
@@ -3571,7 +3575,7 @@ add_reference :products, :category, null: false, default: 1
35713575
| Name | Default value | Configurable values
35723576

35733577
| Include
3574-
| `+db/migrate/*.rb+`
3578+
| `+db/**/*.rb+`
35753579
| Array
35763580
|===
35773581

@@ -6168,6 +6172,11 @@ user.with_lock do
61686172
throw if user.active?
61696173
end
61706174
6175+
# bad, as `with_lock` implicitly opens a transaction too
6176+
ApplicationRecord.with_lock do
6177+
break if user.active?
6178+
end
6179+
61716180
# good
61726181
ApplicationRecord.transaction do
61736182
# Rollback

lib/rubocop/rails/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module RuboCop
44
module Rails
55
# This module holds the RuboCop Rails version information.
66
module Version
7-
STRING = '2.19.1'
7+
STRING = '2.20.0'
88

99
def self.document_version
1010
STRING.match('\d+\.\d+').to_s

relnotes/v2.20.0.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
### New features
2+
3+
* [#999](https://github.com/rubocop/rubocop-rails/pull/999): Add autocorrection for `Rails/Date`. ([@r7kamura][])
4+
* [#991](https://github.com/rubocop/rubocop-rails/pull/991): Add autocorrection for `Rails/FilePath`. ([@r7kamura][])
5+
* [#988](https://github.com/rubocop/rubocop-rails/pull/988): Add autocorrection for `Rails/IgnoredSkipActionFilterOption`. ([@r7kamura][])
6+
7+
### Bug fixes
8+
9+
* [#1005](https://github.com/rubocop/rubocop-rails/pull/1005): Flag `break` in `with_lock` for `Rails/TransactionExitStatement`. ([@splattael][])
10+
* [#997](https://github.com/rubocop/rubocop-rails/issues/997): Fix to Allow `NotNullColumn` to work with method calls and variables. ([@fidalgo][])
11+
* [#989](https://github.com/rubocop/rubocop-rails/pull/989): Fix `Rails/FilePath` to detect offenses from complex string interpolation. ([@r7kamura][])
12+
* [#1010](https://github.com/rubocop/rubocop-rails/issues/1010): Fix `Rails/ThreeStateBooleanColumn` for dynamic tables/columns. ([@fatkodima][])
13+
* [#1008](https://github.com/rubocop/rubocop-rails/pull/1008): Fix `UniqueValidationWithoutIndex` to not detect offenses when a validation specifies `uniqueness: false`. ([@samrjenkins][])
14+
15+
### Changes
16+
17+
* [#1011](https://github.com/rubocop/rubocop-rails/pull/1011): Add `*_create_active_storage_variant_records.active_storage.rb` to `Rails/CreateTableWithTimestamps` exclude file list. ([@tka5][])
18+
* [#995](https://github.com/rubocop/rubocop-rails/pull/995): Check for `or` method in `Rails/FindEach` cop. ([@masato-bkn][])
19+
* [#1019](https://github.com/rubocop/rubocop-rails/pull/1019): Change db migration file pattern so that it supports multiple db. ([@r7kamura][])
20+
* [#986](https://github.com/rubocop/rubocop-rails/pull/986): **(Breaking)** Drop Ruby 2.6 support. ([@koic][])
21+
* [#992](https://github.com/rubocop/rubocop-rails/pull/992): Exclude `app/assets/**/*` by default. ([@r7kamura][])
22+
* [#1014](https://github.com/rubocop/rubocop-rails/pull/1014): Make `Lint/RedundantSafeNavigation` aware of `presence` and `present?` methods. ([@koic][])
23+
* [#1007](https://github.com/rubocop/rubocop-rails/issues/1007): Support `flash.now` for `Rails/I18nLocaleTexts`. ([@fatkodima][])
24+
25+
[@r7kamura]: https://github.com/r7kamura
26+
[@splattael]: https://github.com/splattael
27+
[@fidalgo]: https://github.com/fidalgo
28+
[@fatkodima]: https://github.com/fatkodima
29+
[@samrjenkins]: https://github.com/samrjenkins
30+
[@tka5]: https://github.com/tka5
31+
[@masato-bkn]: https://github.com/masato-bkn
32+
[@koic]: https://github.com/koic

0 commit comments

Comments
 (0)