rubocop-shopify 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config/default.yml +5 -0
- data/lib/rubocop/cop/style/proc_case_when.rb +140 -0
- data/lib/rubocop/shopify/version.rb +1 -1
- data/lib/rubocop-shopify.rb +3 -1
- data/lib/tasks/config.rake +10 -0
- data/rubocop.yml +34 -75
- metadata +5 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f94416de0fd49d1bac517f3d0e252ec142e57ddd4dd1e54ca7ca9bfff450c225
|
|
4
|
+
data.tar.gz: c3df65a2baf8b2ea61d4a654cb87f79059f0c0bb6b228094745c869037ad2263
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7bdf223592a04d7258d54952d716099729eb89f84c85c91ce4d3dfaf98edb5d59cce9e508278b81a8ef5cc0d15f5414a08e4ab6a3ad5826a61c261c47810d29c
|
|
7
|
+
data.tar.gz: 6b3574852de0cccc719e9cbf89090fd4c6184fdfe5c19059ed9c3b7004d6de8b8fcffec29b3a04604ab092b32f1eabda2fbc85a81e3d45a8d5a9faf434c6e8b0
|
data/config/default.yml
CHANGED
|
@@ -2,3 +2,8 @@ Lint/NoReturnInMemoization:
|
|
|
2
2
|
Enabled: true
|
|
3
3
|
VersionAdded: "3.0.0"
|
|
4
4
|
Description: "Checks for the use of a `return` with a value in `begin..end` blocks in the context of instance variable assignment such as memoization."
|
|
5
|
+
|
|
6
|
+
Style/ProcCaseWhen:
|
|
7
|
+
Enabled: true
|
|
8
|
+
VersionAdded: "3.0.2"
|
|
9
|
+
Description: "Checks for `case`/`when` where every `when` is a proc or value literal: each inline proc literal allocates a new `Proc` every time the `case` runs and adds `Proc#call` overhead, for what is just a harder-to-read `if`/`elsif` tree."
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rubocop"
|
|
4
|
+
|
|
5
|
+
module RuboCop
|
|
6
|
+
module Cop
|
|
7
|
+
module Style
|
|
8
|
+
# Checks for `case` statements whose `when` conditions are only proc/lambda
|
|
9
|
+
# literals and value literals (with at least one proc).
|
|
10
|
+
#
|
|
11
|
+
# Such a `case` is just a harder-to-read `if`/`elsif` tree with a needless
|
|
12
|
+
# performance cost: a `when` clause matches using `pattern === subject`,
|
|
13
|
+
# and for a proc `Proc#===` is an alias for `Proc#call`. Every inline proc
|
|
14
|
+
# literal therefore allocates a brand new `Proc` object each time the
|
|
15
|
+
# `case` is evaluated (on a hot path, once per branch per call) and adds
|
|
16
|
+
# `Proc#call` indirection, where an `if`/`elsif` allocates nothing. For a
|
|
17
|
+
# value literal (number, string, symbol, `nil`, `true`, `false`) `===` is
|
|
18
|
+
# `==`, so the whole statement is exactly equivalent to `if`/`elsif` using
|
|
19
|
+
# `Proc#call` and `==`. Use `if`/`elsif` instead.
|
|
20
|
+
#
|
|
21
|
+
# Constants assigned a proc literal or a value literal *in the same file*
|
|
22
|
+
# are resolved and treated as such. Constants defined in other files cannot
|
|
23
|
+
# be resolved: a bare `when SOME_CONST` is indistinguishable from matching
|
|
24
|
+
# against a class, so those are left alone to avoid flagging idiomatic
|
|
25
|
+
# `case obj when SomeClass`.
|
|
26
|
+
#
|
|
27
|
+
# Cases that use class, range, or regexp patterns are also left alone:
|
|
28
|
+
# those rely on `===` in ways that read far worse as `if` conditions
|
|
29
|
+
# (`is_a?`, `cover?`, `match?`), which is exactly what `case` is for.
|
|
30
|
+
#
|
|
31
|
+
# @example
|
|
32
|
+
#
|
|
33
|
+
# # bad - every `when` is a proc (a new proc is allocated on each call)
|
|
34
|
+
# case value
|
|
35
|
+
# when ->(x) { x > 10 } then :big
|
|
36
|
+
# when ->(x) { x < 0 } then :negative
|
|
37
|
+
# else :other
|
|
38
|
+
# end
|
|
39
|
+
#
|
|
40
|
+
# # bad - only procs and value literals (including value-literal constants)
|
|
41
|
+
# NAME = "widget"
|
|
42
|
+
# case value
|
|
43
|
+
# when NAME then :named
|
|
44
|
+
# when ->(x) { x > 10 } then :big
|
|
45
|
+
# end
|
|
46
|
+
#
|
|
47
|
+
# # good - no proc allocation, and easier to read
|
|
48
|
+
# if value > 10
|
|
49
|
+
# :big
|
|
50
|
+
# elsif value < 0
|
|
51
|
+
# :negative
|
|
52
|
+
# else
|
|
53
|
+
# :other
|
|
54
|
+
# end
|
|
55
|
+
#
|
|
56
|
+
# # good - a class/range/regexp pattern makes `case` the clearer choice,
|
|
57
|
+
# # even alongside a proc.
|
|
58
|
+
# case value
|
|
59
|
+
# when Integer then :int
|
|
60
|
+
# when ->(x) { x > 10 } then :big
|
|
61
|
+
# end
|
|
62
|
+
class ProcCaseWhen < ::RuboCop::Cop::Base
|
|
63
|
+
MSG = "Avoid a `case`/`when` where every `when` is a proc or value " \
|
|
64
|
+
"literal: each proc literal allocates a new `Proc` every time the " \
|
|
65
|
+
"`case` is evaluated and adds `Proc#call` overhead, and the whole " \
|
|
66
|
+
"thing is just a harder-to-read `if`/`elsif` tree. Use `if`/`elsif` " \
|
|
67
|
+
"instead."
|
|
68
|
+
|
|
69
|
+
# Matches `->(x) {}`, `lambda {}`, `proc {}` and `Proc.new {}`, including
|
|
70
|
+
# their numbered-parameter (`_1`) block variants.
|
|
71
|
+
# @!method proc_literal?(node)
|
|
72
|
+
def_node_matcher :proc_literal?, <<~PATTERN
|
|
73
|
+
{
|
|
74
|
+
({block numblock} (send nil? {:lambda :proc}) ...)
|
|
75
|
+
({block numblock} (send (const {nil? cbase} :Proc) :new) ...)
|
|
76
|
+
}
|
|
77
|
+
PATTERN
|
|
78
|
+
|
|
79
|
+
def on_new_investigation
|
|
80
|
+
super
|
|
81
|
+
@constant_kinds = collect_constant_kinds
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def on_case(node)
|
|
85
|
+
# `case` without a subject evaluates each `when` for truthiness rather
|
|
86
|
+
# than with `===`, so procs there are not used as matchers.
|
|
87
|
+
return unless node.condition
|
|
88
|
+
|
|
89
|
+
kinds = node.when_branches.flat_map(&:conditions).map { |condition| kind_of(condition) }
|
|
90
|
+
# Require at least one proc; a case of only value literals is a fine
|
|
91
|
+
# dispatch and out of scope here.
|
|
92
|
+
return unless kinds.include?(:proc)
|
|
93
|
+
# Bail out if any condition is something other than a proc or a value
|
|
94
|
+
# literal (e.g. a class, range, regexp, or an unresolvable constant),
|
|
95
|
+
# where `case` reads better than the equivalent `if`.
|
|
96
|
+
return unless kinds.all? { |kind| kind == :proc || kind == :value }
|
|
97
|
+
|
|
98
|
+
add_offense(node)
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
private
|
|
102
|
+
|
|
103
|
+
# Classifies a `when` condition (or a constant's assigned value) as a
|
|
104
|
+
# proc, a value literal, or `:other` (anything we should not rewrite).
|
|
105
|
+
def kind_of(node)
|
|
106
|
+
# Unwrap a trailing `.freeze` so `FOO = "bar".freeze` counts as a value.
|
|
107
|
+
node = node.receiver if node.send_type? && node.method?(:freeze) && node.receiver
|
|
108
|
+
|
|
109
|
+
if proc_literal?(node)
|
|
110
|
+
:proc
|
|
111
|
+
elsif node.basic_literal?
|
|
112
|
+
:value
|
|
113
|
+
elsif node.const_type?
|
|
114
|
+
# `@constant_kinds` is still nil while being built; an unresolved
|
|
115
|
+
# constant is treated as `:other` (conservative).
|
|
116
|
+
(@constant_kinds || {}).fetch(node.short_name, :other)
|
|
117
|
+
else
|
|
118
|
+
:other
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# Maps the short (demodulized) name of every constant assigned in this
|
|
123
|
+
# file to its kind, so bare `when CONST` references can be resolved.
|
|
124
|
+
def collect_constant_kinds
|
|
125
|
+
kinds = {}
|
|
126
|
+
ast = processed_source.ast
|
|
127
|
+
return kinds unless ast
|
|
128
|
+
|
|
129
|
+
ast.each_node(:casgn) do |casgn|
|
|
130
|
+
value = casgn.children[2]
|
|
131
|
+
next unless value
|
|
132
|
+
|
|
133
|
+
kinds[casgn.name] = kind_of(value)
|
|
134
|
+
end
|
|
135
|
+
kinds
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
data/lib/rubocop-shopify.rb
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "rubocop"
|
|
3
4
|
require "rubocop/shopify/version"
|
|
4
5
|
require "rubocop/shopify/plugin"
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
RuboCop::Cop::Lint.register_cop :NoReturnInMemoization, "#{__dir__}/rubocop/cop/lint/no_return_in_memoization"
|
|
8
|
+
RuboCop::Cop::Style.register_cop :ProcCaseWhen, "#{__dir__}/rubocop/cop/style/proc_case_when"
|
data/lib/tasks/config.rake
CHANGED
|
@@ -8,6 +8,16 @@ namespace :config do
|
|
|
8
8
|
file = "rubocop.yml"
|
|
9
9
|
target = args.fetch(:target, "test/fixtures/full_config.yml")
|
|
10
10
|
|
|
11
|
+
# Reset the default configuration and loaded plugins so that plugins loaded
|
|
12
|
+
# as side effects of running tests (e.g. rubocop-minitest's
|
|
13
|
+
# AssertOffense#integrate_plugins!) do not leak into the dump. Without this,
|
|
14
|
+
# integrate_plugins! injects all installed lint_roller plugins into the
|
|
15
|
+
# global default_configuration, and a prior load_file("rubocop.yml") marks
|
|
16
|
+
# rubocop-shopify as already loaded so resolve_plugins skips re-injecting it
|
|
17
|
+
# after the reset. Both are lazily rebuilt on the next access.
|
|
18
|
+
RuboCop::ConfigLoader.instance_variable_set(:@default_configuration, nil)
|
|
19
|
+
RuboCop::ConfigLoader.loaded_plugins.clear
|
|
20
|
+
|
|
11
21
|
file_config = RuboCop::ConfigLoader.load_file(file)
|
|
12
22
|
config = RuboCop::ConfigLoader.merge_with_default(file_config, file)
|
|
13
23
|
output = config.to_h.to_yaml.gsub(config.base_dir_for_path_parameters, "")
|
data/rubocop.yml
CHANGED
|
@@ -23,10 +23,8 @@ Bundler/OrderedGems:
|
|
|
23
23
|
Gemspec/AddRuntimeDependency:
|
|
24
24
|
Enabled: false
|
|
25
25
|
|
|
26
|
-
<% if rubocop_version >= '1.77' %>
|
|
27
26
|
Gemspec/AttributeAssignment:
|
|
28
27
|
Enabled: true
|
|
29
|
-
<% end %>
|
|
30
28
|
|
|
31
29
|
Gemspec/DeprecatedAttributeAssignment:
|
|
32
30
|
Enabled: true
|
|
@@ -79,10 +77,8 @@ Layout/EmptyLineAfterGuardClause:
|
|
|
79
77
|
Layout/EmptyLines:
|
|
80
78
|
Enabled: false
|
|
81
79
|
|
|
82
|
-
<% if rubocop_version >= '1.79' %>
|
|
83
80
|
Layout/EmptyLinesAfterModuleInclusion:
|
|
84
81
|
Enabled: false
|
|
85
|
-
<% end %>
|
|
86
82
|
|
|
87
83
|
Layout/EndAlignment:
|
|
88
84
|
Enabled: false
|
|
@@ -189,6 +185,11 @@ Lint/AmbiguousRange:
|
|
|
189
185
|
Lint/AmbiguousRegexpLiteral:
|
|
190
186
|
Enabled: false
|
|
191
187
|
|
|
188
|
+
<% if rubocop_version >= "1.91.0" %>
|
|
189
|
+
Lint/ArgumentMismatch:
|
|
190
|
+
Enabled: false
|
|
191
|
+
<% end %>
|
|
192
|
+
|
|
192
193
|
Lint/ArrayLiteralInRegexp:
|
|
193
194
|
Enabled: false
|
|
194
195
|
|
|
@@ -207,17 +208,15 @@ Lint/ConstantOverwrittenInRescue:
|
|
|
207
208
|
Lint/ConstantReassignment:
|
|
208
209
|
Enabled: true
|
|
209
210
|
|
|
210
|
-
Lint/CopDirectiveSyntax:
|
|
211
|
-
Enabled: true
|
|
212
|
-
|
|
213
|
-
<% if rubocop_version >= "1.85" %>
|
|
214
211
|
Lint/DataDefineOverride:
|
|
215
212
|
Enabled: true
|
|
216
|
-
<% end %>
|
|
217
213
|
|
|
218
214
|
Lint/DeprecatedConstants:
|
|
219
215
|
Enabled: false
|
|
220
216
|
|
|
217
|
+
Lint/DeprecatedReference:
|
|
218
|
+
Enabled: false
|
|
219
|
+
|
|
221
220
|
Lint/DuplicateBranch:
|
|
222
221
|
Enabled: false
|
|
223
222
|
|
|
@@ -293,6 +292,11 @@ Lint/LiteralAssignmentInCondition:
|
|
|
293
292
|
Lint/Loop:
|
|
294
293
|
Enabled: false
|
|
295
294
|
|
|
295
|
+
<% if rubocop_version >= "1.91.0" %>
|
|
296
|
+
Lint/MisplacedMagicComment:
|
|
297
|
+
Enabled: false
|
|
298
|
+
<% end %>
|
|
299
|
+
|
|
296
300
|
Lint/MissingSuper:
|
|
297
301
|
Enabled: false
|
|
298
302
|
|
|
@@ -302,6 +306,9 @@ Lint/MixedCaseRange:
|
|
|
302
306
|
Lint/MixedRegexpCaptureTypes:
|
|
303
307
|
Enabled: false
|
|
304
308
|
|
|
309
|
+
Lint/NameTypo:
|
|
310
|
+
Enabled: false
|
|
311
|
+
|
|
305
312
|
Lint/NoReturnInBeginEndBlocks:
|
|
306
313
|
Enabled: false
|
|
307
314
|
|
|
@@ -392,17 +399,17 @@ Lint/ShadowedArgument:
|
|
|
392
399
|
Lint/ShadowedException:
|
|
393
400
|
Enabled: false
|
|
394
401
|
|
|
395
|
-
<% if rubocop_version < "1.76" %>
|
|
396
|
-
Lint/ShadowingOuterLocalVariable:
|
|
397
|
-
Enabled: false
|
|
398
|
-
<% end %>
|
|
399
|
-
|
|
400
402
|
Lint/SharedMutableDefault:
|
|
401
403
|
Enabled: false
|
|
402
404
|
|
|
403
405
|
Lint/StructNewOverride:
|
|
404
406
|
Enabled: false
|
|
405
407
|
|
|
408
|
+
<% if rubocop_version >= "1.91.0" %>
|
|
409
|
+
Lint/SuperArgumentMismatch:
|
|
410
|
+
Enabled: false
|
|
411
|
+
<% end %>
|
|
412
|
+
|
|
406
413
|
Lint/SuppressedException:
|
|
407
414
|
Enabled: false
|
|
408
415
|
|
|
@@ -445,10 +452,8 @@ Lint/UnreachableCode:
|
|
|
445
452
|
Lint/UnreachableLoop:
|
|
446
453
|
Enabled: false
|
|
447
454
|
|
|
448
|
-
<% if rubocop_version >= "1.85" %>
|
|
449
455
|
Lint/UnreachablePatternBranch:
|
|
450
456
|
Enabled: true
|
|
451
|
-
<% end %>
|
|
452
457
|
|
|
453
458
|
Lint/UnusedBlockArgument:
|
|
454
459
|
Enabled: false
|
|
@@ -471,10 +476,8 @@ Lint/UselessAssignment:
|
|
|
471
476
|
Lint/UselessConstantScoping:
|
|
472
477
|
Enabled: false
|
|
473
478
|
|
|
474
|
-
<% if rubocop_version >= "1.76" %>
|
|
475
479
|
Lint/UselessDefaultValueArgument:
|
|
476
480
|
Enabled: true
|
|
477
|
-
<% end %>
|
|
478
481
|
|
|
479
482
|
Lint/UselessDefined:
|
|
480
483
|
Enabled: false
|
|
@@ -488,10 +491,8 @@ Lint/UselessMethodDefinition:
|
|
|
488
491
|
Lint/UselessNumericOperation:
|
|
489
492
|
Enabled: false
|
|
490
493
|
|
|
491
|
-
<% if rubocop_version >= "1.76" %>
|
|
492
494
|
Lint/UselessOr:
|
|
493
495
|
Enabled: true
|
|
494
|
-
<% end %>
|
|
495
496
|
|
|
496
497
|
Lint/UselessRescue:
|
|
497
498
|
Enabled: false
|
|
@@ -563,16 +564,10 @@ Naming/MemoizedInstanceVariableName:
|
|
|
563
564
|
Naming/MethodParameterName:
|
|
564
565
|
MinNameLength: 1
|
|
565
566
|
|
|
566
|
-
<% if rubocop_version >= "1.76" %>
|
|
567
567
|
Naming/PredicateMethod:
|
|
568
568
|
Enabled: false
|
|
569
|
-
<% end %>
|
|
570
569
|
|
|
571
|
-
<% if rubocop_version >= "1.76" %>
|
|
572
570
|
Naming/PredicatePrefix:
|
|
573
|
-
<% else %>
|
|
574
|
-
Naming/PredicateName:
|
|
575
|
-
<% end %>
|
|
576
571
|
Enabled: false
|
|
577
572
|
NamePrefix:
|
|
578
573
|
- is_
|
|
@@ -632,10 +627,8 @@ Style/ArrayCoercion:
|
|
|
632
627
|
Style/ArrayIntersect:
|
|
633
628
|
Enabled: false
|
|
634
629
|
|
|
635
|
-
<% if rubocop_version >= '1.81' %>
|
|
636
630
|
Style/ArrayIntersectWithSingleElement:
|
|
637
631
|
Enabled: false
|
|
638
|
-
<% end %>
|
|
639
632
|
|
|
640
633
|
Style/ArrayJoin:
|
|
641
634
|
Enabled: false
|
|
@@ -679,10 +672,8 @@ Style/ClassMethodsDefinitions:
|
|
|
679
672
|
Style/CollectionCompact:
|
|
680
673
|
Enabled: false
|
|
681
674
|
|
|
682
|
-
<% if rubocop_version >= '1.77' %>
|
|
683
675
|
Style/CollectionQuerying:
|
|
684
676
|
Enabled: false
|
|
685
|
-
<% end %>
|
|
686
677
|
|
|
687
678
|
Style/CombinableDefined:
|
|
688
679
|
Enabled: true
|
|
@@ -700,10 +691,8 @@ Style/CommentAnnotation:
|
|
|
700
691
|
Style/CommentedKeyword:
|
|
701
692
|
Enabled: false
|
|
702
693
|
|
|
703
|
-
<% if rubocop_version >= "1.74" %>
|
|
704
694
|
Style/ComparableBetween:
|
|
705
695
|
Enabled: false
|
|
706
|
-
<% end %>
|
|
707
696
|
|
|
708
697
|
Style/ComparableClamp:
|
|
709
698
|
Enabled: false
|
|
@@ -726,14 +715,21 @@ Style/Dir:
|
|
|
726
715
|
Style/DirEmpty:
|
|
727
716
|
Enabled: false
|
|
728
717
|
|
|
718
|
+
<% if rubocop_version >= "1.91.0" %>
|
|
719
|
+
Style/DirectiveScope:
|
|
720
|
+
Enabled: false
|
|
721
|
+
<% end %>
|
|
722
|
+
|
|
729
723
|
Style/DocumentDynamicEvalDefinition:
|
|
730
724
|
Enabled: false
|
|
731
725
|
|
|
732
726
|
Style/Documentation:
|
|
733
727
|
Enabled: false
|
|
734
728
|
|
|
729
|
+
<% if rubocop_version < "1.91.0" %>
|
|
735
730
|
Style/DoubleCopDisableDirective:
|
|
736
731
|
Enabled: false
|
|
732
|
+
<% end %>
|
|
737
733
|
|
|
738
734
|
Style/DoubleNegation:
|
|
739
735
|
Enabled: false
|
|
@@ -750,10 +746,8 @@ Style/EmptyBlockParameter:
|
|
|
750
746
|
Style/EmptyCaseCondition:
|
|
751
747
|
Enabled: false
|
|
752
748
|
|
|
753
|
-
<% if rubocop_version >= "1.84" %>
|
|
754
749
|
Style/EmptyClassDefinition:
|
|
755
750
|
Enabled: false
|
|
756
|
-
<% end %>
|
|
757
751
|
|
|
758
752
|
Style/EmptyElse:
|
|
759
753
|
Enabled: false
|
|
@@ -771,10 +765,8 @@ Style/EmptyLiteral:
|
|
|
771
765
|
Style/EmptyMethod:
|
|
772
766
|
Enabled: false
|
|
773
767
|
|
|
774
|
-
<% if rubocop_version >= "1.76" %>
|
|
775
768
|
Style/EmptyStringInsideInterpolation:
|
|
776
769
|
Enabled: false
|
|
777
|
-
<% end %>
|
|
778
770
|
|
|
779
771
|
Style/Encoding:
|
|
780
772
|
Enabled: false
|
|
@@ -815,10 +807,8 @@ Style/FileEmpty:
|
|
|
815
807
|
Style/FileNull:
|
|
816
808
|
Enabled: false
|
|
817
809
|
|
|
818
|
-
<% if rubocop_version >= "1.85" %>
|
|
819
810
|
Style/FileOpen:
|
|
820
811
|
Enabled: false
|
|
821
|
-
<% end %>
|
|
822
812
|
|
|
823
813
|
Style/FileRead:
|
|
824
814
|
Enabled: false
|
|
@@ -866,10 +856,8 @@ Style/HashEachMethods:
|
|
|
866
856
|
Style/HashExcept:
|
|
867
857
|
Enabled: false
|
|
868
858
|
|
|
869
|
-
<% if rubocop_version >= "1.75" %>
|
|
870
859
|
Style/HashFetchChain:
|
|
871
860
|
Enabled: false
|
|
872
|
-
<% end %>
|
|
873
861
|
|
|
874
862
|
Style/HashLikeCase:
|
|
875
863
|
Enabled: false
|
|
@@ -913,10 +901,8 @@ Style/InverseMethods:
|
|
|
913
901
|
Style/ItAssignment:
|
|
914
902
|
Enabled: false
|
|
915
903
|
|
|
916
|
-
<% if rubocop_version >= "1.75" %>
|
|
917
904
|
Style/ItBlockParameter:
|
|
918
905
|
Enabled: false
|
|
919
|
-
<% end %>
|
|
920
906
|
|
|
921
907
|
Style/KeywordArgumentsMerging:
|
|
922
908
|
Enabled: false
|
|
@@ -943,10 +929,8 @@ Style/MapCompactWithConditionalBlock:
|
|
|
943
929
|
Style/MapIntoArray:
|
|
944
930
|
Enabled: false
|
|
945
931
|
|
|
946
|
-
<% if rubocop_version >= "1.85" %>
|
|
947
932
|
Style/MapJoin:
|
|
948
933
|
Enabled: true
|
|
949
|
-
<% end %>
|
|
950
934
|
|
|
951
935
|
Style/MapToHash:
|
|
952
936
|
Enabled: false
|
|
@@ -987,10 +971,8 @@ Style/ModuleFunction:
|
|
|
987
971
|
Enabled: false
|
|
988
972
|
EnforcedStyle: extend_self
|
|
989
973
|
|
|
990
|
-
<% if rubocop_version >= "1.82" %>
|
|
991
974
|
Style/ModuleMemberExistenceCheck:
|
|
992
975
|
Enabled: true
|
|
993
|
-
<% end %>
|
|
994
976
|
|
|
995
977
|
Style/MultilineBlockChain:
|
|
996
978
|
Enabled: false
|
|
@@ -1028,10 +1010,8 @@ Style/NegatedUnless:
|
|
|
1028
1010
|
Style/NegatedWhile:
|
|
1029
1011
|
Enabled: false
|
|
1030
1012
|
|
|
1031
|
-
<% if rubocop_version >= "1.84" %>
|
|
1032
1013
|
Style/NegativeArrayIndex:
|
|
1033
1014
|
Enabled: true
|
|
1034
|
-
<% end %>
|
|
1035
1015
|
|
|
1036
1016
|
Style/NestedFileDirname:
|
|
1037
1017
|
Enabled: false
|
|
@@ -1078,10 +1058,8 @@ Style/NumericPredicate:
|
|
|
1078
1058
|
Style/ObjectThen:
|
|
1079
1059
|
Enabled: false
|
|
1080
1060
|
|
|
1081
|
-
<% if rubocop_version >= "1.85" %>
|
|
1082
1061
|
Style/OneClassPerFile:
|
|
1083
1062
|
Enabled: false
|
|
1084
|
-
<% end %>
|
|
1085
1063
|
|
|
1086
1064
|
Style/OneLineConditional:
|
|
1087
1065
|
Enabled: false
|
|
@@ -1107,10 +1085,8 @@ Style/ParallelAssignment:
|
|
|
1107
1085
|
Style/ParenthesesAroundCondition:
|
|
1108
1086
|
Enabled: false
|
|
1109
1087
|
|
|
1110
|
-
<% if rubocop_version >= "1.85" %>
|
|
1111
1088
|
Style/PartitionInsteadOfDoubleSelect:
|
|
1112
1089
|
Enabled: false
|
|
1113
|
-
<% end %>
|
|
1114
1090
|
|
|
1115
1091
|
Style/PercentLiteralDelimiters:
|
|
1116
1092
|
Enabled: false
|
|
@@ -1121,10 +1097,8 @@ Style/PercentQLiterals:
|
|
|
1121
1097
|
Style/PerlBackrefs:
|
|
1122
1098
|
Enabled: false
|
|
1123
1099
|
|
|
1124
|
-
<% if rubocop_version >= "1.85" %>
|
|
1125
1100
|
Style/PredicateWithKind:
|
|
1126
1101
|
Enabled: false
|
|
1127
|
-
<% end %>
|
|
1128
1102
|
|
|
1129
1103
|
Style/PreferredHashMethods:
|
|
1130
1104
|
Enabled: false
|
|
@@ -1141,10 +1115,8 @@ Style/RaiseArgs:
|
|
|
1141
1115
|
Style/RandomWithOffset:
|
|
1142
1116
|
Enabled: false
|
|
1143
1117
|
|
|
1144
|
-
<% if rubocop_version >= "1.85" %>
|
|
1145
1118
|
Style/ReduceToHash:
|
|
1146
|
-
Enabled:
|
|
1147
|
-
<% end %>
|
|
1119
|
+
Enabled: false
|
|
1148
1120
|
|
|
1149
1121
|
Style/RedundantArgument:
|
|
1150
1122
|
Enabled: false
|
|
@@ -1152,10 +1124,8 @@ Style/RedundantArgument:
|
|
|
1152
1124
|
Style/RedundantArrayConstructor:
|
|
1153
1125
|
Enabled: false
|
|
1154
1126
|
|
|
1155
|
-
<% if rubocop_version >= "1.76" %>
|
|
1156
1127
|
Style/RedundantArrayFlatten:
|
|
1157
1128
|
Enabled: true
|
|
1158
|
-
<% end %>
|
|
1159
1129
|
|
|
1160
1130
|
Style/RedundantAssignment:
|
|
1161
1131
|
Enabled: false
|
|
@@ -1196,9 +1166,6 @@ Style/RedundantFilterChain:
|
|
|
1196
1166
|
Style/RedundantFormat:
|
|
1197
1167
|
Enabled: false
|
|
1198
1168
|
|
|
1199
|
-
Style/RedundantFreeze:
|
|
1200
|
-
Enabled: false
|
|
1201
|
-
|
|
1202
1169
|
Style/RedundantHeredocDelimiterQuotes:
|
|
1203
1170
|
Enabled: false
|
|
1204
1171
|
|
|
@@ -1214,10 +1181,8 @@ Style/RedundantInterpolationUnfreeze:
|
|
|
1214
1181
|
Style/RedundantLineContinuation:
|
|
1215
1182
|
Enabled: false
|
|
1216
1183
|
|
|
1217
|
-
<% if rubocop_version >= "1.85" %>
|
|
1218
1184
|
Style/RedundantMinMaxBy:
|
|
1219
1185
|
Enabled: true
|
|
1220
|
-
<% end %>
|
|
1221
1186
|
|
|
1222
1187
|
Style/RedundantParentheses:
|
|
1223
1188
|
Enabled: false
|
|
@@ -1234,9 +1199,6 @@ Style/RedundantRegexpCharacterClass:
|
|
|
1234
1199
|
Style/RedundantRegexpConstructor:
|
|
1235
1200
|
Enabled: false
|
|
1236
1201
|
|
|
1237
|
-
Style/RedundantRegexpEscape:
|
|
1238
|
-
Enabled: false
|
|
1239
|
-
|
|
1240
1202
|
Style/RedundantSelf:
|
|
1241
1203
|
Enabled: false
|
|
1242
1204
|
|
|
@@ -1268,10 +1230,8 @@ Style/RescueStandardError:
|
|
|
1268
1230
|
Style/ReturnNilInPredicateMethodDefinition:
|
|
1269
1231
|
Enabled: false
|
|
1270
1232
|
|
|
1271
|
-
<% if rubocop_version >= "1.84" %>
|
|
1272
1233
|
Style/ReverseFind:
|
|
1273
1234
|
Enabled: false
|
|
1274
|
-
<% end %>
|
|
1275
1235
|
|
|
1276
1236
|
Style/SafeNavigation:
|
|
1277
1237
|
Enabled: false
|
|
@@ -1282,15 +1242,11 @@ Style/SafeNavigationChainLength:
|
|
|
1282
1242
|
Style/Sample:
|
|
1283
1243
|
Enabled: false
|
|
1284
1244
|
|
|
1285
|
-
<% if rubocop_version >= "1.85" %>
|
|
1286
1245
|
Style/SelectByKind:
|
|
1287
1246
|
Enabled: true
|
|
1288
|
-
<% end %>
|
|
1289
1247
|
|
|
1290
|
-
<% if rubocop_version >= "1.85" %>
|
|
1291
1248
|
Style/SelectByRange:
|
|
1292
1249
|
Enabled: true
|
|
1293
|
-
<% end %>
|
|
1294
1250
|
|
|
1295
1251
|
Style/SelectByRegexp:
|
|
1296
1252
|
Enabled: false
|
|
@@ -1362,14 +1318,17 @@ Style/SymbolArray:
|
|
|
1362
1318
|
Style/SymbolProc:
|
|
1363
1319
|
Enabled: false
|
|
1364
1320
|
|
|
1365
|
-
<% if rubocop_version >= "1.85" %>
|
|
1366
1321
|
Style/TallyMethod:
|
|
1367
1322
|
Enabled: true
|
|
1368
|
-
<% end %>
|
|
1369
1323
|
|
|
1370
1324
|
Style/TernaryParentheses:
|
|
1371
1325
|
Enabled: false
|
|
1372
1326
|
|
|
1327
|
+
<% if rubocop_version >= "1.91.0" %>
|
|
1328
|
+
Style/TimeNow:
|
|
1329
|
+
Enabled: false
|
|
1330
|
+
<% end %>
|
|
1331
|
+
|
|
1373
1332
|
Style/TrailingCommaInArguments:
|
|
1374
1333
|
Enabled: false
|
|
1375
1334
|
EnforcedStyleForMultiline: comma
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rubocop-shopify
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0
|
|
4
|
+
version: 3.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shopify Engineering
|
|
@@ -15,20 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '1.
|
|
19
|
-
- - ">="
|
|
20
|
-
- !ruby/object:Gem::Version
|
|
21
|
-
version: 1.72.1
|
|
18
|
+
version: '1.89'
|
|
22
19
|
type: :runtime
|
|
23
20
|
prerelease: false
|
|
24
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
22
|
requirements:
|
|
26
23
|
- - "~>"
|
|
27
24
|
- !ruby/object:Gem::Version
|
|
28
|
-
version: '1.
|
|
29
|
-
- - ">="
|
|
30
|
-
- !ruby/object:Gem::Version
|
|
31
|
-
version: 1.72.1
|
|
25
|
+
version: '1.89'
|
|
32
26
|
- !ruby/object:Gem::Dependency
|
|
33
27
|
name: lint_roller
|
|
34
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -55,6 +49,7 @@ files:
|
|
|
55
49
|
- config/default.yml
|
|
56
50
|
- lib/rubocop-shopify.rb
|
|
57
51
|
- lib/rubocop/cop/lint/no_return_in_memoization.rb
|
|
52
|
+
- lib/rubocop/cop/style/proc_case_when.rb
|
|
58
53
|
- lib/rubocop/shopify/plugin.rb
|
|
59
54
|
- lib/rubocop/shopify/version.rb
|
|
60
55
|
- lib/tasks/config.rake
|
|
@@ -63,7 +58,7 @@ homepage: https://shopify.github.io/ruby-style-guide/
|
|
|
63
58
|
licenses:
|
|
64
59
|
- MIT
|
|
65
60
|
metadata:
|
|
66
|
-
source_code_uri: https://github.com/Shopify/ruby-style-guide/tree/v3.0
|
|
61
|
+
source_code_uri: https://github.com/Shopify/ruby-style-guide/tree/v3.1.0
|
|
67
62
|
allowed_push_host: https://rubygems.org
|
|
68
63
|
default_lint_roller_plugin: RuboCop::Shopify::Plugin
|
|
69
64
|
rdoc_options: []
|