11require : rubocop-performance
22AllCops :
3- TargetRubyVersion : 2.2
3+ TargetRubyVersion : 2.4
44 # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
55 # to ignore them, so only the ones explicitly set in this file are enabled.
66 DisabledByDefault : true
@@ -13,11 +13,6 @@ AllCops:
1313Style/AndOr :
1414 Enabled : true
1515
16- # Do not use braces for hash literals when they are the last argument of a
17- # method call.
18- Style/BracesAroundHashParameters :
19- Enabled : true
20-
2116# Align `when` with `case`.
2217Layout/CaseIndentation :
2318 Enabled : true
@@ -50,7 +45,11 @@ Style/HashSyntax:
5045# extra level of indentation.
5146Layout/IndentationConsistency :
5247 Enabled : true
53- EnforcedStyle : rails
48+ EnforcedStyle : indented_internal_methods
49+
50+ # Detect hard tabs, no hard tabs.
51+ Layout/IndentationStyle :
52+ Enabled : true
5453
5554# Two spaces, no tabs (for indentation).
5655Layout/IndentationWidth :
@@ -98,20 +97,16 @@ Style/StringLiterals:
9897 Enabled : true
9998 EnforcedStyle : double_quotes
10099
101- # Detect hard tabs, no hard tabs.
102- Layout/Tab :
103- Enabled : true
104-
105100# Blank lines should not have any spaces.
106- Layout/TrailingBlankLines :
101+ Layout/TrailingEmptyLines :
107102 Enabled : true
108103
109104# No trailing whitespace.
110105Layout/TrailingWhitespace :
111106 Enabled : true
112107
113108# Use quotes for string literals when they are enough.
114- Style/UnneededPercentQ :
109+ Style/RedundantPercentQ :
115110 Enabled : true
116111
117112# Align `end` with the matching keyword or starting expression except for
@@ -123,3 +118,108 @@ Layout/EndAlignment:
123118# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
124119Lint/RequireParentheses :
125120 Enabled : true
121+
122+ # Use `bind_call(obj, args, ...)` instead of `bind(obj).call(args, ...)`.
123+ Performance/BindCall :
124+ Enabled : true
125+
126+ # Use `caller(n..n)` instead of `caller`.
127+ Performance/Caller :
128+ Enabled : true
129+
130+ # Use `casecmp` for case comparison.
131+ Performance/Casecmp :
132+ Enabled : true
133+
134+ # Extract Array and Hash literals outside of loops into local variables or constants.
135+ Performance/CollectionLiteralInLoop :
136+ Enabled : true
137+
138+ # Prefer `sort_by(&:foo)` instead of `sort { |a, b| a.foo <=> b.foo }`.
139+ Performance/CompareWithBlock :
140+ Enabled : true
141+
142+ # Use `count` instead of `{select,find_all,filter,reject}...{size,count,length}`.
143+ Performance/Count :
144+ Enabled : true
145+
146+ # Use `delete_prefix` instead of `gsub`.
147+ Performance/DeletePrefix :
148+ Enabled : true
149+
150+ # Use `delete_suffix` instead of `gsub`.
151+ Performance/DeleteSuffix :
152+ Enabled : true
153+
154+ # Use `detect` instead of `select.first`, `find_all.first`, `filter.first`, `select.last`, `find_all.last`, and `filter.last`.
155+ Performance/Detect :
156+ Enabled : true
157+
158+ # Use `str.{start,end}_with?(x, ..., y, ...)` instead of `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
159+ Performance/DoubleStartEndWith :
160+ Enabled : true
161+
162+ # Use `end_with?` instead of a regex match anchored to the end of a string.
163+ Performance/EndWith :
164+ Enabled : true
165+
166+ # Do not compute the size of statically sized objects except in constants.
167+ Performance/FixedSize :
168+ Enabled : true
169+
170+ # Use `Enumerable#flat_map` instead of `Enumerable#map...Array#flatten(1).
171+ Performance/FlatMap :
172+ Enabled : true
173+
174+ # Use `key?` or `value?` instead of `keys.include?` or `values.include?`.
175+ Performance/InefficientHashSearch :
176+ Enabled : true
177+
178+ # Use `Range#cover?` instead of `Range#include?` (or `Range#member?`).
179+ Performance/RangeInclude :
180+ Enabled : true
181+
182+ # Use `yield` instead of `block.call`.
183+ Performance/RedundantBlockCall :
184+ Enabled : true
185+
186+ # Use `=~` instead of `String#match` or `Regexp#match` in a context where the returned `MatchData` is not needed.
187+ Performance/RedundantMatch :
188+ Enabled : true
189+
190+ # Use Hash#[]=, rather than Hash#merge! with a single key-value pair.
191+ Performance/RedundantMerge :
192+ Enabled : true
193+
194+ # Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`, `Regexp#===`, or `=~` when `MatchData` is not used.
195+ Performance/RegexpMatch :
196+ Enabled : true
197+
198+ # Use `reverse_each` instead of `reverse.each`.
199+ Performance/ReverseEach :
200+ Enabled : true
201+
202+ # Use `size` instead of `count` for counting the number of elements in `Array` and `Hash`.
203+ Performance/Size :
204+ Enabled : true
205+
206+ # Use `start_with?` instead of a regex match anchored to the beginning of a string.
207+ Performance/StartWith :
208+ Enabled : true
209+
210+ # Use `tr` instead of `gsub` when you are replacing the same number of characters.
211+ # Use `delete` instead of `gsub` when you are deleting characters.
212+ Performance/StringReplacement :
213+ Enabled : true
214+
215+ # Checks for .times.map calls.
216+ Performance/TimesMap :
217+ Enabled : true
218+
219+ # Use unary plus to get an unfrozen string literal.
220+ Performance/UnfreezeString :
221+ Enabled : true
222+
223+ # Use `URI::DEFAULT_PARSER` instead of `URI::Parser.new`.
224+ Performance/UriDefaultParser :
225+ Enabled : true
0 commit comments