Skip to content

Commit

Permalink
Cut 1.18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
koic committed May 21, 2023
1 parent 4a41d26 commit 4498b1d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -11,6 +11,8 @@

## master (unreleased)

## 1.18.0 (2023-05-21)

### Bug fixes

* [#359](https://github.com/rubocop/rubocop-performance/issues/359): Fix a false positive for `Performance/RedundantEqualityComparisonBlock` when the block variable is used on both sides of `==`. ([@koic][])
Expand Down
2 changes: 1 addition & 1 deletion docs/antora.yml
Expand Up @@ -2,6 +2,6 @@ name: rubocop-performance
title: RuboCop Performance
# We always provide version without patch here (e.g. 1.1),
# as patch versions should not appear in the docs.
version: ~
version: '1.18'
nav:
- modules/ROOT/nav.adoc
14 changes: 9 additions & 5 deletions docs/modules/ROOT/pages/cops_performance.adoc
Expand Up @@ -423,26 +423,30 @@ end

Identifies places where `sort { |a, b| a.foo <=> b.foo }`
can be replaced by `sort_by(&:foo)`.
This cop also checks `max` and `min` methods.
This cop also checks `sort!`, `min`, `max` and `minmax` methods.

=== Examples

[source,ruby]
----
# bad
array.sort { |a, b| a.foo <=> b.foo }
array.max { |a, b| a.foo <=> b.foo }
array.min { |a, b| a.foo <=> b.foo }
array.sort { |a, b| a[:foo] <=> b[:foo] }
array.sort { |a, b| a.foo <=> b.foo }
array.sort! { |a, b| a.foo <=> b.foo }
array.max { |a, b| a.foo <=> b.foo }
array.min { |a, b| a.foo <=> b.foo }
array.minmax { |a, b| a.foo <=> b.foo }
array.sort { |a, b| a[:foo] <=> b[:foo] }
# good
array.sort_by(&:foo)
array.sort_by!(&:foo)
array.sort_by { |v| v.foo }
array.sort_by do |var|
var.foo
end
array.max_by(&:foo)
array.min_by(&:foo)
array.minmax_by(&:foo)
array.sort_by { |a| a[:foo] }
----

Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/performance/version.rb
Expand Up @@ -4,7 +4,7 @@ module RuboCop
module Performance
# This module holds the RuboCop Performance version information.
module Version
STRING = '1.17.1'
STRING = '1.18.0'

def self.document_version
STRING.match('\d+\.\d+').to_s
Expand Down
13 changes: 13 additions & 0 deletions relnotes/v1.18.0.md
@@ -0,0 +1,13 @@
### Bug fixes

* [#359](https://github.com/rubocop/rubocop-performance/issues/359): Fix a false positive for `Performance/RedundantEqualityComparisonBlock` when the block variable is used on both sides of `==`. ([@koic][])
* [#351](https://github.com/rubocop/rubocop-performance/issues/351): Fix an incorrect autocorrect for `Performance/ConstantRegexp` and `Performance/RegexpMatch` when autocorrecting both at the same time. ([@fatkodima][])

### Changes

* [#357](https://github.com/rubocop/rubocop-performance/pull/357): Add `sort!` and `minmax` to `Performance/CompareWithBlock`. ([@vlad-pisanov][])
* [#353](https://github.com/rubocop/rubocop-performance/pull/353): **(Breaking)** Drop Ruby 2.6 support. ([@koic][])

[@koic]: https://github.com/koic
[@fatkodima]: https://github.com/fatkodima
[@vlad-pisanov]: https://github.com/vlad-pisanov

0 comments on commit 4498b1d

Please sign in to comment.