packwerk 2.1.1 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (189) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +29 -20
  3. data/.github/workflows/cla.yml +22 -0
  4. data/.rubocop.yml +48 -19
  5. data/Gemfile +7 -2
  6. data/Gemfile.lock +204 -177
  7. data/README.md +7 -2
  8. data/RESOLVING_VIOLATIONS.md +81 -0
  9. data/Rakefile +1 -1
  10. data/USAGE.md +14 -5
  11. data/bin/m +1 -1
  12. data/bin/rake +1 -1
  13. data/bin/rubocop +1 -1
  14. data/bin/srb +1 -1
  15. data/bin/tapioca +1 -1
  16. data/gemfiles/Gemfile-rails-6-0 +1 -1
  17. data/gemfiles/Gemfile-rails-6-1 +22 -0
  18. data/lib/packwerk/application_load_paths.rb +12 -18
  19. data/lib/packwerk/application_validator.rb +7 -6
  20. data/lib/packwerk/association_inspector.rb +17 -15
  21. data/lib/packwerk/cache.rb +36 -29
  22. data/lib/packwerk/cli.rb +14 -8
  23. data/lib/packwerk/const_node_inspector.rb +8 -7
  24. data/lib/packwerk/constant_name_inspector.rb +2 -2
  25. data/lib/packwerk/deprecated_references.rb +34 -19
  26. data/lib/packwerk/file_processor.rb +25 -23
  27. data/lib/packwerk/files_for_processing.rb +33 -35
  28. data/lib/packwerk/formatters/offenses_formatter.rb +3 -3
  29. data/lib/packwerk/formatters/progress_formatter.rb +2 -2
  30. data/lib/packwerk/node.rb +1 -294
  31. data/lib/packwerk/node_helpers.rb +335 -0
  32. data/lib/packwerk/node_processor.rb +6 -5
  33. data/lib/packwerk/node_processor_factory.rb +3 -3
  34. data/lib/packwerk/node_visitor.rb +1 -1
  35. data/lib/packwerk/offense_collection.rb +6 -3
  36. data/lib/packwerk/offenses_formatter.rb +2 -2
  37. data/lib/packwerk/package.rb +3 -0
  38. data/lib/packwerk/package_set.rb +3 -1
  39. data/lib/packwerk/parse_run.rb +15 -13
  40. data/lib/packwerk/parsed_constant_definitions.rb +23 -20
  41. data/lib/packwerk/parsers/erb.rb +3 -3
  42. data/lib/packwerk/parsers/parser_interface.rb +2 -0
  43. data/lib/packwerk/reference_checking/checkers/checker.rb +16 -3
  44. data/lib/packwerk/reference_checking/checkers/dependency_checker.rb +16 -0
  45. data/lib/packwerk/reference_checking/checkers/privacy_checker.rb +18 -0
  46. data/lib/packwerk/reference_checking/reference_checker.rb +4 -4
  47. data/lib/packwerk/reference_extractor.rb +51 -54
  48. data/lib/packwerk/reference_offense.rb +3 -27
  49. data/lib/packwerk/run_context.rb +9 -7
  50. data/lib/packwerk/spring_command.rb +1 -1
  51. data/lib/packwerk/version.rb +1 -1
  52. data/lib/packwerk.rb +1 -0
  53. data/packwerk.gemspec +4 -11
  54. data/sorbet/rbi/gems/actioncable@7.0.3.1.rbi +2754 -0
  55. data/sorbet/rbi/gems/actionmailbox@7.0.3.1.rbi +1496 -0
  56. data/sorbet/rbi/gems/actionmailer@7.0.3.1.rbi +2362 -0
  57. data/sorbet/rbi/gems/actionpack@7.0.3.1.rbi +19397 -0
  58. data/sorbet/rbi/gems/actiontext@7.0.3.1.rbi +1569 -0
  59. data/sorbet/rbi/gems/actionview@7.0.3.1.rbi +14907 -0
  60. data/sorbet/rbi/gems/activejob@7.0.3.1.rbi +2553 -0
  61. data/sorbet/rbi/gems/activemodel@7.0.3.1.rbi +5999 -0
  62. data/sorbet/rbi/gems/activerecord@7.0.3.1.rbi +37832 -0
  63. data/sorbet/rbi/gems/activestorage@7.0.3.1.rbi +2321 -0
  64. data/sorbet/rbi/gems/activesupport@7.0.3.1.rbi +18818 -0
  65. data/sorbet/rbi/gems/concurrent-ruby@1.1.10.rbi +11722 -0
  66. data/sorbet/rbi/gems/constant_resolver@0.2.0.rbi +90 -0
  67. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1079 -0
  68. data/sorbet/rbi/gems/digest@3.1.0.rbi +189 -0
  69. data/sorbet/rbi/gems/erubi@1.11.0.rbi +140 -0
  70. data/sorbet/rbi/gems/globalid@1.0.0.rbi +572 -0
  71. data/sorbet/rbi/gems/i18n@1.12.0.rbi +2296 -0
  72. data/sorbet/rbi/gems/json@2.6.2.rbi +1548 -0
  73. data/sorbet/rbi/gems/language_server-protocol@3.16.0.3.rbi +8 -0
  74. data/sorbet/rbi/gems/loofah@2.18.0.rbi +877 -0
  75. data/sorbet/rbi/gems/m@1.6.0.rbi +257 -0
  76. data/sorbet/rbi/gems/marcel@1.0.2.rbi +220 -0
  77. data/sorbet/rbi/gems/mini_mime@1.1.2.rbi +170 -0
  78. data/sorbet/rbi/gems/mini_portile2@2.8.0.rbi +8 -0
  79. data/sorbet/rbi/gems/minitest-focus@1.3.1.rbi +104 -0
  80. data/sorbet/rbi/gems/minitest@5.16.2.rbi +2136 -0
  81. data/sorbet/rbi/gems/mocha@1.14.0.rbi +4177 -0
  82. data/sorbet/rbi/gems/net-imap@0.2.3.rbi +2147 -0
  83. data/sorbet/rbi/gems/net-pop@0.1.1.rbi +926 -0
  84. data/sorbet/rbi/gems/net-protocol@0.1.3.rbi +11 -0
  85. data/sorbet/rbi/gems/net-smtp@0.3.1.rbi +1108 -0
  86. data/sorbet/rbi/gems/netrc@0.11.0.rbi +153 -0
  87. data/sorbet/rbi/gems/nio4r@2.5.8.rbi +292 -0
  88. data/sorbet/rbi/gems/nokogiri@1.13.8.rbi +6478 -0
  89. data/sorbet/rbi/gems/parallel@1.22.1.rbi +277 -0
  90. data/sorbet/rbi/gems/parser@3.1.2.1.rbi +9029 -0
  91. data/sorbet/rbi/gems/prettier_print@0.1.0.rbi +8 -0
  92. data/sorbet/rbi/gems/pry@0.14.1.rbi +8 -0
  93. data/sorbet/rbi/gems/racc@1.6.0.rbi +152 -0
  94. data/sorbet/rbi/gems/rack-test@2.0.2.rbi +953 -0
  95. data/sorbet/rbi/gems/rack@2.2.4.rbi +5636 -0
  96. data/sorbet/rbi/gems/rails-html-sanitizer@1.4.3.rbi +688 -0
  97. data/sorbet/rbi/gems/rails@7.0.3.1.rbi +8 -0
  98. data/sorbet/rbi/gems/railties@7.0.3.1.rbi +3507 -0
  99. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +392 -0
  100. data/sorbet/rbi/gems/rake@13.0.6.rbi +2924 -0
  101. data/sorbet/rbi/gems/rbi@0.0.15.rbi +3007 -0
  102. data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +3383 -0
  103. data/sorbet/rbi/gems/rexml@3.2.5.rbi +4714 -0
  104. data/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi +6961 -0
  105. data/sorbet/rbi/gems/rubocop-performance@1.14.3.rbi +2986 -0
  106. data/sorbet/rbi/gems/{rubocop-shopify@2.0.1.rbi → rubocop-shopify@2.9.0.rbi} +4 -4
  107. data/sorbet/rbi/gems/rubocop-sorbet@0.6.11.rbi +992 -0
  108. data/sorbet/rbi/gems/rubocop@1.34.1.rbi +51820 -0
  109. data/sorbet/rbi/gems/ruby-lsp@0.2.1.rbi +11 -0
  110. data/sorbet/rbi/gems/smart_properties@1.17.0.rbi +474 -0
  111. data/sorbet/rbi/gems/spoom@1.1.11.rbi +2181 -0
  112. data/sorbet/rbi/gems/spring@4.0.0.rbi +411 -0
  113. data/sorbet/rbi/gems/strscan@3.0.4.rbi +8 -0
  114. data/sorbet/rbi/gems/syntax_tree@3.3.0.rbi +8 -0
  115. data/sorbet/rbi/gems/tapioca@0.9.2.rbi +3181 -0
  116. data/sorbet/rbi/gems/thor@1.2.1.rbi +3956 -0
  117. data/sorbet/rbi/gems/timeout@0.3.0.rbi +142 -0
  118. data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +5896 -0
  119. data/sorbet/rbi/gems/unicode-display_width@2.2.0.rbi +48 -0
  120. data/sorbet/rbi/gems/unparser@0.6.5.rbi +4529 -0
  121. data/sorbet/rbi/gems/webrick@1.7.0.rbi +2582 -0
  122. data/sorbet/rbi/gems/websocket-driver@0.7.5.rbi +993 -0
  123. data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +388 -0
  124. data/sorbet/rbi/gems/yard@0.9.28.rbi +18242 -0
  125. data/sorbet/rbi/gems/zeitwerk@2.6.0.rbi +867 -0
  126. data/sorbet/rbi/shims/psych.rbi +5 -0
  127. data/sorbet/tapioca/require.rb +2 -3
  128. metadata +88 -143
  129. data/.github/probots.yml +0 -2
  130. data/library.yml +0 -6
  131. data/service.yml +0 -1
  132. data/sorbet/rbi/gems/actioncable@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -860
  133. data/sorbet/rbi/gems/actionmailbox@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -568
  134. data/sorbet/rbi/gems/actionmailer@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -587
  135. data/sorbet/rbi/gems/actionpack@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -5314
  136. data/sorbet/rbi/gems/actiontext@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -699
  137. data/sorbet/rbi/gems/actionview@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -2515
  138. data/sorbet/rbi/gems/activejob@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -624
  139. data/sorbet/rbi/gems/activemodel@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -1248
  140. data/sorbet/rbi/gems/activerecord@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -8363
  141. data/sorbet/rbi/gems/activestorage@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -876
  142. data/sorbet/rbi/gems/activesupport@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -3987
  143. data/sorbet/rbi/gems/colorize@0.8.1.rbi +0 -40
  144. data/sorbet/rbi/gems/commander@4.5.2.rbi +0 -8
  145. data/sorbet/rbi/gems/concurrent-ruby@1.1.8.rbi +0 -1969
  146. data/sorbet/rbi/gems/constant_resolver@0.1.5.rbi +0 -26
  147. data/sorbet/rbi/gems/erubi@1.10.0.rbi +0 -41
  148. data/sorbet/rbi/gems/globalid@0.4.2.rbi +0 -178
  149. data/sorbet/rbi/gems/highline@2.0.3.rbi +0 -8
  150. data/sorbet/rbi/gems/i18n@1.8.10.rbi +0 -600
  151. data/sorbet/rbi/gems/loofah@2.9.0.rbi +0 -274
  152. data/sorbet/rbi/gems/m@1.5.1.rbi +0 -108
  153. data/sorbet/rbi/gems/marcel@1.0.0.rbi +0 -70
  154. data/sorbet/rbi/gems/mini_mime@1.0.3.rbi +0 -71
  155. data/sorbet/rbi/gems/minitest-focus@1.2.1.rbi +0 -8
  156. data/sorbet/rbi/gems/minitest@5.14.4.rbi +0 -544
  157. data/sorbet/rbi/gems/mocha@1.12.0.rbi +0 -953
  158. data/sorbet/rbi/gems/nio4r@2.5.7.rbi +0 -90
  159. data/sorbet/rbi/gems/nokogiri@1.11.2.rbi +0 -1647
  160. data/sorbet/rbi/gems/parallel@1.20.1.rbi +0 -117
  161. data/sorbet/rbi/gems/parlour@6.0.0.rbi +0 -1272
  162. data/sorbet/rbi/gems/parser@3.0.0.0.rbi +0 -1745
  163. data/sorbet/rbi/gems/pry@0.14.0.rbi +0 -8
  164. data/sorbet/rbi/gems/psych@3.3.2.rbi +0 -24
  165. data/sorbet/rbi/gems/racc@1.5.2.rbi +0 -57
  166. data/sorbet/rbi/gems/rack-test@1.1.0.rbi +0 -335
  167. data/sorbet/rbi/gems/rack@2.2.3.rbi +0 -1718
  168. data/sorbet/rbi/gems/rails-html-sanitizer@1.3.0.rbi +0 -213
  169. data/sorbet/rbi/gems/rails@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -8
  170. data/sorbet/rbi/gems/railties@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -880
  171. data/sorbet/rbi/gems/rainbow@3.0.0.rbi +0 -155
  172. data/sorbet/rbi/gems/rake@13.0.3.rbi +0 -837
  173. data/sorbet/rbi/gems/regexp_parser@2.1.1.rbi +0 -8
  174. data/sorbet/rbi/gems/rexml@3.2.4.rbi +0 -8
  175. data/sorbet/rbi/gems/rubocop-ast@1.4.1.rbi +0 -8
  176. data/sorbet/rbi/gems/rubocop-performance@1.10.2.rbi +0 -8
  177. data/sorbet/rbi/gems/rubocop-sorbet@0.6.1.rbi +0 -8
  178. data/sorbet/rbi/gems/rubocop@1.12.0.rbi +0 -8
  179. data/sorbet/rbi/gems/smart_properties@1.15.0.rbi +0 -168
  180. data/sorbet/rbi/gems/spoom@1.1.0.rbi +0 -1061
  181. data/sorbet/rbi/gems/spring@2.1.1.rbi +0 -160
  182. data/sorbet/rbi/gems/sprockets-rails@3.2.2.rbi +0 -451
  183. data/sorbet/rbi/gems/sprockets@4.0.2.rbi +0 -1133
  184. data/sorbet/rbi/gems/tapioca@0.4.19.rbi +0 -603
  185. data/sorbet/rbi/gems/thor@1.1.0.rbi +0 -893
  186. data/sorbet/rbi/gems/tzinfo@2.0.4.rbi +0 -566
  187. data/sorbet/rbi/gems/unicode-display_width@2.0.0.rbi +0 -8
  188. data/sorbet/rbi/gems/websocket-driver@0.7.3.rbi +0 -438
  189. data/sorbet/rbi/gems/zeitwerk@2.4.2.rbi +0 -177
