branchproof 0.11.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/doc/Branchproof/Source.md +5 -0
- data/doc/CHANGELOG.md +7 -0
- data/lib/branchproof/source.rb +10 -1
- data/lib/branchproof/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a65f0492effca7846e6b1c25d58eef4cccf3dec446e6607f7cda648c7b39572c
|
|
4
|
+
data.tar.gz: 7144faf352290f1ebc35b799a789e9e7cf6acd18766c9d65a7a55719339d5fe1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c4de5efafb2e4b4b0dc0d9229b55dd46cd2d234557df2cb073d922d5dea48bb931013f64941e8f0c87e258b6c3ab02478f2f4f09afaa778919a2d113bb69a694
|
|
7
|
+
data.tar.gz: f0d86816c36b90f537a26fd1485e107d154d77eb1e189522ad833da2231886c098257a881afabab50e9a41de2ea4ebcf543b30d182ce1e09731fc782e2a61669
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.11.1] - 2026-09-28
|
|
4
|
+
|
|
5
|
+
- Treat string, interpolated string, symbol, and numeric literal conditions as
|
|
6
|
+
always truthy. Rules that need such a literal to be falsey, as in
|
|
7
|
+
`name || "Item #{id}"`, are now excluded as statically impossible instead of
|
|
8
|
+
being reported as missing with unknown reachability.
|
|
9
|
+
|
|
3
10
|
## [0.11.0] - 2026-09-25
|
|
4
11
|
|
|
5
12
|
- Add validated coverage policies for Decision, Condition, Condition/Decision,
|
data/doc/Branchproof/Source.md
CHANGED
|
@@ -8,6 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
Inventories supported condition and decision occurrences from Ruby files.
|
|
10
10
|
|
|
11
|
+
## Constants
|
|
12
|
+
### `ALWAYS_TRUTHY_LITERALS` <a id="constant-ALWAYS_TRUTHY_LITERALS"></a> <a id="ALWAYS_TRUTHY_LITERALS-constant"></a>
|
|
13
|
+
Strings, symbols, and numbers are always truthy. A regexp literal in a
|
|
14
|
+
condition matches against $_, so its truth is not static.
|
|
15
|
+
|
|
11
16
|
## Attributes
|
|
12
17
|
### `limits` [R] <a id="attribute-i-limits"></a> <a id="limits-instance_method"></a>
|
|
13
18
|
Returns the value of attribute limits.
|
data/doc/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.11.1] - 2026-09-28
|
|
4
|
+
|
|
5
|
+
- Treat string, interpolated string, symbol, and numeric literal conditions as
|
|
6
|
+
always truthy. Rules that need such a literal to be falsey, as in
|
|
7
|
+
`name || "Item #{id}"`, are now excluded as statically impossible instead of
|
|
8
|
+
being reported as missing with unknown reachability.
|
|
9
|
+
|
|
3
10
|
## [0.11.0] - 2026-09-25
|
|
4
11
|
|
|
5
12
|
- Add validated coverage policies for Decision, Condition, Condition/Decision,
|
data/lib/branchproof/source.rb
CHANGED
|
@@ -22,6 +22,15 @@ module Branchproof
|
|
|
22
22
|
prepend DefaultSyntax
|
|
23
23
|
prepend ValueSyntax
|
|
24
24
|
|
|
25
|
+
# Strings, symbols, and numbers are always truthy. A regexp literal in a
|
|
26
|
+
# condition matches against $_, so its truth is not static.
|
|
27
|
+
ALWAYS_TRUTHY_LITERALS = [
|
|
28
|
+
Prism::TrueNode, Prism::StringNode, Prism::InterpolatedStringNode,
|
|
29
|
+
Prism::SymbolNode, Prism::InterpolatedSymbolNode, Prism::IntegerNode,
|
|
30
|
+
Prism::FloatNode, Prism::RationalNode, Prism::ImaginaryNode
|
|
31
|
+
].freeze
|
|
32
|
+
private_constant :ALWAYS_TRUTHY_LITERALS
|
|
33
|
+
|
|
25
34
|
attr_reader :root, :limits
|
|
26
35
|
|
|
27
36
|
def initialize(root:, limits:)
|
|
@@ -410,7 +419,7 @@ module Branchproof
|
|
|
410
419
|
end
|
|
411
420
|
|
|
412
421
|
def literal_truth(node)
|
|
413
|
-
return true if node.is_a?(
|
|
422
|
+
return true if ALWAYS_TRUTHY_LITERALS.any? { |type| node.is_a?(type) }
|
|
414
423
|
return false if node.is_a?(Prism::FalseNode) || node.is_a?(Prism::NilNode)
|
|
415
424
|
|
|
416
425
|
nil
|
data/lib/branchproof/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: branchproof
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.11.
|
|
4
|
+
version: 0.11.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lucian Ghinda
|
|
@@ -190,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
190
190
|
- !ruby/object:Gem::Version
|
|
191
191
|
version: '0'
|
|
192
192
|
requirements: []
|
|
193
|
-
rubygems_version:
|
|
193
|
+
rubygems_version: 3.7.2
|
|
194
194
|
specification_version: 4
|
|
195
195
|
summary: Modified condition and decision coverage for Ruby tests
|
|
196
196
|
test_files: []
|