Skip to content

Commit

Permalink
Cut 2.20.0
Browse files Browse the repository at this point in the history
  • Loading branch information
koic committed Jun 18, 2023
1 parent 8206333 commit c88634f
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 21 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

## master (unreleased)

## 2.20.0 (2023-06-18)

### New features

* [#999](https://github.com/rubocop/rubocop-rails/pull/999): Add autocorrection for `Rails/Date`. ([@r7kamura][])
Expand Down
10 changes: 5 additions & 5 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Rails/AddColumnIndex:
index might be used.
Enabled: pending
VersionAdded: '2.11'
VersionChanged: '<<next>>'
VersionChanged: '2.20'
Include:
- db/**/*.rb

Expand Down Expand Up @@ -250,7 +250,7 @@ Rails/BulkChangeTable:
- https://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/Table.html
Enabled: true
VersionAdded: '0.57'
VersionChanged: '<<next>>'
VersionChanged: '2.20'
Database: null
SupportedDatabases:
- mysql
Expand Down Expand Up @@ -286,7 +286,7 @@ Rails/CreateTableWithTimestamps:
when creating a new table.
Enabled: true
VersionAdded: '0.52'
VersionChanged: '<<next>>'
VersionChanged: '2.20'
Include:
- db/**/*.rb
Exclude:
Expand Down Expand Up @@ -652,7 +652,7 @@ Rails/MigrationClassName:
Description: 'The class name of the migration should match its file name.'
Enabled: pending
VersionAdded: '2.14'
VersionChanged: '<<next>>'
VersionChanged: '2.20'
Include:
- db/**/*.rb

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

Expand Down
2 changes: 1 addition & 1 deletion docs/antora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ name: rubocop-rails
title: RuboCop Rails
# We always provide version without patch here (e.g. 1.1),
# as patch versions should not appear in the docs.
version: ~
version: '2.20'
nav:
- modules/ROOT/nav.adoc
37 changes: 23 additions & 14 deletions docs/modules/ROOT/pages/cops_rails.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ ActiveSupport.on_load(:active_record) { include MyClass }
| Yes
| Yes
| 2.11
| -
| 2.20
|===

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

| Include
| `+db/migrate/*.rb+`
| `+db/**/*.rb+`
| Array
|===

Expand Down Expand Up @@ -960,7 +960,7 @@ end
| Yes
| No
| 0.57
| -
| 2.20
|===

Checks whether alter queries are combinable.
Expand Down Expand Up @@ -1039,7 +1039,7 @@ end
| `mysql`, `postgresql`

| Include
| `+db/migrate/*.rb+`
| `+db/**/*.rb+`
| Array
|===

Expand Down Expand Up @@ -1155,7 +1155,7 @@ tag(name, class: 'classname')
| Yes
| No
| 0.52
| -
| 2.20
|===

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

| Include
| `+db/migrate/*.rb+`
| `+db/**/*.rb+`
| Array

| Exclude
| `+db/migrate/*_create_active_storage_tables.active_storage.rb+`
| `+db/**/*_create_active_storage_tables.active_storage.rb+`, `+db/**/*_create_active_storage_variant_records.active_storage.rb+`
| Array
|===

Expand All @@ -1229,7 +1229,7 @@ end

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

=== Safety

This cop's autocorrection is unsafe because it may change handling time.

=== Examples

==== EnforcedStyle: flexible (default)
Expand Down Expand Up @@ -2094,7 +2098,7 @@ date.all_year

| Enabled
| Yes
| No
| Yes
| 0.47
| 2.4
|===
Expand Down Expand Up @@ -2856,7 +2860,7 @@ end

| Enabled
| Yes
| No
| Yes
| 0.63
| -
|===
Expand Down Expand Up @@ -3466,7 +3470,7 @@ match 'photos/:id', to: 'photos#show', via: :all
| Yes
| Yes
| 2.14
| -
| 2.20
|===

Makes sure that each migration file defines a migration class
Expand Down Expand Up @@ -3494,7 +3498,7 @@ end
| Name | Default value | Configurable values

| Include
| `+db/migrate/*.rb+`
| `+db/**/*.rb+`
| Array
|===

Expand Down Expand Up @@ -3544,7 +3548,7 @@ hash.exclude?(:key)
| Yes
| No
| 0.43
| -
| 2.20
|===

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

| Include
| `+db/migrate/*.rb+`
| `+db/**/*.rb+`
| Array
|===

Expand Down Expand Up @@ -6168,6 +6172,11 @@ user.with_lock do
throw if user.active?
end
# bad, as `with_lock` implicitly opens a transaction too
ApplicationRecord.with_lock do
break if user.active?
end
# good
ApplicationRecord.transaction do
# Rollback
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/rails/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module RuboCop
module Rails
# This module holds the RuboCop Rails version information.
module Version
STRING = '2.19.1'
STRING = '2.20.0'

def self.document_version
STRING.match('\d+\.\d+').to_s
Expand Down
32 changes: 32 additions & 0 deletions relnotes/v2.20.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
### New features

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

### Bug fixes

* [#1005](https://github.com/rubocop/rubocop-rails/pull/1005): Flag `break` in `with_lock` for `Rails/TransactionExitStatement`. ([@splattael][])
* [#997](https://github.com/rubocop/rubocop-rails/issues/997): Fix to Allow `NotNullColumn` to work with method calls and variables. ([@fidalgo][])
* [#989](https://github.com/rubocop/rubocop-rails/pull/989): Fix `Rails/FilePath` to detect offenses from complex string interpolation. ([@r7kamura][])
* [#1010](https://github.com/rubocop/rubocop-rails/issues/1010): Fix `Rails/ThreeStateBooleanColumn` for dynamic tables/columns. ([@fatkodima][])
* [#1008](https://github.com/rubocop/rubocop-rails/pull/1008): Fix `UniqueValidationWithoutIndex` to not detect offenses when a validation specifies `uniqueness: false`. ([@samrjenkins][])

### Changes

* [#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][])
* [#995](https://github.com/rubocop/rubocop-rails/pull/995): Check for `or` method in `Rails/FindEach` cop. ([@masato-bkn][])
* [#1019](https://github.com/rubocop/rubocop-rails/pull/1019): Change db migration file pattern so that it supports multiple db. ([@r7kamura][])
* [#986](https://github.com/rubocop/rubocop-rails/pull/986): **(Breaking)** Drop Ruby 2.6 support. ([@koic][])
* [#992](https://github.com/rubocop/rubocop-rails/pull/992): Exclude `app/assets/**/*` by default. ([@r7kamura][])
* [#1014](https://github.com/rubocop/rubocop-rails/pull/1014): Make `Lint/RedundantSafeNavigation` aware of `presence` and `present?` methods. ([@koic][])
* [#1007](https://github.com/rubocop/rubocop-rails/issues/1007): Support `flash.now` for `Rails/I18nLocaleTexts`. ([@fatkodima][])

[@r7kamura]: https://github.com/r7kamura
[@splattael]: https://github.com/splattael
[@fidalgo]: https://github.com/fidalgo
[@fatkodima]: https://github.com/fatkodima
[@samrjenkins]: https://github.com/samrjenkins
[@tka5]: https://github.com/tka5
[@masato-bkn]: https://github.com/masato-bkn
[@koic]: https://github.com/koic

0 comments on commit c88634f

Please sign in to comment.