@@ -0,0 +1,2986 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `rubocop-performance` gem.
5
+ # Please instead update this file by running `bin/tapioca gem rubocop-performance`.
6
+
7
+ # source://rubocop-performance-1.14.3/lib/rubocop/performance.rb:3
8
+ module RuboCop; end
9
+
10
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/mixin/regexp_metacharacter.rb:4
11
+ module RuboCop::Cop; end
12
+
13
+ # @deprecated IgnoredMethods class has been replaced with AllowedMethods.
14
+ #
15
+ # source://rubocop-1.34.1/lib/rubocop/cop/mixin/allowed_methods.rb:33
16
+ RuboCop::Cop::IgnoredMethods = RuboCop::Cop::AllowedMethods
17
+
18
+ # @deprecated IgnoredPattern class has been replaced with AllowedPattern.
19
+ #
20
+ # source://rubocop-1.34.1/lib/rubocop/cop/mixin/allowed_pattern.rb:46
21
+ RuboCop::Cop::IgnoredPattern = RuboCop::Cop::AllowedPattern
22
+
23
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/ancestors_include.rb:5
24
+ module RuboCop::Cop::Performance; end
25
+
26
+ # Identifies usages of `ancestors.include?` and change them to use `<=` instead.
27
+ #
28
+ # @example
29
+ # # bad
30
+ # A.ancestors.include?(B)
31
+ #
32
+ # # good
33
+ # A <= B
34
+ #
35
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/ancestors_include.rb:19
36
+ class RuboCop::Cop::Performance::AncestorsInclude < ::RuboCop::Cop::Base
37
+ include ::RuboCop::Cop::RangeHelp
38
+ extend ::RuboCop::Cop::AutoCorrector
39
+
40
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/ancestors_include.rb:26
41
+ def ancestors_include_candidate?(param0 = T.unsafe(nil)); end
42
+
43
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/ancestors_include.rb:30
44
+ def on_send(node); end
45
+
46
+ private
47
+
48
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/ancestors_include.rb:43
49
+ def range(node); end
50
+ end
51
+
52
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/ancestors_include.rb:23
53
+ RuboCop::Cop::Performance::AncestorsInclude::MSG = T.let(T.unsafe(nil), String)
54
+
55
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/ancestors_include.rb:24
56
+ RuboCop::Cop::Performance::AncestorsInclude::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
57
+
58
+ # Identifies places where slicing arrays with semi-infinite ranges
59
+ # can be replaced by `Array#take` and `Array#drop`.
60
+ # This cop was created due to a mistake in microbenchmark and hence is disabled by default.
61
+ # Refer https://github.com/rubocop/rubocop-performance/pull/175#issuecomment-731892717
62
+ #
63
+ # @example
64
+ # # bad
65
+ # array[..2]
66
+ # array[...2]
67
+ # array[2..]
68
+ # array[2...]
69
+ # array.slice(..2)
70
+ #
71
+ # # good
72
+ # array.take(3)
73
+ # array.take(2)
74
+ # array.drop(2)
75
+ # array.drop(2)
76
+ # array.take(3)
77
+ #
78
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb:29
79
+ class RuboCop::Cop::Performance::ArraySemiInfiniteRangeSlice < ::RuboCop::Cop::Base
80
+ include ::RuboCop::Cop::RangeHelp
81
+ extend ::RuboCop::Cop::AutoCorrector
82
+ extend ::RuboCop::Cop::TargetRubyVersion
83
+
84
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb:45
85
+ def endless_range?(param0 = T.unsafe(nil)); end
86
+
87
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb:41
88
+ def endless_range_slice?(param0 = T.unsafe(nil)); end
89
+
90
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb:52
91
+ def on_send(node); end
92
+
93
+ private
94
+
95
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb:65
96
+ def correction(receiver, range_node); end
97
+ end
98
+
99
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb:36
100
+ RuboCop::Cop::Performance::ArraySemiInfiniteRangeSlice::MSG = T.let(T.unsafe(nil), String)
101
+
102
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb:39
103
+ RuboCop::Cop::Performance::ArraySemiInfiniteRangeSlice::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set)
104
+
105
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb:38
106
+ RuboCop::Cop::Performance::ArraySemiInfiniteRangeSlice::SLICE_METHODS = T.let(T.unsafe(nil), Set)
107
+
108
+ # Identifies places where numeric argument to BigDecimal should be
109
+ # converted to string. Initializing from String is faster
110
+ # than from Numeric for BigDecimal.
111
+ #
112
+ # @example
113
+ # # bad
114
+ # BigDecimal(1, 2)
115
+ # 4.to_d(6)
116
+ # BigDecimal(1.2, 3, exception: true)
117
+ # 4.5.to_d(6, exception: true)
118
+ #
119
+ # # good
120
+ # BigDecimal('1', 2)
121
+ # BigDecimal('4', 6)
122
+ # BigDecimal('1.2', 3, exception: true)
123
+ # BigDecimal('4.5', 6, exception: true)
124
+ #
125
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb:23
126
+ class RuboCop::Cop::Performance::BigDecimalWithNumericArgument < ::RuboCop::Cop::Base
127
+ extend ::RuboCop::Cop::AutoCorrector
128
+
129
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb:29
130
+ def big_decimal_with_numeric_argument?(param0 = T.unsafe(nil)); end
131
+
132
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb:37
133
+ def on_send(node); end
134
+
135
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb:33
136
+ def to_d?(param0 = T.unsafe(nil)); end
137
+ end
138
+
139
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb:26
140
+ RuboCop::Cop::Performance::BigDecimalWithNumericArgument::MSG = T.let(T.unsafe(nil), String)
141
+
142
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb:27
143
+ RuboCop::Cop::Performance::BigDecimalWithNumericArgument::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
144
+
145
+ # In Ruby 2.7, `UnboundMethod#bind_call` has been added.
146
+ #
147
+ # This cop identifies places where `bind(obj).call(args, ...)`
148
+ # can be replaced by `bind_call(obj, args, ...)`.
149
+ #
150
+ # The `bind_call(obj, args, ...)` method is faster than
151
+ # `bind(obj).call(args, ...)`.
152
+ #
153
+ # @example
154
+ # # bad
155
+ # umethod.bind(obj).call(foo, bar)
156
+ # umethod.bind(obj).(foo, bar)
157
+ #
158
+ # # good
159
+ # umethod.bind_call(obj, foo, bar)
160
+ #
161
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/bind_call.rb:22
162
+ class RuboCop::Cop::Performance::BindCall < ::RuboCop::Cop::Base
163
+ include ::RuboCop::Cop::RangeHelp
164
+ extend ::RuboCop::Cop::AutoCorrector
165
+ extend ::RuboCop::Cop::TargetRubyVersion
166
+
167
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/bind_call.rb:33
168
+ def bind_with_call_method?(param0 = T.unsafe(nil)); end
169
+
170
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/bind_call.rb:41
171
+ def on_send(node); end
172
+
173
+ private
174
+
175
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/bind_call.rb:72
176
+ def build_call_args(call_args_node); end
177
+
178
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/bind_call.rb:65
179
+ def correction_range(receiver, node); end
180
+
181
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/bind_call.rb:59
182
+ def message(bind_arg, call_args); end
183
+ end
184
+
185
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/bind_call.rb:29
186
+ RuboCop::Cop::Performance::BindCall::MSG = T.let(T.unsafe(nil), String)
187
+
188
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/bind_call.rb:31
189
+ RuboCop::Cop::Performance::BindCall::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
190
+
191
+ # Identifies unnecessary use of a `block_given?` where explicit check
192
+ # of block argument would suffice.
193
+ #
194
+ # @example
195
+ # # bad
196
+ # def method(&block)
197
+ # do_something if block_given?
198
+ # end
199
+ #
200
+ # # good
201
+ # def method(&block)
202
+ # do_something if block
203
+ # end
204
+ #
205
+ # # good - block is reassigned
206
+ # def method(&block)
207
+ # block ||= -> { do_something }
208
+ # warn "Using default ..." unless block_given?
209
+ # # ...
210
+ # end
211
+ #
212
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/block_given_with_explicit_block.rb:27
213
+ class RuboCop::Cop::Performance::BlockGivenWithExplicitBlock < ::RuboCop::Cop::Base
214
+ extend ::RuboCop::Cop::AutoCorrector
215
+
216
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/block_given_with_explicit_block.rb:35
217
+ def on_send(node); end
218
+
219
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/block_given_with_explicit_block.rb:33
220
+ def reassigns_block_arg?(param0 = T.unsafe(nil), param1); end
221
+ end
222
+
223
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/block_given_with_explicit_block.rb:31
224
+ RuboCop::Cop::Performance::BlockGivenWithExplicitBlock::MSG = T.let(T.unsafe(nil), String)
225
+
226
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/block_given_with_explicit_block.rb:30
227
+ RuboCop::Cop::Performance::BlockGivenWithExplicitBlock::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
228
+
229
+ # Identifies places where `caller[n]` can be replaced by `caller(n..n).first`.
230
+ #
231
+ # @example
232
+ # # bad
233
+ # caller[1]
234
+ # caller.first
235
+ # caller_locations[1]
236
+ # caller_locations.first
237
+ #
238
+ # # good
239
+ # caller(2..2).first
240
+ # caller(1..1).first
241
+ # caller_locations(2..2).first
242
+ # caller_locations(1..1).first
243
+ #
244
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/caller.rb:20
245
+ class RuboCop::Cop::Performance::Caller < ::RuboCop::Cop::Base
246
+ extend ::RuboCop::Cop::AutoCorrector
247
+
248
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/caller.rb:33
249
+ def caller_with_scope_method?(param0 = T.unsafe(nil)); end
250
+
251
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/caller.rb:40
252
+ def on_send(node); end
253
+
254
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/caller.rb:26
255
+ def slow_caller?(param0 = T.unsafe(nil)); end
256
+
257
+ private
258
+
259
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/caller.rb:61
260
+ def int_value(node); end
261
+ end
262
+
263
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/caller.rb:23
264
+ RuboCop::Cop::Performance::Caller::MSG = T.let(T.unsafe(nil), String)
265
+
266
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/caller.rb:24
267
+ RuboCop::Cop::Performance::Caller::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
268
+
269
+ # Reordering `when` conditions with a splat to the end
270
+ # of the `when` branches can improve performance.
271
+ #
272
+ # Ruby has to allocate memory for the splat expansion every time
273
+ # that the `case` `when` statement is run. Since Ruby does not support
274
+ # fall through inside of `case` `when`, like some other languages do,
275
+ # the order of the `when` branches should not matter. By placing any
276
+ # splat expansions at the end of the list of `when` branches we will
277
+ # reduce the number of times that memory has to be allocated for
278
+ # the expansion. The exception to this is if multiple of your `when`
279
+ # conditions can be true for any given condition. A likely scenario for
280
+ # this defining a higher level when condition to override a condition
281
+ # that is inside of the splat expansion.
282
+ #
283
+ # @example
284
+ # # bad
285
+ # case foo
286
+ # when *condition
287
+ # bar
288
+ # when baz
289
+ # foobar
290
+ # end
291
+ #
292
+ # case foo
293
+ # when *[1, 2, 3, 4]
294
+ # bar
295
+ # when 5
296
+ # baz
297
+ # end
298
+ #
299
+ # # good
300
+ # case foo
301
+ # when baz
302
+ # foobar
303
+ # when *condition
304
+ # bar
305
+ # end
306
+ #
307
+ # case foo
308
+ # when 1, 2, 3, 4
309
+ # bar
310
+ # when 5
311
+ # baz
312
+ # end
313
+ #
314
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/case_when_splat.rb:58
315
+ class RuboCop::Cop::Performance::CaseWhenSplat < ::RuboCop::Cop::Base
316
+ include ::RuboCop::Cop::Alignment
317
+ include ::RuboCop::Cop::RangeHelp
318
+ extend ::RuboCop::Cop::AutoCorrector
319
+
320
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/case_when_splat.rb:66
321
+ def on_case(case_node); end
322
+
323
+ private
324
+
325
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/case_when_splat.rb:83
326
+ def autocorrect(corrector, when_node); end
327
+
328
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/case_when_splat.rb:144
329
+ def indent_for(node); end
330
+
331
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/case_when_splat.rb:100
332
+ def inline_fix_branch(corrector, when_node); end
333
+
334
+ # @return [Boolean]
335
+ #
336
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/case_when_splat.rb:169
337
+ def needs_reorder?(when_node); end
338
+
339
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/case_when_splat.rb:140
340
+ def new_branch_without_then(node, new_condition); end
341
+
342
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/case_when_splat.rb:136
343
+ def new_condition_with_then(node, new_condition); end
344
+
345
+ # @return [Boolean]
346
+ #
347
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/case_when_splat.rb:162
348
+ def non_splat?(condition); end
349
+
350
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/case_when_splat.rb:91
351
+ def range(node); end
352
+
353
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/case_when_splat.rb:108
354
+ def reorder_condition(corrector, when_node); end
355
+
356
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/case_when_splat.rb:118
357
+ def reordering_correction(when_node); end
358
+
359
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/case_when_splat.rb:95
360
+ def replacement(conditions); end
361
+
362
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/case_when_splat.rb:148
363
+ def splat_offenses(when_conditions); end
364
+
365
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/case_when_splat.rb:128
366
+ def when_branch_range(when_node); end
367
+ end
368
+
369
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/case_when_splat.rb:64
370
+ RuboCop::Cop::Performance::CaseWhenSplat::ARRAY_MSG = T.let(T.unsafe(nil), String)
371
+
372
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/case_when_splat.rb:63
373
+ RuboCop::Cop::Performance::CaseWhenSplat::MSG = T.let(T.unsafe(nil), String)
374
+
375
+ # Identifies places where a case-insensitive string comparison
376
+ # can better be implemented using `casecmp`.
377
+ #
378
+ # @example
379
+ # # bad
380
+ # str.downcase == 'abc'
381
+ # str.upcase.eql? 'ABC'
382
+ # 'abc' == str.downcase
383
+ # 'ABC'.eql? str.upcase
384
+ # str.downcase == str.downcase
385
+ #
386
+ # # good
387
+ # str.casecmp('ABC').zero?
388
+ # 'abc'.casecmp(str).zero?
389
+ #
390
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/casecmp.rb:24
391
+ class RuboCop::Cop::Performance::Casecmp < ::RuboCop::Cop::Base
392
+ extend ::RuboCop::Cop::AutoCorrector
393
+
394
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/casecmp.rb:45
395
+ def downcase_downcase(param0 = T.unsafe(nil)); end
396
+
397
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/casecmp.rb:31
398
+ def downcase_eq(param0 = T.unsafe(nil)); end
399
+
400
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/casecmp.rb:38
401
+ def eq_downcase(param0 = T.unsafe(nil)); end
402
+
403
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/casecmp.rb:52
404
+ def on_send(node); end
405
+
406
+ private
407
+
408
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/casecmp.rb:84
409
+ def autocorrect(corrector, node, replacement); end
410
+
411
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/casecmp.rb:88
412
+ def build_good_method(method, arg, variable); end
413
+
414
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/casecmp.rb:67
415
+ def take_method_apart(node); end
416
+ end
417
+
418
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/casecmp.rb:29
419
+ RuboCop::Cop::Performance::Casecmp::CASE_METHODS = T.let(T.unsafe(nil), Array)
420
+
421
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/casecmp.rb:27
422
+ RuboCop::Cop::Performance::Casecmp::MSG = T.let(T.unsafe(nil), String)
423
+
424
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/casecmp.rb:28
425
+ RuboCop::Cop::Performance::Casecmp::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
426
+
427
+ # Identifies usages of `array.compact.flatten.map { |x| x.downcase }`.
428
+ # Each of these methods (`compact`, `flatten`, `map`) will generate a new intermediate array
429
+ # that is promptly thrown away. Instead it is faster to mutate when we know it's safe.
430
+ #
431
+ # @example
432
+ # # bad
433
+ # array = ["a", "b", "c"]
434
+ # array.compact.flatten.map { |x| x.downcase }
435
+ #
436
+ # # good
437
+ # array = ["a", "b", "c"]
438
+ # array.compact!
439
+ # array.flatten!
440
+ # array.map! { |x| x.downcase }
441
+ # array
442
+ #
443
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/chain_array_allocation.rb:21
444
+ class RuboCop::Cop::Performance::ChainArrayAllocation < ::RuboCop::Cop::Base
445
+ include ::RuboCop::Cop::RangeHelp
446
+
447
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/chain_array_allocation.rb:54
448
+ def chain_array_allocation?(param0 = T.unsafe(nil)); end
449
+
450
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/chain_array_allocation.rb:62
451
+ def on_send(node); end
452
+ end
453
+
454
+ # These methods ALWAYS return a new array
455
+ # after they're called it's safe to mutate the the resulting array
456
+ #
457
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/chain_array_allocation.rb:37
458
+ RuboCop::Cop::Performance::ChainArrayAllocation::ALWAYS_RETURNS_NEW_ARRAY = T.let(T.unsafe(nil), Set)
459
+
460
+ # These methods have a mutation alternative. For example :collect
461
+ # can be called as :collect!
462
+ #
463
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/chain_array_allocation.rb:45
464
+ RuboCop::Cop::Performance::ChainArrayAllocation::HAS_MUTATION_ALTERNATIVE = T.let(T.unsafe(nil), Set)
465
+
466
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/chain_array_allocation.rb:50
467
+ RuboCop::Cop::Performance::ChainArrayAllocation::MSG = T.let(T.unsafe(nil), String)
468
+
469
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/chain_array_allocation.rb:48
470
+ RuboCop::Cop::Performance::ChainArrayAllocation::RETURNS_NEW_ARRAY = T.let(T.unsafe(nil), Set)
471
+
472
+ # These methods return a new array only when called without a block.
473
+ #
474
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/chain_array_allocation.rb:33
475
+ RuboCop::Cop::Performance::ChainArrayAllocation::RETURNS_NEW_ARRAY_WHEN_NO_BLOCK = T.let(T.unsafe(nil), Set)
476
+
477
+ # These methods return a new array but only sometimes. They must be
478
+ # called with an argument. For example:
479
+ #
480
+ # [1,2].first # => 1
481
+ # [1,2].first(1) # => [1]
482
+ #
483
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/chain_array_allocation.rb:30
484
+ RuboCop::Cop::Performance::ChainArrayAllocation::RETURN_NEW_ARRAY_WHEN_ARGS = T.let(T.unsafe(nil), Set)
485
+
486
+ # Identifies places where Array and Hash literals are used within loops.
487
+ # It is better to extract them into a local variable or constant
488
+ # to avoid unnecessary allocations on each iteration.
489
+ #
490
+ # You can set the minimum number of elements to consider
491
+ # an offense with `MinSize`.
492
+ #
493
+ # @example
494
+ # # bad
495
+ # users.select do |user|
496
+ # %i[superadmin admin].include?(user.role)
497
+ # end
498
+ #
499
+ # # good
500
+ # admin_roles = %i[superadmin admin]
501
+ # users.select do |user|
502
+ # admin_roles.include?(user.role)
503
+ # end
504
+ #
505
+ # # good
506
+ # ADMIN_ROLES = %i[superadmin admin]
507
+ # ...
508
+ # users.select do |user|
509
+ # ADMIN_ROLES.include?(user.role)
510
+ # end
511
+ #
512
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/collection_literal_in_loop.rb:34
513
+ class RuboCop::Cop::Performance::CollectionLiteralInLoop < ::RuboCop::Cop::Base
514
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/collection_literal_in_loop.rb:74
515
+ def enumerable_loop?(param0 = T.unsafe(nil)); end
516
+
517
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/collection_literal_in_loop.rb:68
518
+ def kernel_loop?(param0 = T.unsafe(nil)); end
519
+
520
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/collection_literal_in_loop.rb:80
521
+ def on_send(node); end
522
+
523
+ private
524
+
525
+ # @return [Boolean]
526
+ #
527
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/collection_literal_in_loop.rb:90
528
+ def check_literal?(node, method); end
529
+
530
+ # @return [Boolean]
531
+ #
532
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/collection_literal_in_loop.rb:130
533
+ def enumerable_method?(method_name); end
534
+
535
+ # @return [Boolean]
536
+ #
537
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/collection_literal_in_loop.rb:112
538
+ def keyword_loop?(type); end
539
+
540
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/collection_literal_in_loop.rb:122
541
+ def literal_class(node); end
542
+
543
+ # @return [Boolean]
544
+ #
545
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/collection_literal_in_loop.rb:106
546
+ def loop?(ancestor, node); end
547
+
548
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/collection_literal_in_loop.rb:134
549
+ def min_size; end
550
+
551
+ # @return [Boolean]
552
+ #
553
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/collection_literal_in_loop.rb:116
554
+ def node_within_enumerable_loop?(node, ancestor); end
555
+
556
+ # @return [Boolean]
557
+ #
558
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/collection_literal_in_loop.rb:97
559
+ def nonmutable_method_of_array_or_hash?(node, method); end
560
+
561
+ # @return [Boolean]
562
+ #
563
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/collection_literal_in_loop.rb:102
564
+ def parent_is_loop?(node); end
565
+ end
566
+
567
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/collection_literal_in_loop.rb:56
568
+ RuboCop::Cop::Performance::CollectionLiteralInLoop::ARRAY_METHODS = T.let(T.unsafe(nil), Set)
569
+
570
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/collection_literal_in_loop.rb:41
571
+ RuboCop::Cop::Performance::CollectionLiteralInLoop::ENUMERABLE_METHOD_NAMES = T.let(T.unsafe(nil), Set)
572
+
573
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/collection_literal_in_loop.rb:66
574
+ RuboCop::Cop::Performance::CollectionLiteralInLoop::HASH_METHODS = T.let(T.unsafe(nil), Set)
575
+
576
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/collection_literal_in_loop.rb:39
577
+ RuboCop::Cop::Performance::CollectionLiteralInLoop::LOOP_TYPES = T.let(T.unsafe(nil), Array)
578
+
579
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/collection_literal_in_loop.rb:35
580
+ RuboCop::Cop::Performance::CollectionLiteralInLoop::MSG = T.let(T.unsafe(nil), String)
581
+
582
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/collection_literal_in_loop.rb:42
583
+ RuboCop::Cop::Performance::CollectionLiteralInLoop::NONMUTATING_ARRAY_METHODS = T.let(T.unsafe(nil), Array)
584
+
585
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/collection_literal_in_loop.rb:58
586
+ RuboCop::Cop::Performance::CollectionLiteralInLoop::NONMUTATING_HASH_METHODS = T.let(T.unsafe(nil), Array)
587
+
588
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/collection_literal_in_loop.rb:38
589
+ RuboCop::Cop::Performance::CollectionLiteralInLoop::POST_CONDITION_LOOP_TYPES = T.let(T.unsafe(nil), Array)
590
+
591
+ # Identifies places where `sort { |a, b| a.foo <=> b.foo }`
592
+ # can be replaced by `sort_by(&:foo)`.
593
+ # This cop also checks `max` and `min` methods.
594
+ #
595
+ # @example
596
+ # # bad
597
+ # array.sort { |a, b| a.foo <=> b.foo }
598
+ # array.max { |a, b| a.foo <=> b.foo }
599
+ # array.min { |a, b| a.foo <=> b.foo }
600
+ # array.sort { |a, b| a[:foo] <=> b[:foo] }
601
+ #
602
+ # # good
603
+ # array.sort_by(&:foo)
604
+ # array.sort_by { |v| v.foo }
605
+ # array.sort_by do |var|
606
+ # var.foo
607
+ # end
608
+ # array.max_by(&:foo)
609
+ # array.min_by(&:foo)
610
+ # array.sort_by { |a| a[:foo] }
611
+ #
612
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/compare_with_block.rb:26
613
+ class RuboCop::Cop::Performance::CompareWithBlock < ::RuboCop::Cop::Base
614
+ include ::RuboCop::Cop::RangeHelp
615
+ extend ::RuboCop::Cop::AutoCorrector
616
+
617
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/compare_with_block.rb:34
618
+ def compare?(param0 = T.unsafe(nil)); end
619
+
620
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/compare_with_block.rb:48
621
+ def on_block(node); end
622
+
623
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/compare_with_block.rb:41
624
+ def replaceable_body?(param0 = T.unsafe(nil), param1, param2); end
625
+
626
+ private
627
+
628
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/compare_with_block.rb:105
629
+ def compare_range(send, node); end
630
+
631
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/compare_with_block.rb:84
632
+ def message(send, method, var_a, var_b, args); end
633
+
634
+ # @return [Boolean]
635
+ #
636
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/compare_with_block.rb:69
637
+ def slow_compare?(method, args_a, args_b); end
638
+ end
639
+
640
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/compare_with_block.rb:30
641
+ RuboCop::Cop::Performance::CompareWithBlock::MSG = T.let(T.unsafe(nil), String)
642
+
643
+ # Identifies places where `Concurrent.monotonic_time`
644
+ # can be replaced by `Process.clock_gettime(Process::CLOCK_MONOTONIC)`.
645
+ #
646
+ # @example
647
+ #
648
+ # # bad
649
+ # Concurrent.monotonic_time
650
+ #
651
+ # # good
652
+ # Process.clock_gettime(Process::CLOCK_MONOTONIC)
653
+ #
654
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/concurrent_monotonic_time.rb:17
655
+ class RuboCop::Cop::Performance::ConcurrentMonotonicTime < ::RuboCop::Cop::Base
656
+ extend ::RuboCop::Cop::AutoCorrector
657
+
658
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/concurrent_monotonic_time.rb:23
659
+ def concurrent_monotonic_time?(param0 = T.unsafe(nil)); end
660
+
661
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/concurrent_monotonic_time.rb:28
662
+ def on_send(node); end
663
+ end
664
+
665
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/concurrent_monotonic_time.rb:20
666
+ RuboCop::Cop::Performance::ConcurrentMonotonicTime::MSG = T.let(T.unsafe(nil), String)
667
+
668
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/concurrent_monotonic_time.rb:21
669
+ RuboCop::Cop::Performance::ConcurrentMonotonicTime::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
670
+
671
+ # Finds regular expressions with dynamic components that are all constants.
672
+ #
673
+ # Ruby allocates a new Regexp object every time it executes a code containing such
674
+ # a regular expression. It is more efficient to extract it into a constant,
675
+ # memoize it, or add an `/o` option to perform `#{}` interpolation only once and
676
+ # reuse that Regexp object.
677
+ #
678
+ # @example
679
+ #
680
+ # # bad
681
+ # def tokens(pattern)
682
+ # pattern.scan(TOKEN).reject { |token| token.match?(/\A#{SEPARATORS}\Z/) }
683
+ # end
684
+ #
685
+ # # good
686
+ # ALL_SEPARATORS = /\A#{SEPARATORS}\Z/
687
+ # def tokens(pattern)
688
+ # pattern.scan(TOKEN).reject { |token| token.match?(ALL_SEPARATORS) }
689
+ # end
690
+ #
691
+ # # good
692
+ # def tokens(pattern)
693
+ # pattern.scan(TOKEN).reject { |token| token.match?(/\A#{SEPARATORS}\Z/o) }
694
+ # end
695
+ #
696
+ # # good
697
+ # def separators
698
+ # @separators ||= /\A#{SEPARATORS}\Z/
699
+ # end
700
+ #
701
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/constant_regexp.rb:36
702
+ class RuboCop::Cop::Performance::ConstantRegexp < ::RuboCop::Cop::Base
703
+ extend ::RuboCop::Cop::AutoCorrector
704
+
705
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/constant_regexp.rb:41
706
+ def on_regexp(node); end
707
+
708
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/constant_regexp.rb:57
709
+ def regexp_escape?(param0 = T.unsafe(nil)); end
710
+
711
+ private
712
+
713
+ # @return [Boolean]
714
+ #
715
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/constant_regexp.rb:62
716
+ def include_interpolated_const?(node); end
717
+
718
+ # @return [Boolean]
719
+ #
720
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/constant_regexp.rb:53
721
+ def within_allowed_assignment?(node); end
722
+ end
723
+
724
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/constant_regexp.rb:39
725
+ RuboCop::Cop::Performance::ConstantRegexp::MSG = T.let(T.unsafe(nil), String)
726
+
727
+ # Identifies usages of `count` on an `Enumerable` that
728
+ # follow calls to `select`, `find_all`, `filter` or `reject`. Querying logic can instead be
729
+ # passed to the `count` call.
730
+ #
731
+ # @example
732
+ # # bad
733
+ # [1, 2, 3].select { |e| e > 2 }.size
734
+ # [1, 2, 3].reject { |e| e > 2 }.size
735
+ # [1, 2, 3].select { |e| e > 2 }.length
736
+ # [1, 2, 3].reject { |e| e > 2 }.length
737
+ # [1, 2, 3].select { |e| e > 2 }.count { |e| e.odd? }
738
+ # [1, 2, 3].reject { |e| e > 2 }.count { |e| e.even? }
739
+ # array.select(&:value).count
740
+ #
741
+ # # good
742
+ # [1, 2, 3].count { |e| e > 2 }
743
+ # [1, 2, 3].count { |e| e < 2 }
744
+ # [1, 2, 3].count { |e| e > 2 && e.odd? }
745
+ # [1, 2, 3].count { |e| e < 2 && e.even? }
746
+ # Model.select('field AS field_one').count
747
+ # Model.select(:value).count
748
+ #
749
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/count.rb:49
750
+ class RuboCop::Cop::Performance::Count < ::RuboCop::Cop::Base
751
+ include ::RuboCop::Cop::RangeHelp
752
+ extend ::RuboCop::Cop::AutoCorrector
753
+
754
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/count.rb:56
755
+ def count_candidate?(param0 = T.unsafe(nil)); end
756
+
757
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/count.rb:63
758
+ def on_send(node); end
759
+
760
+ private
761
+
762
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/count.rb:79
763
+ def autocorrect(corrector, node, selector_node, selector); end
764
+
765
+ # @return [Boolean]
766
+ #
767
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/count.rb:90
768
+ def eligible_node?(node); end
769
+
770
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/count.rb:94
771
+ def source_starting_at(node); end
772
+ end
773
+
774
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/count.rb:53
775
+ RuboCop::Cop::Performance::Count::MSG = T.let(T.unsafe(nil), String)
776
+
777
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/count.rb:54
778
+ RuboCop::Cop::Performance::Count::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
779
+
780
+ # In Ruby 2.5, `String#delete_prefix` has been added.
781
+ #
782
+ # This cop identifies places where `gsub(/\Aprefix/, '')` and `sub(/\Aprefix/, '')`
783
+ # can be replaced by `delete_prefix('prefix')`.
784
+ #
785
+ # This cop has `SafeMultiline` configuration option that `true` by default because
786
+ # `^prefix` is unsafe as it will behave incompatible with `delete_prefix`
787
+ # for receiver is multiline string.
788
+ #
789
+ # The `delete_prefix('prefix')` method is faster than `gsub(/\Aprefix/, '')`.
790
+ #
791
+ # @example
792
+ #
793
+ # # bad
794
+ # str.gsub(/\Aprefix/, '')
795
+ # str.gsub!(/\Aprefix/, '')
796
+ #
797
+ # str.sub(/\Aprefix/, '')
798
+ # str.sub!(/\Aprefix/, '')
799
+ #
800
+ # # good
801
+ # str.delete_prefix('prefix')
802
+ # str.delete_prefix!('prefix')
803
+ # @example SafeMultiline: true (default)
804
+ #
805
+ # # good
806
+ # str.gsub(/^prefix/, '')
807
+ # str.gsub!(/^prefix/, '')
808
+ # str.sub(/^prefix/, '')
809
+ # str.sub!(/^prefix/, '')
810
+ # @example SafeMultiline: false
811
+ #
812
+ # # bad
813
+ # str.gsub(/^prefix/, '')
814
+ # str.gsub!(/^prefix/, '')
815
+ # str.sub(/^prefix/, '')
816
+ # str.sub!(/^prefix/, '')
817
+ #
818
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/delete_prefix.rb:49
819
+ class RuboCop::Cop::Performance::DeletePrefix < ::RuboCop::Cop::Base
820
+ include ::RuboCop::Cop::RegexpMetacharacter
821
+ extend ::RuboCop::Cop::AutoCorrector
822
+ extend ::RuboCop::Cop::TargetRubyVersion
823
+
824
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/delete_prefix.rb:66
825
+ def delete_prefix_candidate?(param0 = T.unsafe(nil)); end
826
+
827
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/delete_prefix.rb:70
828
+ def on_send(node); end
829
+ end
830
+
831
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/delete_prefix.rb:56
832
+ RuboCop::Cop::Performance::DeletePrefix::MSG = T.let(T.unsafe(nil), String)
833
+
834
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/delete_prefix.rb:59
835
+ RuboCop::Cop::Performance::DeletePrefix::PREFERRED_METHODS = T.let(T.unsafe(nil), Hash)
836
+
837
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/delete_prefix.rb:57
838
+ RuboCop::Cop::Performance::DeletePrefix::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
839
+
840
+ # In Ruby 2.5, `String#delete_suffix` has been added.
841
+ #
842
+ # This cop identifies places where `gsub(/suffix\z/, '')` and `sub(/suffix\z/, '')`
843
+ # can be replaced by `delete_suffix('suffix')`.
844
+ #
845
+ # This cop has `SafeMultiline` configuration option that `true` by default because
846
+ # `suffix$` is unsafe as it will behave incompatible with `delete_suffix?`
847
+ # for receiver is multiline string.
848
+ #
849
+ # The `delete_suffix('suffix')` method is faster than `gsub(/suffix\z/, '')`.
850
+ #
851
+ # @example
852
+ #
853
+ # # bad
854
+ # str.gsub(/suffix\z/, '')
855
+ # str.gsub!(/suffix\z/, '')
856
+ #
857
+ # str.sub(/suffix\z/, '')
858
+ # str.sub!(/suffix\z/, '')
859
+ #
860
+ # # good
861
+ # str.delete_suffix('suffix')
862
+ # str.delete_suffix!('suffix')
863
+ # @example SafeMultiline: true (default)
864
+ #
865
+ # # good
866
+ # str.gsub(/suffix$/, '')
867
+ # str.gsub!(/suffix$/, '')
868
+ # str.sub(/suffix$/, '')
869
+ # str.sub!(/suffix$/, '')
870
+ # @example SafeMultiline: false
871
+ #
872
+ # # bad
873
+ # str.gsub(/suffix$/, '')
874
+ # str.gsub!(/suffix$/, '')
875
+ # str.sub(/suffix$/, '')
876
+ # str.sub!(/suffix$/, '')
877
+ #
878
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/delete_suffix.rb:49
879
+ class RuboCop::Cop::Performance::DeleteSuffix < ::RuboCop::Cop::Base
880
+ include ::RuboCop::Cop::RegexpMetacharacter
881
+ extend ::RuboCop::Cop::AutoCorrector
882
+ extend ::RuboCop::Cop::TargetRubyVersion
883
+
884
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/delete_suffix.rb:66
885
+ def delete_suffix_candidate?(param0 = T.unsafe(nil)); end
886
+
887
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/delete_suffix.rb:70
888
+ def on_send(node); end
889
+ end
890
+
891
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/delete_suffix.rb:56
892
+ RuboCop::Cop::Performance::DeleteSuffix::MSG = T.let(T.unsafe(nil), String)
893
+
894
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/delete_suffix.rb:59
895
+ RuboCop::Cop::Performance::DeleteSuffix::PREFERRED_METHODS = T.let(T.unsafe(nil), Hash)
896
+
897
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/delete_suffix.rb:57
898
+ RuboCop::Cop::Performance::DeleteSuffix::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
899
+
900
+ # Identifies usages of `first`, `last`, `[0]` or `[-1]`
901
+ # chained to `select`, `find_all` or `filter` and change them to use
902
+ # `detect` instead.
903
+ #
904
+ # @example
905
+ # # bad
906
+ # [].select { |item| true }.first
907
+ # [].select { |item| true }.last
908
+ # [].find_all { |item| true }.first
909
+ # [].find_all { |item| true }.last
910
+ # [].filter { |item| true }.first
911
+ # [].filter { |item| true }.last
912
+ # [].filter { |item| true }[0]
913
+ # [].filter { |item| true }[-1]
914
+ #
915
+ # # good
916
+ # [].detect { |item| true }
917
+ # [].reverse.detect { |item| true }
918
+ #
919
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/detect.rb:30
920
+ class RuboCop::Cop::Performance::Detect < ::RuboCop::Cop::Base
921
+ extend ::RuboCop::Cop::AutoCorrector
922
+
923
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/detect.rb:41
924
+ def detect_candidate?(param0 = T.unsafe(nil)); end
925
+
926
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/detect.rb:50
927
+ def on_send(node); end
928
+
929
+ private
930
+
931
+ # @return [Boolean]
932
+ #
933
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/detect.rb:69
934
+ def accept_first_call?(receiver, body); end
935
+
936
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/detect.rb:101
937
+ def autocorrect(corrector, node, replacement); end
938
+
939
+ # @return [Boolean]
940
+ #
941
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/detect.rb:127
942
+ def lazy?(node); end
943
+
944
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/detect.rb:112
945
+ def message_for_method(method, index); end
946
+
947
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/detect.rb:123
948
+ def preferred_method; end
949
+
950
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/detect.rb:78
951
+ def register_offense(node, receiver, second_method, index); end
952
+
953
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/detect.rb:93
954
+ def replacement(method, index); end
955
+ end
956
+
957
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/detect.rb:33
958
+ RuboCop::Cop::Performance::Detect::CANDIDATE_METHODS = T.let(T.unsafe(nil), Set)
959
+
960
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/detect.rb:37
961
+ RuboCop::Cop::Performance::Detect::INDEX_MSG = T.let(T.unsafe(nil), String)
962
+
963
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/detect.rb:38
964
+ RuboCop::Cop::Performance::Detect::INDEX_REVERSE_MSG = T.let(T.unsafe(nil), String)
965
+
966
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/detect.rb:35
967
+ RuboCop::Cop::Performance::Detect::MSG = T.let(T.unsafe(nil), String)
968
+
969
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/detect.rb:39
970
+ RuboCop::Cop::Performance::Detect::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
971
+
972
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/detect.rb:36
973
+ RuboCop::Cop::Performance::Detect::REVERSE_MSG = T.let(T.unsafe(nil), String)
974
+
975
+ # Checks for double `#start_with?` or `#end_with?` calls
976
+ # separated by `||`. In some cases such calls can be replaced
977
+ # with an single `#start_with?`/`#end_with?` call.
978
+ #
979
+ # `IncludeActiveSupportAliases` configuration option is used to check for
980
+ # `starts_with?` and `ends_with?`. These methods are defined by Active Support.
981
+ #
982
+ # @example
983
+ # # bad
984
+ # str.start_with?("a") || str.start_with?(Some::CONST)
985
+ # str.start_with?("a", "b") || str.start_with?("c")
986
+ # str.end_with?(var1) || str.end_with?(var2)
987
+ #
988
+ # # good
989
+ # str.start_with?("a", Some::CONST)
990
+ # str.start_with?("a", "b", "c")
991
+ # str.end_with?(var1, var2)
992
+ # @example IncludeActiveSupportAliases: false (default)
993
+ # # good
994
+ # str.starts_with?("a", "b") || str.starts_with?("c")
995
+ # str.ends_with?(var1) || str.ends_with?(var2)
996
+ #
997
+ # str.starts_with?("a", "b", "c")
998
+ # str.ends_with?(var1, var2)
999
+ # @example IncludeActiveSupportAliases: true
1000
+ # # bad
1001
+ # str.starts_with?("a", "b") || str.starts_with?("c")
1002
+ # str.ends_with?(var1) || str.ends_with?(var2)
1003
+ #
1004
+ # # good
1005
+ # str.starts_with?("a", "b", "c")
1006
+ # str.ends_with?(var1, var2)
1007
+ #
1008
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/double_start_end_with.rb:41
1009
+ class RuboCop::Cop::Performance::DoubleStartEndWith < ::RuboCop::Cop::Base
1010
+ extend ::RuboCop::Cop::AutoCorrector
1011
+
1012
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/double_start_end_with.rb:97
1013
+ def check_with_active_support_aliases(param0 = T.unsafe(nil)); end
1014
+
1015
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/double_start_end_with.rb:47
1016
+ def on_or(node); end
1017
+
1018
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/double_start_end_with.rb:91
1019
+ def two_start_end_with_calls(param0 = T.unsafe(nil)); end
1020
+
1021
+ private
1022
+
1023
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/double_start_end_with.rb:61
1024
+ def autocorrect(corrector, first_call_args, second_call_args, combined_args); end
1025
+
1026
+ # @return [Boolean]
1027
+ #
1028
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/double_start_end_with.rb:87
1029
+ def check_for_active_support_aliases?; end
1030
+
1031
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/double_start_end_with.rb:83
1032
+ def combine_args(first_call_args, second_call_args); end
1033
+
1034
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/double_start_end_with.rb:77
1035
+ def message(node, receiver, method, combined_args); end
1036
+
1037
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/double_start_end_with.rb:69
1038
+ def process_source(node); end
1039
+ end
1040
+
1041
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/double_start_end_with.rb:44
1042
+ RuboCop::Cop::Performance::DoubleStartEndWith::MSG = T.let(T.unsafe(nil), String)
1043
+
1044
+ # Identifies unnecessary use of a regex where `String#end_with?` would suffice.
1045
+ #
1046
+ # This cop has `SafeMultiline` configuration option that `true` by default because
1047
+ # `end$` is unsafe as it will behave incompatible with `end_with?`
1048
+ # for receiver is multiline string.
1049
+ #
1050
+ # @example
1051
+ # # bad
1052
+ # 'abc'.match?(/bc\Z/)
1053
+ # /bc\Z/.match?('abc')
1054
+ # 'abc' =~ /bc\Z/
1055
+ # /bc\Z/ =~ 'abc'
1056
+ # 'abc'.match(/bc\Z/)
1057
+ # /bc\Z/.match('abc')
1058
+ #
1059
+ # # good
1060
+ # 'abc'.end_with?('bc')
1061
+ # @example SafeMultiline: true (default)
1062
+ #
1063
+ # # good
1064
+ # 'abc'.match?(/bc$/)
1065
+ # /bc$/.match?('abc')
1066
+ # 'abc' =~ /bc$/
1067
+ # /bc$/ =~ 'abc'
1068
+ # 'abc'.match(/bc$/)
1069
+ # /bc$/.match('abc')
1070
+ # @example SafeMultiline: false
1071
+ #
1072
+ # # bad
1073
+ # 'abc'.match?(/bc$/)
1074
+ # /bc$/.match?('abc')
1075
+ # 'abc' =~ /bc$/
1076
+ # /bc$/ =~ 'abc'
1077
+ # 'abc'.match(/bc$/)
1078
+ # /bc$/.match('abc')
1079
+ #
1080
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/end_with.rb:49
1081
+ class RuboCop::Cop::Performance::EndWith < ::RuboCop::Cop::Base
1082
+ include ::RuboCop::Cop::RegexpMetacharacter
1083
+ extend ::RuboCop::Cop::AutoCorrector
1084
+
1085
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/end_with.rb:63
1086
+ def on_match_with_lvasgn(node); end
1087
+
1088
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/end_with.rb:63
1089
+ def on_send(node); end
1090
+
1091
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/end_with.rb:57
1092
+ def redundant_regex?(param0 = T.unsafe(nil)); end
1093
+ end
1094
+
1095
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/end_with.rb:53
1096
+ RuboCop::Cop::Performance::EndWith::MSG = T.let(T.unsafe(nil), String)
1097
+
1098
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/end_with.rb:55
1099
+ RuboCop::Cop::Performance::EndWith::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
1100
+
1101
+ # Do not compute the size of statically sized objects.
1102
+ #
1103
+ # @example
1104
+ # # String methods
1105
+ # # bad
1106
+ # 'foo'.size
1107
+ # %q[bar].count
1108
+ # %(qux).length
1109
+ #
1110
+ # # Symbol methods
1111
+ # # bad
1112
+ # :fred.size
1113
+ # :'baz'.length
1114
+ #
1115
+ # # Array methods
1116
+ # # bad
1117
+ # [1, 2, thud].count
1118
+ # %W(1, 2, bar).size
1119
+ #
1120
+ # # Hash methods
1121
+ # # bad
1122
+ # { a: corge, b: grault }.length
1123
+ #
1124
+ # # good
1125
+ # foo.size
1126
+ # bar.count
1127
+ # qux.length
1128
+ #
1129
+ # # good
1130
+ # :"#{fred}".size
1131
+ # CONST = :baz.length
1132
+ #
1133
+ # # good
1134
+ # [1, 2, *thud].count
1135
+ # garply = [1, 2, 3]
1136
+ # garply.size
1137
+ #
1138
+ # # good
1139
+ # { a: corge, **grault }.length
1140
+ # waldo = { a: corge, b: grault }
1141
+ # waldo.size
1142
+ #
1143
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/fixed_size.rb:48
1144
+ class RuboCop::Cop::Performance::FixedSize < ::RuboCop::Cop::Base
1145
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/fixed_size.rb:52
1146
+ def counter(param0 = T.unsafe(nil)); end
1147
+
1148
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/fixed_size.rb:56
1149
+ def on_send(node); end
1150
+
1151
+ private
1152
+
1153
+ # @return [Boolean]
1154
+ #
1155
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/fixed_size.rb:72
1156
+ def allowed_argument?(arg); end
1157
+
1158
+ # @return [Boolean]
1159
+ #
1160
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/fixed_size.rb:76
1161
+ def allowed_parent?(node); end
1162
+
1163
+ # @return [Boolean]
1164
+ #
1165
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/fixed_size.rb:68
1166
+ def allowed_variable?(var); end
1167
+
1168
+ # @return [Boolean]
1169
+ #
1170
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/fixed_size.rb:86
1171
+ def contains_double_splat?(node); end
1172
+
1173
+ # @return [Boolean]
1174
+ #
1175
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/fixed_size.rb:80
1176
+ def contains_splat?(node); end
1177
+
1178
+ # @return [Boolean]
1179
+ #
1180
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/fixed_size.rb:92
1181
+ def non_string_argument?(node); end
1182
+ end
1183
+
1184
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/fixed_size.rb:49
1185
+ RuboCop::Cop::Performance::FixedSize::MSG = T.let(T.unsafe(nil), String)
1186
+
1187
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/fixed_size.rb:50
1188
+ RuboCop::Cop::Performance::FixedSize::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
1189
+
1190
+ # Identifies usages of `map { ... }.flatten` and
1191
+ # change them to use `flat_map { ... }` instead.
1192
+ #
1193
+ # @example
1194
+ # # bad
1195
+ # [1, 2, 3, 4].map { |e| [e, e] }.flatten(1)
1196
+ # [1, 2, 3, 4].collect { |e| [e, e] }.flatten(1)
1197
+ #
1198
+ # # good
1199
+ # [1, 2, 3, 4].flat_map { |e| [e, e] }
1200
+ # [1, 2, 3, 4].map { |e| [e, e] }.flatten
1201
+ # [1, 2, 3, 4].collect { |e| [e, e] }.flatten
1202
+ #
1203
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/flat_map.rb:18
1204
+ class RuboCop::Cop::Performance::FlatMap < ::RuboCop::Cop::Base
1205
+ include ::RuboCop::Cop::RangeHelp
1206
+ extend ::RuboCop::Cop::AutoCorrector
1207
+
1208
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/flat_map.rb:28
1209
+ def flat_map_candidate?(param0 = T.unsafe(nil)); end
1210
+
1211
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/flat_map.rb:39
1212
+ def on_send(node); end
1213
+
1214
+ private
1215
+
1216
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/flat_map.rb:71
1217
+ def autocorrect(corrector, node); end
1218
+
1219
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/flat_map.rb:52
1220
+ def offense_for_levels(node, map_node, first_method, flatten); end
1221
+
1222
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/flat_map.rb:58
1223
+ def offense_for_method(node, map_node, first_method, flatten); end
1224
+
1225
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/flat_map.rb:62
1226
+ def register_offense(node, map_node, first_method, flatten, message); end
1227
+ end
1228
+
1229
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/flat_map.rb:24
1230
+ RuboCop::Cop::Performance::FlatMap::FLATTEN_MULTIPLE_LEVELS = T.let(T.unsafe(nil), String)
1231
+
1232
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/flat_map.rb:22
1233
+ RuboCop::Cop::Performance::FlatMap::MSG = T.let(T.unsafe(nil), String)
1234
+
1235
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/flat_map.rb:23
1236
+ RuboCop::Cop::Performance::FlatMap::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
1237
+
1238
+ # Checks for inefficient searching of keys and values within
1239
+ # hashes.
1240
+ #
1241
+ # `Hash#keys.include?` is less efficient than `Hash#key?` because
1242
+ # the former allocates a new array and then performs an O(n) search
1243
+ # through that array, while `Hash#key?` does not allocate any array and
1244
+ # performs a faster O(1) search for the key.
1245
+ #
1246
+ # `Hash#values.include?` is less efficient than `Hash#value?`. While they
1247
+ # both perform an O(n) search through all of the values, calling `values`
1248
+ # allocates a new array while using `value?` does not.
1249
+ #
1250
+ # @example
1251
+ # # bad
1252
+ # { a: 1, b: 2 }.keys.include?(:a)
1253
+ # { a: 1, b: 2 }.keys.include?(:z)
1254
+ # h = { a: 1, b: 2 }; h.keys.include?(100)
1255
+ #
1256
+ # # good
1257
+ # { a: 1, b: 2 }.key?(:a)
1258
+ # { a: 1, b: 2 }.has_key?(:z)
1259
+ # h = { a: 1, b: 2 }; h.key?(100)
1260
+ #
1261
+ # # bad
1262
+ # { a: 1, b: 2 }.values.include?(2)
1263
+ # { a: 1, b: 2 }.values.include?('garbage')
1264
+ # h = { a: 1, b: 2 }; h.values.include?(nil)
1265
+ #
1266
+ # # good
1267
+ # { a: 1, b: 2 }.value?(2)
1268
+ # { a: 1, b: 2 }.has_value?('garbage')
1269
+ # h = { a: 1, b: 2 }; h.value?(nil)
1270
+ #
1271
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/inefficient_hash_search.rb:42
1272
+ class RuboCop::Cop::Performance::InefficientHashSearch < ::RuboCop::Cop::Base
1273
+ extend ::RuboCop::Cop::AutoCorrector
1274
+
1275
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/inefficient_hash_search.rb:47
1276
+ def inefficient_include?(param0 = T.unsafe(nil)); end
1277
+
1278
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/inefficient_hash_search.rb:51
1279
+ def on_send(node); end
1280
+
1281
+ private
1282
+
1283
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/inefficient_hash_search.rb:91
1284
+ def autocorrect_argument(node); end
1285
+
1286
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/inefficient_hash_search.rb:95
1287
+ def autocorrect_hash_expression(node); end
1288
+
1289
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/inefficient_hash_search.rb:73
1290
+ def autocorrect_method(node); end
1291
+
1292
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/inefficient_hash_search.rb:80
1293
+ def current_method(node); end
1294
+
1295
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/inefficient_hash_search.rb:69
1296
+ def message(node); end
1297
+
1298
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/inefficient_hash_search.rb:84
1299
+ def use_long_method; end
1300
+ end
1301
+
1302
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/inefficient_hash_search.rb:45
1303
+ RuboCop::Cop::Performance::InefficientHashSearch::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
1304
+
1305
+ # Identifies places where inefficient `readlines` method
1306
+ # can be replaced by `each_line` to avoid fully loading file content into memory.
1307
+ #
1308
+ # @example
1309
+ #
1310
+ # # bad
1311
+ # File.readlines('testfile').each { |l| puts l }
1312
+ # IO.readlines('testfile', chomp: true).each { |l| puts l }
1313
+ #
1314
+ # conn.readlines(10).map { |l| l.size }
1315
+ # file.readlines.find { |l| l.start_with?('#') }
1316
+ # file.readlines.each { |l| puts l }
1317
+ #
1318
+ # # good
1319
+ # File.open('testfile', 'r').each_line { |l| puts l }
1320
+ # IO.open('testfile').each_line(chomp: true) { |l| puts l }
1321
+ #
1322
+ # conn.each_line(10).map { |l| l.size }
1323
+ # file.each_line.find { |l| l.start_with?('#') }
1324
+ # file.each_line { |l| puts l }
1325
+ #
1326
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/io_readlines.rb:27
1327
+ class RuboCop::Cop::Performance::IoReadlines < ::RuboCop::Cop::Base
1328
+ include ::RuboCop::Cop::RangeHelp
1329
+ extend ::RuboCop::Cop::AutoCorrector
1330
+
1331
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/io_readlines.rb:42
1332
+ def on_send(node); end
1333
+
1334
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/io_readlines.rb:34
1335
+ def readlines_on_class?(param0 = T.unsafe(nil)); end
1336
+
1337
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/io_readlines.rb:38
1338
+ def readlines_on_instance?(param0 = T.unsafe(nil)); end
1339
+
1340
+ private
1341
+
1342
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/io_readlines.rb:58
1343
+ def autocorrect(corrector, enumerable_call, readlines_call, receiver); end
1344
+
1345
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/io_readlines.rb:90
1346
+ def build_bad_method(enumerable_call); end
1347
+
1348
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/io_readlines.rb:106
1349
+ def build_call_args(call_args_node); end
1350
+
1351
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/io_readlines.rb:82
1352
+ def build_good_method(enumerable_call); end
1353
+
1354
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/io_readlines.rb:94
1355
+ def correction_range(enumerable_call, readlines_call); end
1356
+
1357
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/io_readlines.rb:76
1358
+ def offense_range(enumerable_call, readlines_call); end
1359
+ end
1360
+
1361
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/io_readlines.rb:31
1362
+ RuboCop::Cop::Performance::IoReadlines::MSG = T.let(T.unsafe(nil), String)
1363
+
1364
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/io_readlines.rb:32
1365
+ RuboCop::Cop::Performance::IoReadlines::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
1366
+
1367
+ # In Ruby 2.7, `Enumerable#filter_map` has been added.
1368
+ #
1369
+ # This cop identifies places where `map { ... }.compact` can be replaced by `filter_map`.
1370
+ #
1371
+ # [source,ruby]
1372
+ # ----
1373
+ # [true, false, nil].compact #=> [true, false]
1374
+ # [true, false, nil].filter_map(&:itself) #=> [true]
1375
+ # ----
1376
+ #
1377
+ # @example
1378
+ # # bad
1379
+ # ary.map(&:foo).compact
1380
+ # ary.collect(&:foo).compact
1381
+ #
1382
+ # # good
1383
+ # ary.filter_map(&:foo)
1384
+ # ary.map(&:foo).compact!
1385
+ # ary.compact.map(&:foo)
1386
+ #
1387
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/map_compact.rb:30
1388
+ class RuboCop::Cop::Performance::MapCompact < ::RuboCop::Cop::Base
1389
+ include ::RuboCop::Cop::RangeHelp
1390
+ extend ::RuboCop::Cop::AutoCorrector
1391
+ extend ::RuboCop::Cop::TargetRubyVersion
1392
+
1393
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/map_compact.rb:40
1394
+ def map_compact(param0 = T.unsafe(nil)); end
1395
+
1396
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/map_compact.rb:53
1397
+ def on_send(node); end
1398
+
1399
+ private
1400
+
1401
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/map_compact.rb:89
1402
+ def compact_method_with_final_newline_range(compact_method_range); end
1403
+
1404
+ # @return [Boolean]
1405
+ #
1406
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/map_compact.rb:85
1407
+ def invoke_method_after_map_compact_on_same_line?(compact_node, chained_method); end
1408
+
1409
+ # @return [Boolean]
1410
+ #
1411
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/map_compact.rb:81
1412
+ def map_method_and_compact_method_on_same_line?(map_node, compact_node); end
1413
+
1414
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/map_compact.rb:67
1415
+ def remove_compact_method(corrector, map_node, compact_node, chained_method); end
1416
+ end
1417
+
1418
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/map_compact.rb:35
1419
+ RuboCop::Cop::Performance::MapCompact::MSG = T.let(T.unsafe(nil), String)
1420
+
1421
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/map_compact.rb:36
1422
+ RuboCop::Cop::Performance::MapCompact::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
1423
+
1424
+ # Identifies places where methods are converted to blocks, with the
1425
+ # use of `&method`, and passed as arguments to method calls.
1426
+ # It is faster to replace those with explicit blocks, calling those methods inside.
1427
+ #
1428
+ # @example
1429
+ # # bad
1430
+ # array.map(&method(:do_something))
1431
+ # [1, 2, 3].each(&out.method(:puts))
1432
+ #
1433
+ # # good
1434
+ # array.map { |x| do_something(x) }
1435
+ # [1, 2, 3].each { |x| out.puts(x) }
1436
+ #
1437
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/method_object_as_block.rb:19
1438
+ class RuboCop::Cop::Performance::MethodObjectAsBlock < ::RuboCop::Cop::Base
1439
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/method_object_as_block.rb:22
1440
+ def method_object_as_argument?(param0 = T.unsafe(nil)); end
1441
+
1442
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/method_object_as_block.rb:26
1443
+ def on_block_pass(node); end
1444
+ end
1445
+
1446
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/method_object_as_block.rb:20
1447
+ RuboCop::Cop::Performance::MethodObjectAsBlock::MSG = T.let(T.unsafe(nil), String)
1448
+
1449
+ # Checks for `OpenStruct.new` calls.
1450
+ # Instantiation of an `OpenStruct` invalidates
1451
+ # Ruby global method cache as it causes dynamic method
1452
+ # definition during program runtime.
1453
+ # This could have an effect on performance,
1454
+ # especially in case of single-threaded
1455
+ # applications with multiple `OpenStruct` instantiations.
1456
+ #
1457
+ # @example
1458
+ # # bad
1459
+ # class MyClass
1460
+ # def my_method
1461
+ # OpenStruct.new(my_key1: 'my_value1', my_key2: 'my_value2')
1462
+ # end
1463
+ # end
1464
+ #
1465
+ # # good
1466
+ # class MyClass
1467
+ # MyStruct = Struct.new(:my_key1, :my_key2)
1468
+ # def my_method
1469
+ # MyStruct.new('my_value1', 'my_value2')
1470
+ # end
1471
+ # end
1472
+ #
1473
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/open_struct.rb:34
1474
+ class RuboCop::Cop::Performance::OpenStruct < ::RuboCop::Cop::Base
1475
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/open_struct.rb:43
1476
+ def on_send(node); end
1477
+
1478
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/open_struct.rb:39
1479
+ def open_struct(param0 = T.unsafe(nil)); end
1480
+ end
1481
+
1482
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/open_struct.rb:35
1483
+ RuboCop::Cop::Performance::OpenStruct::MSG = T.let(T.unsafe(nil), String)
1484
+
1485
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/open_struct.rb:37
1486
+ RuboCop::Cop::Performance::OpenStruct::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
1487
+
1488
+ # Identifies uses of `Range#include?` and `Range#member?`, which iterates over each
1489
+ # item in a `Range` to see if a specified item is there. In contrast,
1490
+ # `Range#cover?` simply compares the target item with the beginning and
1491
+ # end points of the `Range`. In a great majority of cases, this is what
1492
+ # is wanted.
1493
+ #
1494
+ # @example
1495
+ # # bad
1496
+ # ('a'..'z').include?('b') # => true
1497
+ # ('a'..'z').member?('b') # => true
1498
+ #
1499
+ # # good
1500
+ # ('a'..'z').cover?('b') # => true
1501
+ #
1502
+ # # Example of a case where `Range#cover?` may not provide
1503
+ # # the desired result:
1504
+ #
1505
+ # ('a'..'z').cover?('yellow') # => true
1506
+ #
1507
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/range_include.rb:28
1508
+ class RuboCop::Cop::Performance::RangeInclude < ::RuboCop::Cop::Base
1509
+ extend ::RuboCop::Cop::AutoCorrector
1510
+
1511
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/range_include.rb:43
1512
+ def on_send(node); end
1513
+
1514
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/range_include.rb:39
1515
+ def range_include(param0 = T.unsafe(nil)); end
1516
+ end
1517
+
1518
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/range_include.rb:31
1519
+ RuboCop::Cop::Performance::RangeInclude::MSG = T.let(T.unsafe(nil), String)
1520
+
1521
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/range_include.rb:32
1522
+ RuboCop::Cop::Performance::RangeInclude::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
1523
+
1524
+ # Identifies the use of a `&block` parameter and `block.call`
1525
+ # where `yield` would do just as well.
1526
+ #
1527
+ # @example
1528
+ # # bad
1529
+ # def method(&block)
1530
+ # block.call
1531
+ # end
1532
+ # def another(&func)
1533
+ # func.call 1, 2, 3
1534
+ # end
1535
+ #
1536
+ # # good
1537
+ # def method
1538
+ # yield
1539
+ # end
1540
+ # def another
1541
+ # yield 1, 2, 3
1542
+ # end
1543
+ #
1544
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_block_call.rb:25
1545
+ class RuboCop::Cop::Performance::RedundantBlockCall < ::RuboCop::Cop::Base
1546
+ extend ::RuboCop::Cop::AutoCorrector
1547
+
1548
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_block_call.rb:43
1549
+ def blockarg_assigned?(param0, param1); end
1550
+
1551
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_block_call.rb:39
1552
+ def blockarg_calls(param0, param1); end
1553
+
1554
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_block_call.rb:34
1555
+ def blockarg_def(param0 = T.unsafe(nil)); end
1556
+
1557
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_block_call.rb:47
1558
+ def on_def(node); end
1559
+
1560
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_block_call.rb:47
1561
+ def on_defs(node); end
1562
+
1563
+ private
1564
+
1565
+ # @return [Boolean]
1566
+ #
1567
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_block_call.rb:97
1568
+ def args_include_block_pass?(blockcall); end
1569
+
1570
+ # offenses are registered on the `block.call` nodes
1571
+ #
1572
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_block_call.rb:63
1573
+ def autocorrect(corrector, node); end
1574
+
1575
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_block_call.rb:81
1576
+ def calls_to_report(argname, body); end
1577
+
1578
+ # @return [Boolean]
1579
+ #
1580
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_block_call.rb:91
1581
+ def shadowed_block_argument?(body, block_argument_of_method_signature); end
1582
+ end
1583
+
1584
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_block_call.rb:31
1585
+ RuboCop::Cop::Performance::RedundantBlockCall::CLOSE_PAREN = T.let(T.unsafe(nil), String)
1586
+
1587
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_block_call.rb:28
1588
+ RuboCop::Cop::Performance::RedundantBlockCall::MSG = T.let(T.unsafe(nil), String)
1589
+
1590
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_block_call.rb:30
1591
+ RuboCop::Cop::Performance::RedundantBlockCall::OPEN_PAREN = T.let(T.unsafe(nil), String)
1592
+
1593
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_block_call.rb:32
1594
+ RuboCop::Cop::Performance::RedundantBlockCall::SPACE = T.let(T.unsafe(nil), String)
1595
+
1596
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_block_call.rb:29
1597
+ RuboCop::Cop::Performance::RedundantBlockCall::YIELD = T.let(T.unsafe(nil), String)
1598
+
1599
+ # Checks for uses `Enumerable#all?`, `Enumerable#any?`, `Enumerable#one?`,
1600
+ # and `Enumerable#none?` are compared with `===` or similar methods in block.
1601
+ #
1602
+ # By default, `Object#===` behaves the same as `Object#==`, but this
1603
+ # behavior is appropriately overridden in subclass. For example,
1604
+ # `Range#===` returns `true` when argument is within the range.
1605
+ #
1606
+ # @example
1607
+ # # bad
1608
+ # items.all? { |item| pattern === item }
1609
+ # items.all? { |item| item == other }
1610
+ # items.all? { |item| item.is_a?(Klass) }
1611
+ # items.all? { |item| item.kind_of?(Klass) }
1612
+ #
1613
+ # # good
1614
+ # items.all?(pattern)
1615
+ #
1616
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb:26
1617
+ class RuboCop::Cop::Performance::RedundantEqualityComparisonBlock < ::RuboCop::Cop::Base
1618
+ extend ::RuboCop::Cop::AutoCorrector
1619
+ extend ::RuboCop::Cop::TargetRubyVersion
1620
+
1621
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb:38
1622
+ def on_block(node); end
1623
+
1624
+ private
1625
+
1626
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb:76
1627
+ def new_argument(block_argument, block_body); end
1628
+
1629
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb:99
1630
+ def offense_range(node); end
1631
+
1632
+ # @return [Boolean]
1633
+ #
1634
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb:58
1635
+ def one_block_argument?(block_arguments); end
1636
+
1637
+ # @return [Boolean]
1638
+ #
1639
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb:66
1640
+ def same_block_argument_and_is_a_argument?(block_body, block_argument); end
1641
+
1642
+ # @return [Boolean]
1643
+ #
1644
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb:90
1645
+ def use_block_argument_in_method_argument_of_operand?(block_argument, operand); end
1646
+
1647
+ # @return [Boolean]
1648
+ #
1649
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb:62
1650
+ def use_equality_comparison_block?(block_body); end
1651
+ end
1652
+
1653
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb:35
1654
+ RuboCop::Cop::Performance::RedundantEqualityComparisonBlock::COMPARISON_METHODS = T.let(T.unsafe(nil), Array)
1655
+
1656
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb:36
1657
+ RuboCop::Cop::Performance::RedundantEqualityComparisonBlock::IS_A_METHODS = T.let(T.unsafe(nil), Array)
1658
+
1659
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb:32
1660
+ RuboCop::Cop::Performance::RedundantEqualityComparisonBlock::MSG = T.let(T.unsafe(nil), String)
1661
+
1662
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb:34
1663
+ RuboCop::Cop::Performance::RedundantEqualityComparisonBlock::TARGET_METHODS = T.let(T.unsafe(nil), Array)
1664
+
1665
+ # Identifies the use of `Regexp#match` or `String#match`, which
1666
+ # returns `#<MatchData>`/`nil`. The return value of `=~` is an integral
1667
+ # index/`nil` and is more performant.
1668
+ #
1669
+ # @example
1670
+ # # bad
1671
+ # do_something if str.match(/regex/)
1672
+ # while regex.match('str')
1673
+ # do_something
1674
+ # end
1675
+ #
1676
+ # # good
1677
+ # method(str =~ /regex/)
1678
+ # return value unless regex =~ 'str'
1679
+ #
1680
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_match.rb:20
1681
+ class RuboCop::Cop::Performance::RedundantMatch < ::RuboCop::Cop::Base
1682
+ extend ::RuboCop::Cop::AutoCorrector
1683
+
1684
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_match.rb:29
1685
+ def match_call?(param0 = T.unsafe(nil)); end
1686
+
1687
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_match.rb:38
1688
+ def on_send(node); end
1689
+
1690
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_match.rb:34
1691
+ def only_truthiness_matters?(param0 = T.unsafe(nil)); end
1692
+
1693
+ private
1694
+
1695
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_match.rb:50
1696
+ def autocorrect(corrector, node); end
1697
+ end
1698
+
1699
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_match.rb:23
1700
+ RuboCop::Cop::Performance::RedundantMatch::MSG = T.let(T.unsafe(nil), String)
1701
+
1702
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_match.rb:25
1703
+ RuboCop::Cop::Performance::RedundantMatch::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
1704
+
1705
+ # Identifies places where `Hash#merge!` can be replaced by `Hash#[]=`.
1706
+ # You can set the maximum number of key-value pairs to consider
1707
+ # an offense with `MaxKeyValuePairs`.
1708
+ #
1709
+ # @example
1710
+ # # bad
1711
+ # hash.merge!(a: 1)
1712
+ # hash.merge!({'key' => 'value'})
1713
+ #
1714
+ # # good
1715
+ # hash[:a] = 1
1716
+ # hash['key'] = 'value'
1717
+ # @example MaxKeyValuePairs: 2 (default)
1718
+ # # bad
1719
+ # hash.merge!(a: 1, b: 2)
1720
+ #
1721
+ # # good
1722
+ # hash[:a] = 1
1723
+ # hash[:b] = 2
1724
+ #
1725
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:30
1726
+ class RuboCop::Cop::Performance::RedundantMerge < ::RuboCop::Cop::Base
1727
+ extend ::RuboCop::Cop::AutoCorrector
1728
+
1729
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:47
1730
+ def modifier_flow_control?(param0 = T.unsafe(nil)); end
1731
+
1732
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:51
1733
+ def on_send(node); end
1734
+
1735
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:43
1736
+ def redundant_merge_candidate(param0 = T.unsafe(nil)); end
1737
+
1738
+ private
1739
+
1740
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:106
1741
+ def correct_multiple_elements(corrector, node, parent, new_source); end
1742
+
1743
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:118
1744
+ def correct_single_element(corrector, node, new_source); end
1745
+
1746
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:78
1747
+ def each_redundant_merge(node); end
1748
+
1749
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:150
1750
+ def indent_width; end
1751
+
1752
+ # @return [Boolean]
1753
+ #
1754
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:97
1755
+ def kwsplat_used?(pairs); end
1756
+
1757
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:146
1758
+ def leading_spaces(node); end
1759
+
1760
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:154
1761
+ def max_key_value_pairs; end
1762
+
1763
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:70
1764
+ def message(node); end
1765
+
1766
+ # @return [Boolean]
1767
+ #
1768
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:86
1769
+ def non_redundant_merge?(node, receiver, pairs); end
1770
+
1771
+ # @return [Boolean]
1772
+ #
1773
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:93
1774
+ def non_redundant_pairs?(receiver, pairs); end
1775
+
1776
+ # @return [Boolean]
1777
+ #
1778
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:101
1779
+ def non_redundant_value_used?(receiver, node); end
1780
+
1781
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:134
1782
+ def rewrite_with_modifier(node, parent, new_source); end
1783
+
1784
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:122
1785
+ def to_assignments(receiver, pairs); end
1786
+ end
1787
+
1788
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:33
1789
+ RuboCop::Cop::Performance::RedundantMerge::AREF_ASGN = T.let(T.unsafe(nil), String)
1790
+
1791
+ # A utility class for checking the use of values within an
1792
+ # `each_with_object` call.
1793
+ #
1794
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:160
1795
+ class RuboCop::Cop::Performance::RedundantMerge::EachWithObjectInspector
1796
+ extend ::RuboCop::AST::NodePattern::Macros
1797
+
1798
+ # @return [EachWithObjectInspector] a new instance of EachWithObjectInspector
1799
+ #
1800
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:163
1801
+ def initialize(node, receiver); end
1802
+
1803
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:194
1804
+ def each_with_object_node(param0 = T.unsafe(nil)); end
1805
+
1806
+ # @return [Boolean]
1807
+ #
1808
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:168
1809
+ def value_used?; end
1810
+
1811
+ private
1812
+
1813
+ # @return [Boolean]
1814
+ #
1815
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:178
1816
+ def eligible_receiver?; end
1817
+
1818
+ # Returns the value of attribute node.
1819
+ #
1820
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:176
1821
+ def node; end
1822
+
1823
+ # Returns the value of attribute receiver.
1824
+ #
1825
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:176
1826
+ def receiver; end
1827
+
1828
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:182
1829
+ def second_argument; end
1830
+
1831
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:189
1832
+ def unwind(receiver); end
1833
+ end
1834
+
1835
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:34
1836
+ RuboCop::Cop::Performance::RedundantMerge::MSG = T.let(T.unsafe(nil), String)
1837
+
1838
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:35
1839
+ RuboCop::Cop::Performance::RedundantMerge::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
1840
+
1841
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb:37
1842
+ RuboCop::Cop::Performance::RedundantMerge::WITH_MODIFIER_CORRECTION = T.let(T.unsafe(nil), String)
1843
+
1844
+ # Identifies places where `sort { |a, b| a <=> b }` can be replaced with `sort`.
1845
+ #
1846
+ # @example
1847
+ # # bad
1848
+ # array.sort { |a, b| a <=> b }
1849
+ #
1850
+ # # good
1851
+ # array.sort
1852
+ #
1853
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_sort_block.rb:15
1854
+ class RuboCop::Cop::Performance::RedundantSortBlock < ::RuboCop::Cop::Base
1855
+ include ::RuboCop::Cop::RangeHelp
1856
+ include ::RuboCop::Cop::SortBlock
1857
+ extend ::RuboCop::Cop::AutoCorrector
1858
+
1859
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_sort_block.rb:21
1860
+ def on_block(node); end
1861
+
1862
+ private
1863
+
1864
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_sort_block.rb:35
1865
+ def message(var_a, var_b); end
1866
+ end
1867
+
1868
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_sort_block.rb:19
1869
+ RuboCop::Cop::Performance::RedundantSortBlock::MSG = T.let(T.unsafe(nil), String)
1870
+
1871
+ # Identifies places where `split` argument can be replaced from
1872
+ # a deterministic regexp to a string.
1873
+ #
1874
+ # @example
1875
+ # # bad
1876
+ # 'a,b,c'.split(/,/)
1877
+ #
1878
+ # # good
1879
+ # 'a,b,c'.split(',')
1880
+ #
1881
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb:15
1882
+ class RuboCop::Cop::Performance::RedundantSplitRegexpArgument < ::RuboCop::Cop::Base
1883
+ extend ::RuboCop::Cop::AutoCorrector
1884
+
1885
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb:27
1886
+ def on_send(node); end
1887
+
1888
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb:23
1889
+ def split_call_with_regexp?(param0 = T.unsafe(nil)); end
1890
+
1891
+ private
1892
+
1893
+ # @return [Boolean]
1894
+ #
1895
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb:41
1896
+ def determinist_regexp?(regexp_node); end
1897
+
1898
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb:45
1899
+ def replacement(regexp_node); end
1900
+ end
1901
+
1902
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb:20
1903
+ RuboCop::Cop::Performance::RedundantSplitRegexpArgument::DETERMINISTIC_REGEX = T.let(T.unsafe(nil), Regexp)
1904
+
1905
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb:18
1906
+ RuboCop::Cop::Performance::RedundantSplitRegexpArgument::MSG = T.let(T.unsafe(nil), String)
1907
+
1908
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb:19
1909
+ RuboCop::Cop::Performance::RedundantSplitRegexpArgument::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
1910
+
1911
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb:21
1912
+ RuboCop::Cop::Performance::RedundantSplitRegexpArgument::STR_SPECIAL_CHARS = T.let(T.unsafe(nil), Array)
1913
+
1914
+ # Checks for redundant `String#chars`.
1915
+ #
1916
+ # @example
1917
+ # # bad
1918
+ # str.chars[0..2]
1919
+ # str.chars.slice(0..2)
1920
+ #
1921
+ # # good
1922
+ # str[0..2].chars
1923
+ #
1924
+ # # bad
1925
+ # str.chars.first
1926
+ # str.chars.first(2)
1927
+ #
1928
+ # # good
1929
+ # str[0]
1930
+ # str[0...2].chars
1931
+ #
1932
+ # # bad
1933
+ # str.chars.take(2)
1934
+ # str.chars.length
1935
+ # str.chars.size
1936
+ # str.chars.empty?
1937
+ #
1938
+ # # good
1939
+ # str[0...2].chars
1940
+ # str.length
1941
+ # str.size
1942
+ # str.empty?
1943
+ #
1944
+ # # For example, if the receiver is a blank string, it will be incompatible.
1945
+ # # If a negative value is specified for the receiver, `nil` is returned.
1946
+ # str.chars.last # Incompatible with `str[-1]`.
1947
+ # str.chars.last(2) # Incompatible with `str[-2..-1].chars`.
1948
+ # str.chars.drop(2) # Incompatible with `str[2..-1].chars`.
1949
+ #
1950
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_string_chars.rb:42
1951
+ class RuboCop::Cop::Performance::RedundantStringChars < ::RuboCop::Cop::Base
1952
+ include ::RuboCop::Cop::RangeHelp
1953
+ extend ::RuboCop::Cop::AutoCorrector
1954
+
1955
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_string_chars.rb:53
1956
+ def on_send(node); end
1957
+
1958
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_string_chars.rb:49
1959
+ def redundant_chars_call?(param0 = T.unsafe(nil)); end
1960
+
1961
+ private
1962
+
1963
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_string_chars.rb:108
1964
+ def build_bad_method(method, args); end
1965
+
1966
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_string_chars.rb:121
1967
+ def build_call_args(call_args_node); end
1968
+
1969
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_string_chars.rb:83
1970
+ def build_good_method(method, args); end
1971
+
1972
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_string_chars.rb:96
1973
+ def build_good_method_for_brackets_or_first_method(method, args); end
1974
+
1975
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_string_chars.rb:77
1976
+ def build_message(method, args); end
1977
+
1978
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_string_chars.rb:73
1979
+ def correction_range(receiver, node); end
1980
+
1981
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_string_chars.rb:69
1982
+ def offense_range(receiver, node); end
1983
+ end
1984
+
1985
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_string_chars.rb:46
1986
+ RuboCop::Cop::Performance::RedundantStringChars::MSG = T.let(T.unsafe(nil), String)
1987
+
1988
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_string_chars.rb:47
1989
+ RuboCop::Cop::Performance::RedundantStringChars::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
1990
+
1991
+ # In Ruby 2.4, `String#match?`, `Regexp#match?`, and `Symbol#match?`
1992
+ # have been added. The methods are faster than `match`.
1993
+ # Because the methods avoid creating a `MatchData` object or saving
1994
+ # backref.
1995
+ # So, when `MatchData` is not used, use `match?` instead of `match`.
1996
+ #
1997
+ # @example
1998
+ # # bad
1999
+ # def foo
2000
+ # if x =~ /re/
2001
+ # do_something
2002
+ # end
2003
+ # end
2004
+ #
2005
+ # # bad
2006
+ # def foo
2007
+ # if x !~ /re/
2008
+ # do_something
2009
+ # end
2010
+ # end
2011
+ #
2012
+ # # bad
2013
+ # def foo
2014
+ # if x.match(/re/)
2015
+ # do_something
2016
+ # end
2017
+ # end
2018
+ #
2019
+ # # bad
2020
+ # def foo
2021
+ # if /re/ === x
2022
+ # do_something
2023
+ # end
2024
+ # end
2025
+ #
2026
+ # # good
2027
+ # def foo
2028
+ # if x.match?(/re/)
2029
+ # do_something
2030
+ # end
2031
+ # end
2032
+ #
2033
+ # # good
2034
+ # def foo
2035
+ # if !x.match?(/re/)
2036
+ # do_something
2037
+ # end
2038
+ # end
2039
+ #
2040
+ # # good
2041
+ # def foo
2042
+ # if x =~ /re/
2043
+ # do_something(Regexp.last_match)
2044
+ # end
2045
+ # end
2046
+ #
2047
+ # # good
2048
+ # def foo
2049
+ # if x.match(/re/)
2050
+ # do_something($~)
2051
+ # end
2052
+ # end
2053
+ #
2054
+ # # good
2055
+ # def foo
2056
+ # if /re/ === x
2057
+ # do_something($~)
2058
+ # end
2059
+ # end
2060
+ #
2061
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:75
2062
+ class RuboCop::Cop::Performance::RegexpMatch < ::RuboCop::Cop::Base
2063
+ extend ::RuboCop::Cop::AutoCorrector
2064
+ extend ::RuboCop::Cop::TargetRubyVersion
2065
+
2066
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:125
2067
+ def last_matches(param0); end
2068
+
2069
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:86
2070
+ def match_method?(param0 = T.unsafe(nil)); end
2071
+
2072
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:122
2073
+ def match_node?(param0 = T.unsafe(nil)); end
2074
+
2075
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:97
2076
+ def match_operator?(param0 = T.unsafe(nil)); end
2077
+
2078
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:101
2079
+ def match_threequals?(param0 = T.unsafe(nil)); end
2080
+
2081
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:93
2082
+ def match_with_int_arg_method?(param0 = T.unsafe(nil)); end
2083
+
2084
+ # @return [Boolean]
2085
+ #
2086
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:105
2087
+ def match_with_lvasgn?(node); end
2088
+
2089
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:138
2090
+ def on_case(node); end
2091
+
2092
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:134
2093
+ def on_if(node); end
2094
+
2095
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:123
2096
+ def search_match_nodes(param0); end
2097
+
2098
+ private
2099
+
2100
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:161
2101
+ def autocorrect(corrector, node); end
2102
+
2103
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:150
2104
+ def check_condition(cond); end
2105
+
2106
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:254
2107
+ def correct_operator(corrector, recv, arg, oper = T.unsafe(nil)); end
2108
+
2109
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:279
2110
+ def correction_range(recv, arg); end
2111
+
2112
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:217
2113
+ def find_last_match(body, range, scope_root); end
2114
+
2115
+ # @return [Boolean]
2116
+ #
2117
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:177
2118
+ def last_match_used?(match_node); end
2119
+
2120
+ # @return [Boolean]
2121
+ #
2122
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:243
2123
+ def match_gvar?(sym); end
2124
+
2125
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:173
2126
+ def message(node); end
2127
+
2128
+ # @return [Boolean]
2129
+ #
2130
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:213
2131
+ def modifier_form?(match_node); end
2132
+
2133
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:199
2134
+ def next_match_pos(body, match_node_pos, scope_root); end
2135
+
2136
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:186
2137
+ def range_to_search_for_last_matches(match_node, body, scope_root); end
2138
+
2139
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:263
2140
+ def replace_with_match_predicate_method(corrector, recv, arg, op_range); end
2141
+
2142
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:225
2143
+ def scope_body(node); end
2144
+
2145
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:237
2146
+ def scope_root(node); end
2147
+
2148
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:274
2149
+ def swap_receiver_and_arg(corrector, recv, arg); end
2150
+ end
2151
+
2152
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:112
2153
+ RuboCop::Cop::Performance::RegexpMatch::MATCH_NODE_PATTERN = T.let(T.unsafe(nil), String)
2154
+
2155
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:84
2156
+ RuboCop::Cop::Performance::RegexpMatch::MSG = T.let(T.unsafe(nil), String)
2157
+
2158
+ # Constants are included in this list because it is unlikely that
2159
+ # someone will store `nil` as a constant and then use it for comparison
2160
+ #
2161
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb:83
2162
+ RuboCop::Cop::Performance::RegexpMatch::TYPES_IMPLEMENTING_MATCH = T.let(T.unsafe(nil), Array)
2163
+
2164
+ # Identifies usages of `reverse.each` and change them to use `reverse_each` instead.
2165
+ #
2166
+ # If the return value is used, it will not be detected because the result will be different.
2167
+ #
2168
+ # [source,ruby]
2169
+ # ----
2170
+ # [1, 2, 3].reverse.each {} #=> [3, 2, 1]
2171
+ # [1, 2, 3].reverse_each {} #=> [1, 2, 3]
2172
+ # ----
2173
+ #
2174
+ # @example
2175
+ # # bad
2176
+ # items.reverse.each
2177
+ #
2178
+ # # good
2179
+ # items.reverse_each
2180
+ #
2181
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/reverse_each.rb:22
2182
+ class RuboCop::Cop::Performance::ReverseEach < ::RuboCop::Cop::Base
2183
+ include ::RuboCop::Cop::RangeHelp
2184
+ extend ::RuboCop::Cop::AutoCorrector
2185
+
2186
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/reverse_each.rb:33
2187
+ def on_send(node); end
2188
+
2189
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/reverse_each.rb:29
2190
+ def reverse_each?(param0 = T.unsafe(nil)); end
2191
+
2192
+ private
2193
+
2194
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/reverse_each.rb:53
2195
+ def offense_range(node); end
2196
+
2197
+ # @return [Boolean]
2198
+ #
2199
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/reverse_each.rb:47
2200
+ def use_return_value?(node); end
2201
+ end
2202
+
2203
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/reverse_each.rb:26
2204
+ RuboCop::Cop::Performance::ReverseEach::MSG = T.let(T.unsafe(nil), String)
2205
+
2206
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/reverse_each.rb:27
2207
+ RuboCop::Cop::Performance::ReverseEach::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
2208
+
2209
+ # Identifies places where `reverse.first(n)` and `reverse.first`
2210
+ # can be replaced by `last(n).reverse` and `last`.
2211
+ #
2212
+ # @example
2213
+ #
2214
+ # # bad
2215
+ # array.reverse.first(5)
2216
+ # array.reverse.first
2217
+ #
2218
+ # # good
2219
+ # array.last(5).reverse
2220
+ # array.last
2221
+ #
2222
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/reverse_first.rb:19
2223
+ class RuboCop::Cop::Performance::ReverseFirst < ::RuboCop::Cop::Base
2224
+ include ::RuboCop::Cop::RangeHelp
2225
+ extend ::RuboCop::Cop::AutoCorrector
2226
+
2227
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/reverse_first.rb:30
2228
+ def on_send(node); end
2229
+
2230
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/reverse_first.rb:26
2231
+ def reverse_first_candidate?(param0 = T.unsafe(nil)); end
2232
+
2233
+ private
2234
+
2235
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/reverse_first.rb:63
2236
+ def build_bad_method(node); end
2237
+
2238
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/reverse_first.rb:55
2239
+ def build_good_method(node); end
2240
+
2241
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/reverse_first.rb:49
2242
+ def build_message(node); end
2243
+
2244
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/reverse_first.rb:45
2245
+ def correction_range(receiver, node); end
2246
+ end
2247
+
2248
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/reverse_first.rb:23
2249
+ RuboCop::Cop::Performance::ReverseFirst::MSG = T.let(T.unsafe(nil), String)
2250
+
2251
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/reverse_first.rb:24
2252
+ RuboCop::Cop::Performance::ReverseFirst::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
2253
+
2254
+ # In Ruby 2.7, `Enumerable#filter_map` has been added.
2255
+ #
2256
+ # This cop identifies places where `select.map` can be replaced by `filter_map`.
2257
+ #
2258
+ # @example
2259
+ # # bad
2260
+ # ary.select(&:foo).map(&:bar)
2261
+ # ary.filter(&:foo).map(&:bar)
2262
+ #
2263
+ # # good
2264
+ # ary.filter_map { |o| o.bar if o.foo }
2265
+ #
2266
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/select_map.rb:18
2267
+ class RuboCop::Cop::Performance::SelectMap < ::RuboCop::Cop::Base
2268
+ include ::RuboCop::Cop::RangeHelp
2269
+ extend ::RuboCop::Cop::TargetRubyVersion
2270
+
2271
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/select_map.rb:27
2272
+ def bad_method?(param0 = T.unsafe(nil)); end
2273
+
2274
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/select_map.rb:31
2275
+ def on_send(node); end
2276
+
2277
+ private
2278
+
2279
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/select_map.rb:44
2280
+ def map_method_candidate(node); end
2281
+
2282
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/select_map.rb:54
2283
+ def offense_range(node, map_method); end
2284
+ end
2285
+
2286
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/select_map.rb:24
2287
+ RuboCop::Cop::Performance::SelectMap::MSG = T.let(T.unsafe(nil), String)
2288
+
2289
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/select_map.rb:25
2290
+ RuboCop::Cop::Performance::SelectMap::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
2291
+
2292
+ # Identifies usages of `count` on an `Array` and `Hash` and change them to `size`.
2293
+ #
2294
+ # TODO: Add advanced detection of variables that could
2295
+ # have been assigned to an array or a hash.
2296
+ #
2297
+ # @example
2298
+ # # bad
2299
+ # [1, 2, 3].count
2300
+ # (1..3).to_a.count
2301
+ # Array[*1..3].count
2302
+ # Array(1..3).count
2303
+ #
2304
+ # # bad
2305
+ # {a: 1, b: 2, c: 3}.count
2306
+ # [[:foo, :bar], [1, 2]].to_h.count
2307
+ # Hash[*('a'..'z')].count
2308
+ # Hash(key: :value).count
2309
+ #
2310
+ # # good
2311
+ # [1, 2, 3].size
2312
+ # (1..3).to_a.size
2313
+ # Array[*1..3].size
2314
+ # Array(1..3).size
2315
+ #
2316
+ # # good
2317
+ # {a: 1, b: 2, c: 3}.size
2318
+ # [[:foo, :bar], [1, 2]].to_h.size
2319
+ # Hash[*('a'..'z')].size
2320
+ # Hash(key: :value).size
2321
+ #
2322
+ # # good
2323
+ # [1, 2, 3].count { |e| e > 2 }
2324
+ #
2325
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/size.rb:37
2326
+ class RuboCop::Cop::Performance::Size < ::RuboCop::Cop::Base
2327
+ extend ::RuboCop::Cop::AutoCorrector
2328
+
2329
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/size.rb:43
2330
+ def array?(param0 = T.unsafe(nil)); end
2331
+
2332
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/size.rb:61
2333
+ def count?(param0 = T.unsafe(nil)); end
2334
+
2335
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/size.rb:52
2336
+ def hash?(param0 = T.unsafe(nil)); end
2337
+
2338
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/size.rb:65
2339
+ def on_send(node); end
2340
+ end
2341
+
2342
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/size.rb:40
2343
+ RuboCop::Cop::Performance::Size::MSG = T.let(T.unsafe(nil), String)
2344
+
2345
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/size.rb:41
2346
+ RuboCop::Cop::Performance::Size::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
2347
+
2348
+ # Identifies places where `sort { |a, b| b <=> a }`
2349
+ # can be replaced by a faster `sort.reverse`.
2350
+ #
2351
+ # @example
2352
+ # # bad
2353
+ # array.sort { |a, b| b <=> a }
2354
+ #
2355
+ # # good
2356
+ # array.sort.reverse
2357
+ #
2358
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sort_reverse.rb:16
2359
+ class RuboCop::Cop::Performance::SortReverse < ::RuboCop::Cop::Base
2360
+ include ::RuboCop::Cop::RangeHelp
2361
+ include ::RuboCop::Cop::SortBlock
2362
+ extend ::RuboCop::Cop::AutoCorrector
2363
+
2364
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sort_reverse.rb:22
2365
+ def on_block(node); end
2366
+
2367
+ private
2368
+
2369
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sort_reverse.rb:38
2370
+ def message(var_a, var_b); end
2371
+ end
2372
+
2373
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sort_reverse.rb:20
2374
+ RuboCop::Cop::Performance::SortReverse::MSG = T.let(T.unsafe(nil), String)
2375
+
2376
+ # Identifies places where `gsub(/a+/, 'a')` and `gsub!(/a+/, 'a')`
2377
+ # can be replaced by `squeeze('a')` and `squeeze!('a')`.
2378
+ #
2379
+ # The `squeeze('a')` method is faster than `gsub(/a+/, 'a')`.
2380
+ #
2381
+ # @example
2382
+ #
2383
+ # # bad
2384
+ # str.gsub(/a+/, 'a')
2385
+ # str.gsub!(/a+/, 'a')
2386
+ #
2387
+ # # good
2388
+ # str.squeeze('a')
2389
+ # str.squeeze!('a')
2390
+ #
2391
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/squeeze.rb:21
2392
+ class RuboCop::Cop::Performance::Squeeze < ::RuboCop::Cop::Base
2393
+ extend ::RuboCop::Cop::AutoCorrector
2394
+
2395
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/squeeze.rb:41
2396
+ def on_send(node); end
2397
+
2398
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/squeeze.rb:32
2399
+ def squeeze_candidate?(param0 = T.unsafe(nil)); end
2400
+
2401
+ private
2402
+
2403
+ # @return [Boolean]
2404
+ #
2405
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/squeeze.rb:61
2406
+ def repeating_literal?(regex_str); end
2407
+ end
2408
+
2409
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/squeeze.rb:24
2410
+ RuboCop::Cop::Performance::Squeeze::MSG = T.let(T.unsafe(nil), String)
2411
+
2412
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/squeeze.rb:27
2413
+ RuboCop::Cop::Performance::Squeeze::PREFERRED_METHODS = T.let(T.unsafe(nil), Hash)
2414
+
2415
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/squeeze.rb:25
2416
+ RuboCop::Cop::Performance::Squeeze::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
2417
+
2418
+ # Identifies unnecessary use of a regex where `String#start_with?` would suffice.
2419
+ #
2420
+ # This cop has `SafeMultiline` configuration option that `true` by default because
2421
+ # `^start` is unsafe as it will behave incompatible with `start_with?`
2422
+ # for receiver is multiline string.
2423
+ #
2424
+ # @example
2425
+ # # bad
2426
+ # 'abc'.match?(/\Aab/)
2427
+ # /\Aab/.match?('abc')
2428
+ # 'abc' =~ /\Aab/
2429
+ # /\Aab/ =~ 'abc'
2430
+ # 'abc'.match(/\Aab/)
2431
+ # /\Aab/.match('abc')
2432
+ #
2433
+ # # good
2434
+ # 'abc'.start_with?('ab')
2435
+ # @example SafeMultiline: true (default)
2436
+ #
2437
+ # # good
2438
+ # 'abc'.match?(/^ab/)
2439
+ # /^ab/.match?('abc')
2440
+ # 'abc' =~ /^ab/
2441
+ # /^ab/ =~ 'abc'
2442
+ # 'abc'.match(/^ab/)
2443
+ # /^ab/.match('abc')
2444
+ # @example SafeMultiline: false
2445
+ #
2446
+ # # bad
2447
+ # 'abc'.match?(/^ab/)
2448
+ # /^ab/.match?('abc')
2449
+ # 'abc' =~ /^ab/
2450
+ # /^ab/ =~ 'abc'
2451
+ # 'abc'.match(/^ab/)
2452
+ # /^ab/.match('abc')
2453
+ #
2454
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/start_with.rb:49
2455
+ class RuboCop::Cop::Performance::StartWith < ::RuboCop::Cop::Base
2456
+ include ::RuboCop::Cop::RegexpMetacharacter
2457
+ extend ::RuboCop::Cop::AutoCorrector
2458
+
2459
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/start_with.rb:63
2460
+ def on_match_with_lvasgn(node); end
2461
+
2462
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/start_with.rb:63
2463
+ def on_send(node); end
2464
+
2465
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/start_with.rb:57
2466
+ def redundant_regex?(param0 = T.unsafe(nil)); end
2467
+ end
2468
+
2469
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/start_with.rb:53
2470
+ RuboCop::Cop::Performance::StartWith::MSG = T.let(T.unsafe(nil), String)
2471
+
2472
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/start_with.rb:55
2473
+ RuboCop::Cop::Performance::StartWith::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
2474
+
2475
+ # Identifies places where string identifier argument can be replaced
2476
+ # by symbol identifier argument.
2477
+ # It prevents the redundancy of the internal string-to-symbol conversion.
2478
+ #
2479
+ # This cop targets methods that take identifier (e.g. method name) argument
2480
+ # and the following examples are parts of it.
2481
+ #
2482
+ # @example
2483
+ #
2484
+ # # bad
2485
+ # send('do_something')
2486
+ # attr_accessor 'do_something'
2487
+ # instance_variable_get('@ivar')
2488
+ #
2489
+ # # good
2490
+ # send(:do_something)
2491
+ # attr_accessor :do_something
2492
+ # instance_variable_get(:@ivar)
2493
+ #
2494
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_identifier_argument.rb:25
2495
+ class RuboCop::Cop::Performance::StringIdentifierArgument < ::RuboCop::Cop::Base
2496
+ extend ::RuboCop::Cop::AutoCorrector
2497
+
2498
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_identifier_argument.rb:46
2499
+ def on_send(node); end
2500
+ end
2501
+
2502
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_identifier_argument.rb:28
2503
+ RuboCop::Cop::Performance::StringIdentifierArgument::MSG = T.let(T.unsafe(nil), String)
2504
+
2505
+ # NOTE: `attr` method is not included in this list as it can cause false positives in Nokogiri API.
2506
+ # And `attr` may not be used because `Style/Attr` registers an offense.
2507
+ # https://github.com/rubocop/rubocop-performance/issues/278
2508
+ #
2509
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_identifier_argument.rb:33
2510
+ RuboCop::Cop::Performance::StringIdentifierArgument::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
2511
+
2512
+ # Identifies unnecessary use of a regex where `String#include?` would suffice.
2513
+ #
2514
+ # @example
2515
+ # # bad
2516
+ # 'abc'.match?(/ab/)
2517
+ # /ab/.match?('abc')
2518
+ # 'abc' =~ /ab/
2519
+ # /ab/ =~ 'abc'
2520
+ # 'abc'.match(/ab/)
2521
+ # /ab/.match('abc')
2522
+ #
2523
+ # # good
2524
+ # 'abc'.include?('ab')
2525
+ #
2526
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_include.rb:22
2527
+ class RuboCop::Cop::Performance::StringInclude < ::RuboCop::Cop::Base
2528
+ extend ::RuboCop::Cop::AutoCorrector
2529
+
2530
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_include.rb:34
2531
+ def on_match_with_lvasgn(node); end
2532
+
2533
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_include.rb:34
2534
+ def on_send(node); end
2535
+
2536
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_include.rb:28
2537
+ def redundant_regex?(param0 = T.unsafe(nil)); end
2538
+
2539
+ private
2540
+
2541
+ # @return [Boolean]
2542
+ #
2543
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_include.rb:50
2544
+ def literal?(regex_str); end
2545
+ end
2546
+
2547
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_include.rb:25
2548
+ RuboCop::Cop::Performance::StringInclude::MSG = T.let(T.unsafe(nil), String)
2549
+
2550
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_include.rb:26
2551
+ RuboCop::Cop::Performance::StringInclude::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
2552
+
2553
+ # Identifies places where `gsub` can be replaced by `tr` or `delete`.
2554
+ #
2555
+ # @example
2556
+ # # bad
2557
+ # 'abc'.gsub('b', 'd')
2558
+ # 'abc'.gsub('a', '')
2559
+ # 'abc'.gsub(/a/, 'd')
2560
+ # 'abc'.gsub!('a', 'd')
2561
+ #
2562
+ # # good
2563
+ # 'abc'.gsub(/.*/, 'a')
2564
+ # 'abc'.gsub(/a+/, 'd')
2565
+ # 'abc'.tr('b', 'd')
2566
+ # 'a b c'.delete(' ')
2567
+ #
2568
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb:20
2569
+ class RuboCop::Cop::Performance::StringReplacement < ::RuboCop::Cop::Base
2570
+ include ::RuboCop::Cop::RangeHelp
2571
+ extend ::RuboCop::Cop::AutoCorrector
2572
+
2573
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb:37
2574
+ def on_send(node); end
2575
+
2576
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb:31
2577
+ def string_replacement?(param0 = T.unsafe(nil)); end
2578
+
2579
+ private
2580
+
2581
+ # @return [Boolean]
2582
+ #
2583
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb:83
2584
+ def accept_first_param?(first_param); end
2585
+
2586
+ # @return [Boolean]
2587
+ #
2588
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb:78
2589
+ def accept_second_param?(second_param); end
2590
+
2591
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb:59
2592
+ def autocorrect(corrector, node); end
2593
+
2594
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb:100
2595
+ def first_source(first_param); end
2596
+
2597
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb:143
2598
+ def message(node, first_source, second_source); end
2599
+
2600
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb:150
2601
+ def method_suffix(node); end
2602
+
2603
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb:48
2604
+ def offense(node, first_param, second_param); end
2605
+
2606
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb:129
2607
+ def range(node); end
2608
+
2609
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb:154
2610
+ def remove_second_param(corrector, node, first_param); end
2611
+
2612
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb:69
2613
+ def replace_method(corrector, node, first_source, second_source, first_param); end
2614
+
2615
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb:133
2616
+ def replacement_method(node, first_source, second_source); end
2617
+
2618
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb:118
2619
+ def source_from_regex_constructor(node); end
2620
+
2621
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb:111
2622
+ def source_from_regex_literal(node); end
2623
+ end
2624
+
2625
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb:29
2626
+ RuboCop::Cop::Performance::StringReplacement::BANG = T.let(T.unsafe(nil), String)
2627
+
2628
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb:27
2629
+ RuboCop::Cop::Performance::StringReplacement::DELETE = T.let(T.unsafe(nil), String)
2630
+
2631
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb:26
2632
+ RuboCop::Cop::Performance::StringReplacement::DETERMINISTIC_REGEX = T.let(T.unsafe(nil), Regexp)
2633
+
2634
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb:24
2635
+ RuboCop::Cop::Performance::StringReplacement::MSG = T.let(T.unsafe(nil), String)
2636
+
2637
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb:25
2638
+ RuboCop::Cop::Performance::StringReplacement::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
2639
+
2640
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb:28
2641
+ RuboCop::Cop::Performance::StringReplacement::TR = T.let(T.unsafe(nil), String)
2642
+
2643
+ # Identifies places where custom code finding the sum of elements
2644
+ # in some Enumerable object can be replaced by `Enumerable#sum` method.
2645
+ #
2646
+ # @example OnlySumOrWithInitialValue: false (default)
2647
+ # # bad
2648
+ # [1, 2, 3].inject(:+) # Autocorrections for cases without initial value are unsafe
2649
+ # [1, 2, 3].inject(&:+) # and will only be performed when using the `-A` option.
2650
+ # [1, 2, 3].reduce { |acc, elem| acc + elem } # They can be prohibited completely using `SafeAutoCorrect: true`.
2651
+ # [1, 2, 3].reduce(10, :+)
2652
+ # [1, 2, 3].map { |elem| elem ** 2 }.sum
2653
+ # [1, 2, 3].collect(&:count).sum(10)
2654
+ #
2655
+ # # good
2656
+ # [1, 2, 3].sum
2657
+ # [1, 2, 3].sum(10)
2658
+ # [1, 2, 3].sum { |elem| elem ** 2 }
2659
+ # [1, 2, 3].sum(10, &:count)
2660
+ # @example OnlySumOrWithInitialValue: true
2661
+ # # bad
2662
+ # [1, 2, 3].reduce(10, :+)
2663
+ # [1, 2, 3].map { |elem| elem ** 2 }.sum
2664
+ # [1, 2, 3].collect(&:count).sum(10)
2665
+ #
2666
+ # # good
2667
+ # [1, 2, 3].sum(10)
2668
+ # [1, 2, 3].sum { |elem| elem ** 2 }
2669
+ # [1, 2, 3].sum(10, &:count)
2670
+ #
2671
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:70
2672
+ class RuboCop::Cop::Performance::Sum < ::RuboCop::Cop::Base
2673
+ include ::RuboCop::Cop::RangeHelp
2674
+ extend ::RuboCop::Cop::AutoCorrector
2675
+
2676
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:99
2677
+ def acc_plus_elem?(param0 = T.unsafe(nil), param1, param2); end
2678
+
2679
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:99
2680
+ def elem_plus_acc?(param0 = T.unsafe(nil), param1, param2); end
2681
+
2682
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:111
2683
+ def on_block(node); end
2684
+
2685
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:104
2686
+ def on_send(node); end
2687
+
2688
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:79
2689
+ def sum_candidate?(param0 = T.unsafe(nil)); end
2690
+
2691
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:83
2692
+ def sum_map_candidate?(param0 = T.unsafe(nil)); end
2693
+
2694
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:92
2695
+ def sum_with_block_candidate?(param0 = T.unsafe(nil)); end
2696
+
2697
+ private
2698
+
2699
+ # @return [Boolean]
2700
+ #
2701
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:156
2702
+ def array_literal?(node); end
2703
+
2704
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:161
2705
+ def autocorrect(corrector, init, range); end
2706
+
2707
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:169
2708
+ def autocorrect_sum_map(corrector, sum, map, init); end
2709
+
2710
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:245
2711
+ def build_block_bad_method(method, init, var_acc, var_elem, body); end
2712
+
2713
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:212
2714
+ def build_block_message(send, init, var_acc, var_elem, body); end
2715
+
2716
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:218
2717
+ def build_good_method(init, block_pass = T.unsafe(nil)); end
2718
+
2719
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:231
2720
+ def build_method_bad_method(init, method, operation); end
2721
+
2722
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:194
2723
+ def build_method_message(node, method, init, operation); end
2724
+
2725
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:205
2726
+ def build_sum_map_message(method, init); end
2727
+
2728
+ # @return [Boolean]
2729
+ #
2730
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:151
2731
+ def empty_array_literal?(node); end
2732
+
2733
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:126
2734
+ def handle_sum_candidate(node); end
2735
+
2736
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:139
2737
+ def handle_sum_map_candidate(node); end
2738
+
2739
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:256
2740
+ def method_call_with_args_range(node); end
2741
+
2742
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:190
2743
+ def sum_block_range(send, node); end
2744
+
2745
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:186
2746
+ def sum_map_range(map, sum); end
2747
+
2748
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:182
2749
+ def sum_method_range(node); end
2750
+ end
2751
+
2752
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:74
2753
+ RuboCop::Cop::Performance::Sum::MSG = T.let(T.unsafe(nil), String)
2754
+
2755
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:75
2756
+ RuboCop::Cop::Performance::Sum::MSG_IF_NO_INIT_VALUE = T.let(T.unsafe(nil), String)
2757
+
2758
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb:77
2759
+ RuboCop::Cop::Performance::Sum::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
2760
+
2761
+ # Checks for .times.map calls.
2762
+ # In most cases such calls can be replaced
2763
+ # with an explicit array creation.
2764
+ #
2765
+ # @example
2766
+ # # bad
2767
+ # 9.times.map do |i|
2768
+ # i.to_s
2769
+ # end
2770
+ #
2771
+ # # good
2772
+ # Array.new(9) do |i|
2773
+ # i.to_s
2774
+ # end
2775
+ #
2776
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/times_map.rb:32
2777
+ class RuboCop::Cop::Performance::TimesMap < ::RuboCop::Cop::Base
2778
+ extend ::RuboCop::Cop::AutoCorrector
2779
+
2780
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/times_map.rb:44
2781
+ def on_block(node); end
2782
+
2783
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/times_map.rb:40
2784
+ def on_send(node); end
2785
+
2786
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/times_map.rb:70
2787
+ def times_map_call(param0 = T.unsafe(nil)); end
2788
+
2789
+ private
2790
+
2791
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/times_map.rb:50
2792
+ def check(node); end
2793
+
2794
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/times_map.rb:61
2795
+ def message(map_or_collect, count); end
2796
+ end
2797
+
2798
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/times_map.rb:35
2799
+ RuboCop::Cop::Performance::TimesMap::MESSAGE = T.let(T.unsafe(nil), String)
2800
+
2801
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/times_map.rb:37
2802
+ RuboCop::Cop::Performance::TimesMap::MESSAGE_ONLY_IF = T.let(T.unsafe(nil), String)
2803
+
2804
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/times_map.rb:38
2805
+ RuboCop::Cop::Performance::TimesMap::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
2806
+
2807
+ # In Ruby 2.3 or later, use unary plus operator to unfreeze a string
2808
+ # literal instead of `String#dup` and `String.new`.
2809
+ # Unary plus operator is faster than `String#dup`.
2810
+ #
2811
+ # @example
2812
+ # # bad
2813
+ # ''.dup
2814
+ # "something".dup
2815
+ # String.new
2816
+ # String.new('')
2817
+ # String.new('something')
2818
+ #
2819
+ # # good
2820
+ # +'something'
2821
+ # +''
2822
+ #
2823
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/unfreeze_string.rb:27
2824
+ class RuboCop::Cop::Performance::UnfreezeString < ::RuboCop::Cop::Base
2825
+ extend ::RuboCop::Cop::AutoCorrector
2826
+
2827
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/unfreeze_string.rb:33
2828
+ def dup_string?(param0 = T.unsafe(nil)); end
2829
+
2830
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/unfreeze_string.rb:44
2831
+ def on_send(node); end
2832
+
2833
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/unfreeze_string.rb:37
2834
+ def string_new?(param0 = T.unsafe(nil)); end
2835
+
2836
+ private
2837
+
2838
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/unfreeze_string.rb:57
2839
+ def string_value(node); end
2840
+ end
2841
+
2842
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/unfreeze_string.rb:30
2843
+ RuboCop::Cop::Performance::UnfreezeString::MSG = T.let(T.unsafe(nil), String)
2844
+
2845
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/unfreeze_string.rb:31
2846
+ RuboCop::Cop::Performance::UnfreezeString::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
2847
+
2848
+ # Identifies places where `URI::Parser.new` can be replaced by `URI::DEFAULT_PARSER`.
2849
+ #
2850
+ # @example
2851
+ # # bad
2852
+ # URI::Parser.new
2853
+ #
2854
+ # # good
2855
+ # URI::DEFAULT_PARSER
2856
+ #
2857
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/uri_default_parser.rb:15
2858
+ class RuboCop::Cop::Performance::UriDefaultParser < ::RuboCop::Cop::Base
2859
+ extend ::RuboCop::Cop::AutoCorrector
2860
+
2861
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/uri_default_parser.rb:28
2862
+ def on_send(node); end
2863
+
2864
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/uri_default_parser.rb:22
2865
+ def uri_parser_new?(param0 = T.unsafe(nil)); end
2866
+ end
2867
+
2868
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/uri_default_parser.rb:18
2869
+ RuboCop::Cop::Performance::UriDefaultParser::MSG = T.let(T.unsafe(nil), String)
2870
+
2871
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/performance/uri_default_parser.rb:20
2872
+ RuboCop::Cop::Performance::UriDefaultParser::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
2873
+
2874
+ # Common functionality for handling regexp metacharacters.
2875
+ #
2876
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/mixin/regexp_metacharacter.rb:6
2877
+ module RuboCop::Cop::RegexpMetacharacter
2878
+ private
2879
+
2880
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/mixin/regexp_metacharacter.rb:63
2881
+ def drop_end_metacharacter(regexp_string); end
2882
+
2883
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/mixin/regexp_metacharacter.rb:55
2884
+ def drop_start_metacharacter(regexp_string); end
2885
+
2886
+ # @return [Boolean]
2887
+ #
2888
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/mixin/regexp_metacharacter.rb:15
2889
+ def literal_at_end?(regexp); end
2890
+
2891
+ # @return [Boolean]
2892
+ #
2893
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/mixin/regexp_metacharacter.rb:41
2894
+ def literal_at_end_with_backslash_z?(regex_str); end
2895
+
2896
+ # @return [Boolean]
2897
+ #
2898
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/mixin/regexp_metacharacter.rb:48
2899
+ def literal_at_end_with_dollar?(regex_str); end
2900
+
2901
+ # @return [Boolean]
2902
+ #
2903
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/mixin/regexp_metacharacter.rb:9
2904
+ def literal_at_start?(regexp); end
2905
+
2906
+ # @return [Boolean]
2907
+ #
2908
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/mixin/regexp_metacharacter.rb:21
2909
+ def literal_at_start_with_backslash_a?(regex_str); end
2910
+
2911
+ # @return [Boolean]
2912
+ #
2913
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/mixin/regexp_metacharacter.rb:31
2914
+ def literal_at_start_with_caret?(regex_str); end
2915
+
2916
+ # @return [Boolean]
2917
+ #
2918
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/mixin/regexp_metacharacter.rb:71
2919
+ def safe_multiline?; end
2920
+ end
2921
+
2922
+ # Common functionality for cops checking `Enumerable#sort` blocks.
2923
+ #
2924
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/mixin/sort_block.rb:6
2925
+ module RuboCop::Cop::SortBlock
2926
+ include ::RuboCop::Cop::RangeHelp
2927
+ extend ::RuboCop::AST::NodePattern::Macros
2928
+
2929
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/mixin/sort_block.rb:17
2930
+ def replaceable_body?(param0 = T.unsafe(nil), param1, param2); end
2931
+
2932
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/mixin/sort_block.rb:10
2933
+ def sort_with_block?(param0 = T.unsafe(nil)); end
2934
+
2935
+ private
2936
+
2937
+ # source://rubocop-performance-1.14.3/lib/rubocop/cop/mixin/sort_block.rb:23
2938
+ def sort_range(send, node); end
2939
+ end
2940
+
2941
+ # source://rubocop-1.34.1/lib/rubocop/ast_aliases.rb:5
2942
+ RuboCop::NodePattern = RuboCop::AST::NodePattern
2943
+
2944
+ # RuboCop Performance project namespace
2945
+ #
2946
+ # source://rubocop-performance-1.14.3/lib/rubocop/performance.rb:5
2947
+ module RuboCop::Performance; end
2948
+
2949
+ # source://rubocop-performance-1.14.3/lib/rubocop/performance.rb:8
2950
+ RuboCop::Performance::CONFIG = T.let(T.unsafe(nil), Hash)
2951
+
2952
+ # source://rubocop-performance-1.14.3/lib/rubocop/performance.rb:7
2953
+ RuboCop::Performance::CONFIG_DEFAULT = T.let(T.unsafe(nil), Pathname)
2954
+
2955
+ # Because RuboCop doesn't yet support plugins, we have to monkey patch in a
2956
+ # bit of our configuration.
2957
+ #
2958
+ # source://rubocop-performance-1.14.3/lib/rubocop/performance/inject.rb:7
2959
+ module RuboCop::Performance::Inject
2960
+ class << self
2961
+ # source://rubocop-performance-1.14.3/lib/rubocop/performance/inject.rb:8
2962
+ def defaults!; end
2963
+ end
2964
+ end
2965
+
2966
+ # source://rubocop-performance-1.14.3/lib/rubocop/performance.rb:6
2967
+ RuboCop::Performance::PROJECT_ROOT = T.let(T.unsafe(nil), Pathname)
2968
+
2969
+ # This module holds the RuboCop Performance version information.
2970
+ #
2971
+ # source://rubocop-performance-1.14.3/lib/rubocop/performance/version.rb:6
2972
+ module RuboCop::Performance::Version
2973
+ class << self
2974
+ # source://rubocop-performance-1.14.3/lib/rubocop/performance/version.rb:9
2975
+ def document_version; end
2976
+ end
2977
+ end
2978
+
2979
+ # source://rubocop-performance-1.14.3/lib/rubocop/performance/version.rb:7
2980
+ RuboCop::Performance::Version::STRING = T.let(T.unsafe(nil), String)
2981
+
2982
+ # source://rubocop-1.34.1/lib/rubocop/ast_aliases.rb:6
2983
+ RuboCop::ProcessedSource = RuboCop::AST::ProcessedSource
2984
+
2985
+ # source://rubocop-1.34.1/lib/rubocop/ast_aliases.rb:7
2986
+ RuboCop::Token = RuboCop::AST::Token