Skip to content

Commit

Permalink
Cut 1.20.0
Browse files Browse the repository at this point in the history
  • Loading branch information
koic committed Dec 16, 2023
1 parent 5ec8988 commit f79ecaa
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -11,6 +11,8 @@

## master (unreleased)

## 1.20.0 (2023-12-16)

### New features

* [#384](https://github.com/rubocop/rubocop-performance/issues/384): Support optimized `String#dup` for `Performance/UnfreezeString` when Ruby 3.3+. ([@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.20'
nav:
- modules/ROOT/nav.adoc
10 changes: 6 additions & 4 deletions docs/modules/ROOT/pages/cops_performance.adoc
Expand Up @@ -544,8 +544,7 @@ passed to the `count` call.
=== Safety

This cop is unsafe because it has known compatibility issues with `ActiveRecord` and other
frameworks. ActiveRecord's `count` ignores the block that is passed to it.
`ActiveRecord` will ignore the block that is passed to `count`.
frameworks. Before Rails 5.1, `ActiveRecord` will ignore the block that is passed to `count`.
Other methods, such as `select`, will convert the association to an
array and then run the block on the array. A simple work around to
make `count` work with a block is to call `to_a.count {...}`.
Expand Down Expand Up @@ -2075,11 +2074,13 @@ and the following examples are parts of it.
send('do_something')
attr_accessor 'do_something'
instance_variable_get('@ivar')
const_get("string_#{interpolation}")
# good
send(:do_something)
attr_accessor :do_something
instance_variable_get(:@ivar)
const_get(:"string_#{interpolation}")
----

== Performance/StringInclude
Expand Down Expand Up @@ -2111,6 +2112,7 @@ str =~ /ab/
/ab/ =~ str
str.match(/ab/)
/ab/.match(str)
/ab/ === str
# good
str.include?('ab')
Expand Down Expand Up @@ -2328,8 +2330,8 @@ if you expect `ASCII-8BIT` encoding, disable this cop.
[source,ruby]
----
# bad
''.dup
"something".dup
''.dup # when Ruby 3.2 or lower
"something".dup # when Ruby 3.2 or lower
String.new
String.new('')
String.new('something')
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.19.1'
STRING = '1.20.0'

def self.document_version
STRING.match('\d+\.\d+').to_s
Expand Down
22 changes: 22 additions & 0 deletions relnotes/v1.20.0.md
@@ -0,0 +1,22 @@
### New features

* [#384](https://github.com/rubocop/rubocop-performance/issues/384): Support optimized `String#dup` for `Performance/UnfreezeString` when Ruby 3.3+. ([@koic][])

### Bug fixes

* [#374](https://github.com/rubocop/rubocop-performance/issues/374): Fix an error for `Performance/MapMethodChain` when using `map` method chain without receiver. ([@koic][])
* [#386](https://github.com/rubocop/rubocop-performance/issues/386): Fix a false negative for `Performance/StringIdentifierArgument` when using string interpolation. ([@earlopain][])
* [#419](https://github.com/rubocop/rubocop-performance/pull/419): Make `Performance/Count`, `Performance/FixedSize`, `Performance/FlatMap`, `Performance/InefficientHashSearch`, `Performance/RangeInclude`, `Performance/RedundantSortBlock`, `Performance/ReverseFirst`, `Performance/SelectMap`, `Performance/Size`, `Performance/SortReverse`, and `Performance/TimesMap` cops aware of safe navigation operator. ([@koic][])
* [#390](https://github.com/rubocop/rubocop-performance/issues/390): Fix a false negative for `Performance/ReverseEach` when safe navigation is between `reverse` and `each`. ([@fatkodima][])
* [#401](https://github.com/rubocop/rubocop-performance/issues/401): Make `Performance/Sum` aware of safe navigation operator. ([@koic][])

### Changes

* [#389](https://github.com/rubocop/rubocop-performance/issues/389): Improve `Performance/MapCompact` to handle more safe navigation calls. ([@fatkodima][])
* [#395](https://github.com/rubocop/rubocop-performance/issues/395): Enhance `Performance/StringInclude` to handle `===` method. ([@fatkodima][])
* [#388](https://github.com/rubocop/rubocop-performance/pull/388): Require RuboCop 1.30+ as runtime dependency. ([@koic][])
* [#380](https://github.com/rubocop/rubocop-performance/pull/380): Require RuboCop AST 1.30.0+. ([@koic][])

[@koic]: https://github.com/koic
[@earlopain]: https://github.com/earlopain
[@fatkodima]: https://github.com/fatkodima

0 comments on commit f79ecaa

Please sign in to comment.