branchproof 0.4.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a76f20e6504affb4e614eeca901b0ef515f8bbb0785a641cf437263cac2df418
4
- data.tar.gz: 87373206990831eeba3c1a2317049a4679343b4e4770015fb3e322710c7035e9
3
+ metadata.gz: c5b31682254d1c9db4be1d61e11743be038c65f859c730be05d1acae138e673c
4
+ data.tar.gz: 59a6f30a1586c0783283f32e16d1ed5626f702f3ec152ec15dfe271cfbc0c0b1
5
5
  SHA512:
6
- metadata.gz: 97b1aca56ec2e2ed60f683e7647ce91ec85f3b8a2bbe457cf6844b0bd7db9b6117a126bce8ec74f04e4805dc147beef6b58fa003f74d73bd6e18884973115833
7
- data.tar.gz: 1aac59c7cc767f9ef805cdcfecbe8e5e6628e25ea09cc8d862b32b0518f9aad89f6f8204b69d4183c75af1938e94a61e3ba980f6fa396bbff542b464bf371896
6
+ metadata.gz: 061d18741787eaeb57f5f1ec90a5e68d658fa8d9344fee52ecfa54fd70a69fcc909affe4890785031403a46379c90e11ac8a63c01766bd8477e2d7963ca14172
7
+ data.tar.gz: 144e5b02c3a380133015402e9ad2b47b52bc3a4d624c2f13728015159cd7ec6287fe7b3d1f167fb2ce745b3d953d5f271628a740c0912ae36af3fa7f72e13fb9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.5.0] - 2026-09-10
4
+
5
+ - Show source filenames beside diagnostics in decision, condition, and test
6
+ views, including reports rendered from saved JSON.
7
+ - Explain when a selected file has no supported conditions to instrument and
8
+ include unsupported syntax reasons when its decisions cannot be instrumented.
9
+
3
10
  ## [0.4.0] - 2026-09-10
4
11
 
5
12
  - Added `branchproof` as the primary CLI command while retaining `mcdc` as a
data/README.md CHANGED
@@ -97,7 +97,7 @@ For example, running the contents of the small `decision.rb` /
97
97
  with the terminal format produces a summary like this:
98
98
 
99
99
  ```text
100
- Branchproof 0.4.0
100
+ Branchproof 0.5.0
101
101
  Tests: PASSED (3 tests, 0 failed, 0 skipped)
102
102
  MC/DC: 100.0% (2/2 conditions proven)
103
103
  Analysis: COMPLETE
@@ -22,6 +22,9 @@ Not documented.
22
22
  ### `condition_explanation(decision_id:, condition_id:)` <a id="method-i-condition_explanation"></a> <a id="condition_explanation-instance_method"></a>
23
23
  Shares the existing missing-case wording with focused terminal views.
24
24
 
25
+ ### `diagnostic_message(diagnostic)` <a id="method-i-diagnostic_message"></a> <a id="diagnostic_message-instance_method"></a>
26
+ Formats source context consistently in live and saved terminal views.
27
+
25
28
  ### `exit_code()` <a id="method-i-exit_code"></a> <a id="exit_code-instance_method"></a>
26
29
  Not documented.
27
30
 
data/doc/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.5.0] - 2026-09-10
4
+
5
+ - Show source filenames beside diagnostics in decision, condition, and test
6
+ views, including reports rendered from saved JSON.
7
+ - Explain when a selected file has no supported conditions to instrument and
8
+ include unsupported syntax reasons when its decisions cannot be instrumented.
9
+
3
10
  ## [0.4.0] - 2026-09-10
4
11
 
5
12
  - Added `branchproof` as the primary CLI command while retaining `mcdc` as a
data/doc/README.md CHANGED
@@ -97,7 +97,7 @@ For example, running the contents of the small `decision.rb` /
97
97
  with the terminal format produces a summary like this:
98
98
 
99
99
  ```text
100
- Branchproof 0.4.0
100
+ Branchproof 0.5.0
101
101
  Tests: PASSED (3 tests, 0 failed, 0 skipped)
