rubocop-minitest 0.34.2 → 0.34.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e4b8d1f63d66f8d5c75e7df19dba8c07f62d7da0ac637a9b92014d865fe0314
|
4
|
+
data.tar.gz: 1bf5ef6960646dd7b2e84b947bde08fe5b6fabbdd40a4c78c41cc59112a9181b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5bf6ff7d580d5223a90735e7f4f81a528ef14ce943689b24fad9561070bb02f2bbd569bd4dd5c79466781b1e5292e5008be428b1b5694b6c501c91d567fc933
|
7
|
+
data.tar.gz: 37f1a56983839444e99921b3f8c664e4b7d3388e6dff081e17b899a3281e44ec45fe9bca3fcd06aef6791d955a88053010efddaa5ffd9d30e2b875a54aff3118
|
@@ -53,22 +53,44 @@ module RuboCop
|
|
53
53
|
def assertions_count(node)
|
54
54
|
return 0 unless node.is_a?(RuboCop::AST::Node)
|
55
55
|
|
56
|
-
assertions =
|
57
|
-
case node.type
|
58
|
-
when :if, :case, :case_match
|
59
|
-
assertions_count_in_branches(node.branches)
|
60
|
-
when :rescue
|
61
|
-
assertions_count(node.body) + assertions_count_in_branches(node.branches)
|
62
|
-
when :block, :numblock
|
63
|
-
assertions_count(node.body)
|
64
|
-
else
|
65
|
-
node.each_child_node.sum { |child| assertions_count(child) }
|
66
|
-
end
|
67
|
-
|
56
|
+
assertions = assertions_count_based_on_type(node)
|
68
57
|
assertions += 1 if assertion_method?(node)
|
69
58
|
assertions
|
70
59
|
end
|
71
60
|
|
61
|
+
def assertions_count_based_on_type(node)
|
62
|
+
case node.type
|
63
|
+
when :if, :case, :case_match
|
64
|
+
assertions_count_in_branches(node.branches)
|
65
|
+
when :rescue
|
66
|
+
assertions_count(node.body) + assertions_count_in_branches(node.branches)
|
67
|
+
when :block, :numblock
|
68
|
+
assertions_count(node.body)
|
69
|
+
when *RuboCop::AST::Node::ASSIGNMENTS
|
70
|
+
assertions_count_in_assignment(node)
|
71
|
+
else
|
72
|
+
node.each_child_node.sum { |child| assertions_count(child) }
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def assertions_count_in_assignment(node)
|
77
|
+
return assertions_count_based_on_type(node.expression) unless node.masgn_type?
|
78
|
+
|
79
|
+
rhs = node.children.last
|
80
|
+
|
81
|
+
case rhs.type
|
82
|
+
when :array
|
83
|
+
rhs.children.sum { |child| assertions_count_based_on_type(child) }
|
84
|
+
when :send
|
85
|
+
assertion_method?(rhs) ? 1 : 0
|
86
|
+
else
|
87
|
+
# Play it safe and bail if we don't have any explicit handling for whatever
|
88
|
+
# the RHS type is, since at this point we're already probably dealing with
|
89
|
+
# a pretty exotic situation that's unlikely in the real world.
|
90
|
+
0
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
72
94
|
def assertions_count_in_branches(branches)
|
73
95
|
branches.map { |branch| assertions_count(branch) }.max
|
74
96
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-minitest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.34.
|
4
|
+
version: 0.34.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-01-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubocop
|
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
157
|
- !ruby/object:Gem::Version
|
158
158
|
version: '0'
|
159
159
|
requirements: []
|
160
|
-
rubygems_version: 3.
|
160
|
+
rubygems_version: 3.5.3
|
161
161
|
signing_key:
|
162
162
|
specification_version: 4
|
163
163
|
summary: Automatic Minitest code style checking tool.
|