rubocop-performance 1.23.0 → 1.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40d68e8bad13725b44f9a32555e63071765f0d4720439aba66f8b1c2ae61d803
4
- data.tar.gz: 02f248b67961365ac64c7f5f99337d03d7a5dc9d57e36dd9ddccd3d2a16b75fb
3
+ metadata.gz: 332ca643753a81ff66c4a6050117f7a479bd3aaa3f186c361a596d06b16aa9b5
4
+ data.tar.gz: 2fb149f85f986d9d0302e6fbe4c7389f312bb93a15a93cec49ffd74495853c78
5
5
  SHA512:
6
- metadata.gz: 0bc99f145e03f6942e915b3edb51280821f66118d86d3b41bc87bc02ca4225ab8696510b7e77575fc2f05601cdc571a207b7d3c9eddc93e7ad238bc606ce3746
7
- data.tar.gz: 91b71a5204257159d636b44dc003f2cc1c2b2bc6f67a17d9054bcdef2921926e3e5b729191107422abe807ac9628d3efa9db9550866233e07a88fb67f4d252b6
6
+ metadata.gz: e03b8e178f4cde75ef5d82aa7483da512f2816afd82c97b414a4bfcd7afacf589ebb033d6bed40d0968217ec0ff24cb69e2a6c4f28a52ecbdb31cef5599e5386
7
+ data.tar.gz: 410a72e5e85fe6cdc8002b51c8b185dc4d2a1dea5f3a5889c146364c2a20b5b50256c2a90fef59604137dd75d83f20c17ec65991eac6b8dab15e046184e1f006
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-23 Bozhidar Batsov
1
+ Copyright (c) 2012-25 Bozhidar Batsov
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -18,14 +18,14 @@ module RuboCop
18
18
  #
19
19
  # [source,ruby]
20
20
  # ----
21
- # `Model.where(id: [1, 2, 3]).select { |m| m.method == true }.size`
21
+ # Model.where(id: [1, 2, 3]).select { |m| m.method == true }.size
22
22
  # ----
23
23
  #
24
24
  # becomes:
25
25
  #
26
26
  # [source,ruby]
27
27
  # ----
28
- # `Model.where(id: [1, 2, 3]).to_a.count { |m| m.method == true }`
28
+ # Model.where(id: [1, 2, 3]).to_a.count { |m| m.method == true }
29
29
  # ----
30
30
  #
31
31
  # @example
@@ -72,7 +72,7 @@ module RuboCop
72
72
 
73
73
  def requires_parentheses?(arg)
74
74
  return true if arg.if_type? && arg.ternary?
75
- return true if arg.and_type? || arg.or_type? || arg.range_type?
75
+ return true if arg.operator_keyword? || arg.range_type?
76
76
 
77
77
  call_like?(arg) && requires_parentheses_for_call_like?(arg)
78
78
  end
@@ -48,7 +48,7 @@ module RuboCop
48
48
  RESTRICT_ON_SEND = %i[[] slice first last take length size empty?].freeze
49
49
 
50
50
  def_node_matcher :redundant_chars_call?, <<~PATTERN
51
- (send $(send _ :chars) $_ $...)
51
+ (send $(send !nil? :chars) $_ $...)
52
52
  PATTERN
53
53
 
54
54
  def on_send(node)
@@ -46,7 +46,11 @@ module RuboCop
46
46
  message = format(MSG, current: bad_method, prefer: good_method)
47
47
 
48
48
  add_offense(node.loc.selector, message: message) do |corrector|
49
- string_literal = to_string_literal(replace_str)
49
+ # FIXME: When requiring only RuboCop 1.70.0 and above,
50
+ # `dup` in `replace_str.dup` becomes unnecessary, as
51
+ # frozen strings are handled in the `to_string_literal`
52
+ # implementation. Please remove it.
53
+ string_literal = to_string_literal(replace_str.dup)
50
54
  new_code = "#{receiver.source}#{node.loc.dot.source}#{good_method}(#{string_literal})"
51
55
 
52
56
  corrector.replace(node, new_code)
@@ -4,7 +4,7 @@ module RuboCop
4
4
  module Performance
5
5
  # This module holds the RuboCop Performance version information.
6
6
  module Version
7
- STRING = '1.23.0'
7
+ STRING = '1.23.1'
8
8
 
9
9
  def self.document_version
10
10
  STRING.match('\d+\.\d+').to_s
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-performance
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.23.0
4
+ version: 1.23.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
@@ -9,7 +9,7 @@ authors:
9
9
  - Yuji Nakayama
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-11-14 00:00:00.000000000 Z
12
+ date: 2025-01-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rubocop
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  - !ruby/object:Gem::Version
148
148
  version: '0'
149
149
  requirements: []
150
- rubygems_version: 3.6.0.dev
150
+ rubygems_version: 3.6.1
151
151
  specification_version: 4
152
152
  summary: Automatic performance checking tool for Ruby code.
153
153
  test_files: []