Skip to content

Commit

Permalink
Cut v2.23.0
Browse files Browse the repository at this point in the history
  • Loading branch information
koic committed Dec 16, 2023
1 parent cbd9eeb commit b55ee70
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 8 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.23.0 (2023-12-16)

### New features

* [#1183](https://github.com/rubocop/rubocop-rails/pull/1183): Support PostGIS adapter for PostgreSQL. ([@Dania02525][])
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.23'
nav:
- modules/ROOT/nav.adoc
21 changes: 15 additions & 6 deletions docs/modules/ROOT/pages/cops_rails.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4014,10 +4014,13 @@ as the cop cannot replace to `select` between calls to `pluck` on an
----
# bad
Post.where(user_id: User.active.pluck(:id))
Post.where(user_id: User.active.ids)
Post.where.not(user_id: User.active.pluck(:id))
# good
Post.where(user_id: User.active.select(:id))
Post.where(user_id: active_users.select(:id))
Post.where.not(user_id: active_users.select(:id))
----

==== EnforcedStyle: conservative (default)
Expand Down Expand Up @@ -4346,8 +4349,7 @@ end

Detect redundant `all` used as a receiver for Active Record query methods.

NOTE: For the methods `delete_all` and `destroy_all`,
this cop will only check cases where the receiver is a model.
For the methods `delete_all` and `destroy_all`, this cop will only check cases where the receiver is a model.
It will ignore cases where the receiver is an association (e.g., `user.articles.all.delete_all`).
This is because omitting `all` from an association changes the methods
from `ActiveRecord::Relation` to `ActiveRecord::Associations::CollectionProxy`,
Expand Down Expand Up @@ -4984,13 +4986,14 @@ require_dependency 'some_lib'
| 2.19
|===

Prefer `response.parsed_body` to `JSON.parse(response.body)`.
Prefer `response.parsed_body` to custom parsing logic for `response.body`.

=== Safety

This cop is unsafe because Content-Type may not be `application/json`. For example, the proprietary
Content-Type provided by corporate entities such as `application/vnd.github+json` is not supported at
`response.parsed_body` by default, so you still have to use `JSON.parse(response.body)` there.
This cop is unsafe because Content-Type may not be `application/json` or `text/html`.
For example, the proprietary Content-Type provided by corporate entities such as
`application/vnd.github+json` is not supported at `response.parsed_body` by default,
so you still have to use `JSON.parse(response.body)` there.

=== Examples

Expand All @@ -4999,6 +5002,12 @@ Content-Type provided by corporate entities such as `application/vnd.github+json
# bad
JSON.parse(response.body)
# bad
Nokogiri::HTML.parse(response.body)
# bad
Nokogiri::HTML5.parse(response.body)
# good
response.parsed_body
----
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.22.2'
STRING = '2.23.0'

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

* [#1183](https://github.com/rubocop/rubocop-rails/pull/1183): Support PostGIS adapter for PostgreSQL. ([@Dania02525][])

### Bug fixes

* [#1206](https://github.com/rubocop/rubocop-rails/issues/1206): Fix an error for `Rails/WhereMissing` where join method is called without arguments. ([@fatkodima][])
* [#1189](https://github.com/rubocop/rubocop-rails/issues/1189): Fix false negatives for `Rails/Pluck` when using safe navigation method calls. ([@koic][])
* [#1204](https://github.com/rubocop/rubocop-rails/pull/1204): Make `Rails/ActiveSupportAliases`, `Rails/FindBy`, `Rails/FindById`, `Rails/Inquiry`, `Rails/Pick` `Rails/PluckId`, `Rails/PluckInWhere`, `Rails/WhereEquals`, `Rails/WhereExists`, and `Rails/WhereNot` cops aware of safe navigation operator. ([@koic][])

### Changes

* [#1213](https://github.com/rubocop/rubocop-rails/issues/1213): Update `Rails/PluckInWhere` to check for `.ids` call. ([@fatkodima][])
* [#1181](https://github.com/rubocop/rubocop-rails/pull/1181): Support `Nokogiri::HTML.parse` and `Nokogiri::HTML5.parse` on `Rails/ResponseParsedBody`. ([@r7kamura][])
* [#1198](https://github.com/rubocop/rubocop-rails/issues/1198): Support `where.not` for `Rails/PluckInWhere`. ([@fatkodima][])

[@Dania02525]: https://github.com/Dania02525
[@fatkodima]: https://github.com/fatkodima
[@koic]: https://github.com/koic
[@r7kamura]: https://github.com/r7kamura

0 comments on commit b55ee70

Please sign in to comment.