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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3667120528803b1ceeb8c17313f66391b38633ed452757cb6e532f938d8cfd2a
4
- data.tar.gz: ebdab6b41dde4697eff2634fe022c18e7c86e7abf4a317235fc94f24ec6070ad
3
+ metadata.gz: a65f0492effca7846e6b1c25d58eef4cccf3dec446e6607f7cda648c7b39572c
4
+ data.tar.gz: 7144faf352290f1ebc35b799a789e9e7cf6acd18766c9d65a7a55719339d5fe1
5
5
  SHA512:
6
- metadata.gz: 226da6639e0f9aedc3345073e76b8bd78c23921ea0c5664d4230cf1712d25984a8b97168b2d721658e50c552dab54e6ad5cac71ae8bfccf5222c4eb89cf8471e
7
- data.tar.gz: 7ff352e0d1ec9aca08a67d0ed9c6246a37f1560f16777a0c89b01ad04ad94fff7af99a2abb3b09135990f1d67b33e58cff3ce4209e0e0a5a808f72ff59a52c07
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,
@@ -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,
@@ -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?(Prism::TrueNode)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Branchproof
4
- VERSION = "0.11.0"
4
+ VERSION = "0.11.1"
5
5
  end
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.0
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: 4.0.11
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: []