102
102
  MC/DC: 100.0% (2/2 conditions proven)
103
103
  Analysis: COMPLETE
@@ -38,7 +38,7 @@ module Branchproof
38
38
  render_unowned(lines)
39
39
  render_unsupported(lines)
40
40
  Array(fetch(@document, :diagnostics)).each do |diagnostic|
41
- lines << "Diagnostic: #{fetch(diagnostic, :message) || fetch(diagnostic, :code)}"
41
+ lines << "Diagnostic: #{@coordinator.diagnostic_message(diagnostic)}"
42
42
  end
43
43
  lines.join("\n") << "\n"
44
44
  end
@@ -55,7 +55,7 @@ module Branchproof
55
55
  end
56
56
  unless rewritten[:changed]
57
57
  if Array(rewritten[:diagnostics]).empty?
58
- add_diagnostic("not_instrumented", "selected source had no safe edits", unit[:source_id],
58
+ add_diagnostic("not_instrumented", unchanged_reason(unit), unit[:source_id],
59
59
  severity: "info")
60
60
  end
61
61
  return nil
@@ -80,6 +80,14 @@ module Branchproof
80
80
 
81
81
  private
82
82
 
83
+ def unchanged_reason(unit)
84
+ decisions = Array(unit[:decisions])
85
+ reasons = decisions.flat_map { |decision| Array(decision[:support_reasons]) }.uniq
86
+ return "conditions cannot be instrumented: #{reasons.join(", ")}" unless reasons.empty?
87
+
88
+ "no supported conditions to instrument"
89
+ end
90
+
83
91
  def hook_supported?
84
92
  defined?(RubyVM::InstructionSequence) && RubyVM::InstructionSequence.respond_to?(:compile)
85
93
  end
@@ -58,6 +58,18 @@ module Branchproof
58
58
  condition_detail(decision, condition, condition_result(decision, condition))
59
59
  end
60
60
 
61
+ # Formats source context consistently in live and saved terminal views.
62
+ def diagnostic_message(diagnostic)
63
+ message = value(diagnostic, :message) || value(diagnostic, :code)
64
+ source_id = value(diagnostic, :source_id)
65
+ return message unless source_id
66
+
67
+ source = source_for(diagnostic)
68
+ path = value(source, :relative_path) || source_id
69
+ prefix = %w[not_instrumented unsupported_source].include?(value(diagnostic, :code).to_s) ? "Skipped " : ""
70
+ "#{prefix}#{path}: #{message}"
71
+ end
72
+
61
73
  def exit_code
62
74
  return 2 unless usage_valid?
63
75
 
@@ -110,7 +122,7 @@ module Branchproof
110
122
  render_minima(lines) unless @missing_only
111
123
  unless @diagnostics.empty?
112
124
  lines << "Diagnostics:"
113
- @diagnostics.each { |diagnostic| lines << " - #{value(diagnostic, :message) || value(diagnostic, :code)}" }
125
+ @diagnostics.each { |diagnostic| lines << " - #{diagnostic_message(diagnostic)}" }
114
126
  end
115
127
  lines.join("\n") << "\n"
116
128
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Branchproof
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.0"
5
5
  end
data/sig/branchproof.rbs CHANGED
@@ -105,6 +105,7 @@ module Branchproof
105
105
  CRITERION_VERSION: String
106
106
  def initialize: (inventory: document, evidence: document, analysis: document?, minima: Array[document], baseline: document, diagnostics: Array[document], ?level: Integer, ?missing_only: bool, ?view: Symbol, ?run_metadata: document, ?saved_document: document?) -> void
107
107
  def self.from_document: (document: document, ?level: Integer?, ?view: Symbol, ?missing_only: bool) -> Report
108
+ def diagnostic_message: (Hash[Symbol | String, untyped] diagnostic) -> String
108
109
  def condition_explanation: (decision_id: String, condition_id: String) -> String
109
110
  def write: (io: _WriteIO, format: Symbol | String) -> nil
110
111
  def exit_code: () -> Integer
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.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucian Ghinda