path_coverage 0.3.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.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +316 -177
  3. data/exe/path_coverage_report +4 -0
  4. data/lib/path_coverage/call_trace.rb +88 -0
  5. data/lib/path_coverage/calls.rb +49 -43
  6. data/lib/path_coverage/card_context.rb +104 -0
  7. data/lib/path_coverage/card_forks.rb +44 -0
  8. data/lib/path_coverage/card_gaps.rb +125 -0
  9. data/lib/path_coverage/card_scopes.rb +37 -0
  10. data/lib/path_coverage/card_tree.rb +199 -0
  11. data/lib/path_coverage/card_way_lists.rb +72 -0
  12. data/lib/path_coverage/card_ways.rb +196 -0
  13. data/lib/path_coverage/{html_syntax.rb → code_tokens.rb} +38 -25
  14. data/lib/path_coverage/condition.rb +14 -14
  15. data/lib/path_coverage/configuration.rb +7 -4
  16. data/lib/path_coverage/configuration_limits.rb +52 -0
  17. data/lib/path_coverage/configuration_paths.rb +7 -7
  18. data/lib/path_coverage/console_summary.rb +24 -22
  19. data/lib/path_coverage/{site.rb → decision.rb} +2 -2
  20. data/lib/path_coverage/decision_locations.rb +76 -0
  21. data/lib/path_coverage/{site_paths.rb → decision_paths.rb} +18 -8
  22. data/lib/path_coverage/{site_tree.rb → decision_tree.rb} +25 -16
  23. data/lib/path_coverage/fold_branches.rb +18 -0
  24. data/lib/path_coverage/fold_cells.rb +42 -0
  25. data/lib/path_coverage/fold_rows.rb +140 -0
  26. data/lib/path_coverage/gaps.rb +33 -15
  27. data/lib/path_coverage/json_reader.rb +54 -19
  28. data/lib/path_coverage/json_reports.rb +102 -0
  29. data/lib/path_coverage/json_writer.rb +31 -16
  30. data/lib/path_coverage/kernel.rb +56 -57
  31. data/lib/path_coverage/kinds/base.rb +16 -16
  32. data/lib/path_coverage/kinds/block.rb +16 -15
  33. data/lib/path_coverage/kinds/case.rb +14 -17
  34. data/lib/path_coverage/kinds/chain.rb +40 -11
  35. data/lib/path_coverage/kinds/choice.rb +7 -10
  36. data/lib/path_coverage/kinds/contains.rb +43 -33
  37. data/lib/path_coverage/kinds/safe.rb +44 -46
  38. data/lib/path_coverage/kinds/write.rb +6 -12
  39. data/lib/path_coverage/kinds.rb +2 -2
  40. data/lib/path_coverage/leaving.rb +44 -0
  41. data/lib/path_coverage/loop_forks.rb +57 -0
  42. data/lib/path_coverage/loop_nodes.rb +55 -0
  43. data/lib/path_coverage/manifest.rb +94 -59
  44. data/lib/path_coverage/manifest_blocks.rb +5 -26
  45. data/lib/path_coverage/manifest_case.rb +2 -2
  46. data/lib/path_coverage/manifest_chains.rb +8 -8
  47. data/lib/path_coverage/manifest_choices.rb +52 -29
  48. data/lib/path_coverage/manifest_disabled.rb +97 -0
  49. data/lib/path_coverage/manifest_folding.rb +66 -26
  50. data/lib/path_coverage/manifest_ignoring.rb +6 -6
  51. data/lib/path_coverage/manifest_writes.rb +11 -10
  52. data/lib/path_coverage/measured_by.rb +20 -0
  53. data/lib/path_coverage/merge.rb +7 -7
  54. data/lib/path_coverage/method_loops.rb +128 -0
  55. data/lib/path_coverage/method_statements.rb +147 -139
  56. data/lib/path_coverage/method_ways.rb +142 -0
  57. data/lib/path_coverage/paths_report.rb +16 -16
  58. data/lib/path_coverage/recorder.rb +57 -36
  59. data/lib/path_coverage/recorder_blocks.rb +17 -17
  60. data/lib/path_coverage/recorder_cases.rb +12 -11
  61. data/lib/path_coverage/recorder_chains.rb +12 -12
  62. data/lib/path_coverage/recorder_writes.rb +9 -9
  63. data/lib/path_coverage/render.rb +58 -51
  64. data/lib/path_coverage/result.rb +32 -31
  65. data/lib/path_coverage/rewriter.rb +39 -27
  66. data/lib/path_coverage/rewriter_nested.rb +13 -13
  67. data/lib/path_coverage/runs_report.rb +84 -0
  68. data/lib/path_coverage/source_lines.rb +16 -16
  69. data/lib/path_coverage/source_report.rb +100 -0
  70. data/lib/path_coverage/stable_leaves.rb +162 -0
  71. data/lib/path_coverage/statement_arms.rb +61 -27
  72. data/lib/path_coverage/summary.rb +4 -62
  73. data/lib/path_coverage/totals.rb +10 -8
  74. data/lib/path_coverage/version.rb +1 -1
  75. data/lib/path_coverage/walk.rb +106 -0
  76. data/lib/path_coverage/way_algebras.rb +127 -0
  77. data/lib/path_coverage/ways_report.rb +91 -0
  78. data/lib/path_coverage/ways_totals.rb +46 -0
  79. data/lib/path_coverage/within_methods.rb +184 -44
  80. metadata +36 -29
  81. data/lib/path_coverage/card.rb +0 -14
  82. data/lib/path_coverage/html/file.html +0 -33
  83. data/lib/path_coverage/html/index.html +0 -29
  84. data/lib/path_coverage/html/settings.js +0 -50
  85. data/lib/path_coverage/html/side.js +0 -470
  86. data/lib/path_coverage/html/sort.js +0 -34
  87. data/lib/path_coverage/html/style.css +0 -470
  88. data/lib/path_coverage/html/tabs.js +0 -15
  89. data/lib/path_coverage/html/theme.js +0 -27
  90. data/lib/path_coverage/html_branch.rb +0 -30
  91. data/lib/path_coverage/html_cards.rb +0 -111
  92. data/lib/path_coverage/html_cells.rb +0 -66
  93. data/lib/path_coverage/html_file.rb +0 -123
  94. data/lib/path_coverage/html_index.rb +0 -128
  95. data/lib/path_coverage/html_index_head.rb +0 -29
  96. data/lib/path_coverage/html_labels.rb +0 -23
  97. data/lib/path_coverage/html_methods.rb +0 -66
  98. data/lib/path_coverage/html_nav.rb +0 -67
  99. data/lib/path_coverage/html_report.rb +0 -131
  100. data/lib/path_coverage/html_statements.rb +0 -166
  101. data/lib/path_coverage/html_tabs.rb +0 -26
  102. data/lib/path_coverage/html_template.rb +0 -26
  103. data/lib/path_coverage/html_tree.rb +0 -131
@@ -1,32 +1,40 @@
1
- require_relative 'html_cards'
2
- require_relative 'html_statements'
1
+ require_relative 'card_context'
2
+ require_relative 'card_scopes'
3
+ require_relative 'card_tree'
4
+ require_relative 'card_way_lists'
5
+ require_relative 'card_ways'
6
+ require_relative 'loop_forks'
7
+ require_relative 'method_loops'
3
8
  require_relative 'method_statements'
9
+ require_relative 'method_ways'
4
10
  require_relative 'source_lines'
5
11
 
6
12
  module PathCoverage
7
13
  # What is measured within each method of a covered file.
8
14
  module WithinMethods
9
15
  # Where each statement of the covered file at path, parsed
10
- # as Manifest.parse gives it, that is no site is reached, as
11
- # MethodStatements.reaches gives them.
16
+ # as Manifest.parse gives it, that is no decision is reached,
17
+ # as MethodStatements.reaches gives them.
12
18
  def self.reaches(path, parsed, config)
13
- source, sites = parsed.values_at(:source, :sites)
14
- MethodStatements.reaches(source, config.relative(path), sites)
19
+ source, decisions = parsed.values_at(:source, :decisions)
20
+ relative = config.relative(path)
21
+ MethodStatements.reaches(source, relative, decisions)
15
22
  end
16
23
 
17
24
  # Example: { "k.rb:0:0" => [1, 2], "k.rb:1:0" => [2, 4] }.
18
25
  # Each def's card total, [taken, size], in every file in
19
- # files, { full path => {source:, sites:} }, from paths, as
26
+ # files, { full path => {source:, decisions:} }, from paths, as
20
27
  # Result#paths gives them, and reached, as Recorder#reached
21
- # does; and each file's top level's, its sites on no card,
28
+ # does; and each file's top level's, its decisions on no card,
22
29
  # named for line 0, which no def is on.
23
30
  def self.cards(files, config, paths, reached)
24
31
  files.map do |full_path, parsed|
25
32
  path = config.relative(full_path)
26
- source, sites = parsed.values_at(:source, :sites)
27
- top = MethodStatements.top_level(source, path, paths, sites)
28
- MethodStatements.totals(source, path, paths, reached, sites)
29
- .merge("#{path}:0:0" => top)
33
+ source, decisions = parsed.values_at(:source, :decisions)
34
+ args = [source, path, paths]
35
+ top = MethodStatements.top_level(*args, decisions)
36
+ CardContext.totals(*args, reached, decisions)
37
+ .merge("#{path}:0:0" => top)
30
38
  end.reduce({}, :merge)
31
39
  end
32
40
 
@@ -34,59 +42,191 @@ module PathCoverage
34
42
  # "last" => 3, "rows" => [{ "at" => "2:04", ... }] } }.
35
43
  # Each card in every file in files, a def's and a top card's,
36
44
  # as its page draws it, for the JSON report, so a reader
37
- # finds a card's gap without the page; result a Result,
38
- # reached as cards takes it.
39
- def self.listed(files, config, result, reached)
45
+ # finds a card's gap without the page; result a Result;
46
+ # counted [reached, ways], reached as cards takes it, ways as
47
+ # a CallTrace counts them, nil when not known.
48
+ def self.listed(files, config, result, counted)
40
49
  files.map do |full_path, parsed|
41
50
  path = config.relative(full_path)
42
- listed_in(path, parsed, result.paths, reached)
43
- .merge(listed_tops(path, parsed, result))
51
+ recorded = [result.operands, result.paths]
52
+ limited = [*counted, config.path_limit, config.loops?]
53
+ listed_in(path, parsed, result.paths, limited)
54
+ .merge(listed_tops(path, parsed, recorded))
44
55
  end.reduce({}, :merge)
45
56
  end
46
57
 
58
+ # Example: { "k.rb" => { "1:0" => { "2:2" => { "parent" =>
59
+ # nil, "in" => nil, "on" => nil } } } }.
60
+ # How the rows of each card nest, in every file in files: by
61
+ # the file's path, then its card's line:column, a def's card
62
+ # and each top card, as listed names them, then each row's,
63
+ # as CardTree places them; result a Result.
64
+ def self.tree(files, config, result)
65
+ files.to_h do |full_path, parsed|
66
+ path = config.relative(full_path)
67
+ [path, tree_in(path, parsed, result)]
68
+ end
69
+ end
70
+
71
+ # How the rows of each card of the file at path nest, parsed
72
+ # as Manifest.parse gives it, as tree gives them.
73
+ def self.tree_in(path, parsed, result)
74
+ source, decisions = parsed.values_at(:source, :decisions)
75
+ cards = CardTree.of(source, path, decisions).to_a +
76
+ tree_tops(path, parsed, result)
77
+ cards.to_h do |decision, rows|
78
+ [decision.split(':').last(2) * ':', rows]
79
+ end
80
+ end
81
+
82
+ # [[card decision, its rows' places]] for each top card of the
83
+ # file at path, as listed_tops names them.
84
+ def self.tree_tops(path, parsed, result)
85
+ source, decisions = parsed.values_at(:source, :decisions)
86
+ lines = SourceLines.of(source, decisions, result.operands)
87
+ spans(path, parsed, lines).map do |span, rows|
88
+ nested = CardTree.nested(source, decisions, rows)
89
+ ["#{path}:#{span.begin}:0", nested]
90
+ end
91
+ end
92
+
47
93
  # The top cards of the file at path, as its page draws them:
48
- # each under the site of its first line's start, named for
49
- # its scope, as listed gives them.
50
- def self.listed_tops(path, parsed, result)
51
- source, sites = parsed.values_at(:source, :sites)
52
- lines = SourceLines.of(source, sites, result.operands)
53
- scopes = HtmlCards.scopes(source)
54
- HtmlCards.spans(path, parsed, lines).to_h do |span, rows|
55
- site = "#{path}:#{span.begin}:0"
56
- taken = rows.zip(MethodStatements.taken(rows, result.paths))
57
- [site, card(site, scopes[span.begin], span.end, taken)]
94
+ # each under the decision of its first line's start, named for
95
+ # its scope, as listed gives them; operands and decision_paths
96
+ # as Result gives them.
97
+ def self.listed_tops(path, parsed, (operands, decision_paths))
98
+ source, decisions = parsed.values_at(:source, :decisions)
99
+ lines = SourceLines.of(source, decisions, operands)
100
+ scopes = CardScopes.of(source)
101
+ spans(path, parsed, lines).to_h do |span, rows|
102
+ decision = "#{path}:#{span.begin}:0"
103
+ taken = rows.zip(MethodStatements.taken(rows, decision_paths))
104
+ ways = CardWays.card(source, decisions, rows)
105
+ named = [scopes[span.begin], span.end, ways, nil]
106
+ [decision, card(decision, named, taken)]
58
107
  end
59
108
  end
60
109
 
110
+ # { span => its top-level rows } of the file at path, each
111
+ # row under the span its line is in, lines as SourceLines.of
112
+ # gives them.
113
+ def self.spans(path, parsed, lines)
114
+ source, decisions = parsed.values_at(:source, :decisions)
115
+ rows = MethodStatements.top_rows(source, path, decisions)
116
+ rows.group_by { lines[_1.line - 1][:span] }
117
+ end
118
+
61
119
  # The cards of the file at path, parsed as Manifest.parse
62
- # gives it, as listed gives them.
63
- def self.listed_in(path, parsed, paths, reached)
64
- source, sites = parsed.values_at(:source, :sites)
65
- names = MethodStatements.names(source, path, sites)
66
- lasts = MethodStatements.lasts(source, path, sites)
67
- MethodStatements.of(source, path, sites).to_h do |site, rows|
68
- taken = MethodStatements.taken(rows, paths, reached)
69
- [site, card(site, names[site], lasts[site], rows.zip(taken))]
120
+ # gives it, as listed gives them, each listing its ways too
121
+ # when counted's ways are known, counted being [reached, ways,
122
+ # limit, loops], limit the most ways a card lists, loops
123
+ # whether each loop is a fork.
124
+ def self.listed_in(path, parsed, paths, (reached, *counted))
125
+ source, decisions = parsed.values_at(:source, :decisions)
126
+ titles = titles(source, path, decisions)
127
+ lister = WayLister.new(source, path, decisions, counted)
128
+ context = [source, decisions, paths, reached]
129
+ MethodStatements.of(source, path, decisions).to_h do |key, rows|
130
+ count = lister.count(key, rows)
131
+ named = [*titles[key], count, reached&.fetch(key, 0)]
132
+ shown = method_card(key, rows, named, context)
133
+ [key, shown.merge(lister.lists(key, rows, count))]
134
+ end
135
+ end
136
+
137
+ # The card of the def at key, its rows, named as card takes
138
+ # named; context is [source, decisions, paths, reached], as
139
+ # listed_in has them.
140
+ def self.method_card(key, rows, named, context)
141
+ source, decisions, paths, reached = context
142
+ shown = CardContext.rows(source, decisions, rows, paths,
143
+ reached)
144
+ card(key, named, shown)
145
+ end
146
+
147
+ # { def decision => [its name, its last line] } for each def in
148
+ # source, at path, as its card is titled.
149
+ def self.titles(source, path, decisions)
150
+ names = MethodStatements.names(source, path, decisions)
151
+ lasts = MethodStatements.lasts(source, path, decisions)
152
+ names.to_h { |key, name| [key, [name, lasts[key]]] }
153
+ end
154
+
155
+ # The way lists of each card of a file, as CardWayLists gives
156
+ # them.
157
+ class WayLister
158
+ # The lister of the file at path, source, its decisions as
159
+ # Manifest.parse gives them; counted [ways, limit]: ways as a
160
+ # CallTrace counts them, nil when not known, and limit the
161
+ # most ways a card lists.
162
+ def initialize(source, path, decisions, (ways, limit, loops))
163
+ @source = source
164
+ @decisions = decisions
165
+ @ways = ways
166
+ @limit = limit
167
+ @loops = MethodLoops.of(source, path, decisions)
168
+ @forks = LoopForks.of(source, path, decisions)
169
+ @forking = loops
170
+ end
171
+
172
+ # How many ways go through the card of the def at key, its
173
+ # rows, each loop a fork when loops are.
174
+ def count(key, rows)
175
+ CardWays.card(@source, @decisions, rows,
176
+ WayAlgebras::Counted, [true, forked(key)])
177
+ end
178
+
179
+ # The way lists of the card of the def at key, its rows, with
180
+ # count ways through it: none when the ways are not known;
181
+ # those its calls took and its loops' passes; and, when count
182
+ # is no more than the limit, its covered, gaps and impossible.
183
+ def lists(key, rows, count)
184
+ return {} if @ways.nil?
185
+
186
+ walked = CardWayLists.walked(key, @ways, loops(key))
187
+ return walked if count > @limit
188
+
189
+ forked = forked(key)
190
+ split = MethodWays.split_card(@source, @decisions, rows,
191
+ forked)
192
+ checked = [split, forked.keys]
193
+ walked.merge(CardWayLists.checked(key, @ways, checked))
194
+ end
195
+
196
+ private
197
+
198
+ # The names of the loops of the def at key: those holding a
199
+ # row, and those that fork.
200
+ def loops(key)
201
+ (@loops[key].values.flatten + @forks.fetch(key).keys).uniq
202
+ end
203
+
204
+ # The loops of the def at key that fork, as
205
+ # LoopForks gives them; none unless loops are forks.
206
+ def forked(key)
207
+ @forking ? @forks.fetch(key) : {}
70
208
  end
71
209
  end
72
210
 
73
- # The card of the def at site named name, ending on line
74
- # last: its first line, from site, and a row for each
75
- # [statement, taken] of rows.
76
- def self.card(site, name, last, rows)
77
- first = Integer(site.split(':')[-2])
211
+ # The card of the def at decision, named name, ending on line
212
+ # last, with ways through it, as ways folds them, and calls,
213
+ # how many times it was called, nil for a top card, which is no
214
+ # method's, or when not known: its first line, from decision, and
215
+ # a row for each [statement, taken] of rows.
216
+ def self.card(decision, (name, last, ways, calls), rows)
217
+ first = Integer(decision.split(':')[-2])
78
218
  listed = rows.map { |statement, count| row(statement, count) }
79
219
  { 'name' => name, 'first' => first, 'last' => last,
80
- 'rows' => listed }
220
+ 'ways' => ways, 'calls' => calls, 'rows' => listed }
81
221
  end
82
222
 
83
223
  # A card's row: statement's line:column, as its page labels
84
224
  # it, its top, its paths, count, how many were taken, and
85
- # its site, nil for a statement that is no site.
225
+ # its decision, nil for a statement that is no decision.
86
226
  def self.row(statement, count)
87
- { 'at' => HtmlStatements.label(statement),
227
+ { 'at' => MethodStatements.at(statement),
88
228
  'top' => statement.top, 'paths' => statement.paths,
89
- 'taken' => count, 'site' => statement.site }
229
+ 'taken' => count, 'decision' => statement.decision }
90
230
  end
91
231
  end
92
232
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: path_coverage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Jagger
@@ -27,46 +27,42 @@ description: Records which paths each condition and each method took, and report
27
27
  the paths never taken in the terminal and as HTML.
28
28
  executables:
29
29
  - path_coverage_collector
30
+ - path_coverage_report
30
31
  extensions: []
31
32
  extra_rdoc_files: []
32
33
  files:
33
34
  - LICENSE.md
34
35
  - README.md
35
36
  - exe/path_coverage_collector
37
+ - exe/path_coverage_report
36
38
  - lib/path_coverage.rb
37
39
  - lib/path_coverage/auto.rb
40
+ - lib/path_coverage/call_trace.rb
38
41
  - lib/path_coverage/calls.rb
39
- - lib/path_coverage/card.rb
42
+ - lib/path_coverage/card_context.rb
43
+ - lib/path_coverage/card_forks.rb
44
+ - lib/path_coverage/card_gaps.rb
45
+ - lib/path_coverage/card_scopes.rb
46
+ - lib/path_coverage/card_tree.rb
47
+ - lib/path_coverage/card_way_lists.rb
48
+ - lib/path_coverage/card_ways.rb
49
+ - lib/path_coverage/code_tokens.rb
40
50
  - lib/path_coverage/collector.rb
41
51
  - lib/path_coverage/condition.rb
42
52
  - lib/path_coverage/configuration.rb
53
+ - lib/path_coverage/configuration_limits.rb
43
54
  - lib/path_coverage/configuration_paths.rb
44
55
  - lib/path_coverage/console_summary.rb
56
+ - lib/path_coverage/decision.rb
57
+ - lib/path_coverage/decision_locations.rb
58
+ - lib/path_coverage/decision_paths.rb
59
+ - lib/path_coverage/decision_tree.rb
60
+ - lib/path_coverage/fold_branches.rb
61
+ - lib/path_coverage/fold_cells.rb
62
+ - lib/path_coverage/fold_rows.rb
45
63
  - lib/path_coverage/gaps.rb
46
- - lib/path_coverage/html/file.html
47
- - lib/path_coverage/html/index.html
48
- - lib/path_coverage/html/settings.js
49
- - lib/path_coverage/html/side.js
50
- - lib/path_coverage/html/sort.js
51
- - lib/path_coverage/html/style.css
52
- - lib/path_coverage/html/tabs.js
53
- - lib/path_coverage/html/theme.js
54
- - lib/path_coverage/html_branch.rb
55
- - lib/path_coverage/html_cards.rb
56
- - lib/path_coverage/html_cells.rb
57
- - lib/path_coverage/html_file.rb
58
- - lib/path_coverage/html_index.rb
59
- - lib/path_coverage/html_index_head.rb
60
- - lib/path_coverage/html_labels.rb
61
- - lib/path_coverage/html_methods.rb
62
- - lib/path_coverage/html_nav.rb
63
- - lib/path_coverage/html_report.rb
64
- - lib/path_coverage/html_statements.rb
65
- - lib/path_coverage/html_syntax.rb
66
- - lib/path_coverage/html_tabs.rb
67
- - lib/path_coverage/html_template.rb
68
- - lib/path_coverage/html_tree.rb
69
64
  - lib/path_coverage/json_reader.rb
65
+ - lib/path_coverage/json_reports.rb
70
66
  - lib/path_coverage/json_writer.rb
71
67
  - lib/path_coverage/kernel.rb
72
68
  - lib/path_coverage/kinds.rb
@@ -78,16 +74,23 @@ files:
78
74
  - lib/path_coverage/kinds/contains.rb
79
75
  - lib/path_coverage/kinds/safe.rb
80
76
  - lib/path_coverage/kinds/write.rb
77
+ - lib/path_coverage/leaving.rb
78
+ - lib/path_coverage/loop_forks.rb
79
+ - lib/path_coverage/loop_nodes.rb
81
80
  - lib/path_coverage/manifest.rb
82
81
  - lib/path_coverage/manifest_blocks.rb
83
82
  - lib/path_coverage/manifest_case.rb
84
83
  - lib/path_coverage/manifest_chains.rb
85
84
  - lib/path_coverage/manifest_choices.rb
85
+ - lib/path_coverage/manifest_disabled.rb
86
86
  - lib/path_coverage/manifest_folding.rb
87
87
  - lib/path_coverage/manifest_ignoring.rb
88
88
  - lib/path_coverage/manifest_writes.rb
89
+ - lib/path_coverage/measured_by.rb
89
90
  - lib/path_coverage/merge.rb
91
+ - lib/path_coverage/method_loops.rb
90
92
  - lib/path_coverage/method_statements.rb
93
+ - lib/path_coverage/method_ways.rb
91
94
  - lib/path_coverage/paths_report.rb
92
95
  - lib/path_coverage/post.rb
93
96
  - lib/path_coverage/recorder.rb
@@ -99,16 +102,20 @@ files:
99
102
  - lib/path_coverage/result.rb
100
103
  - lib/path_coverage/rewriter.rb
101
104
  - lib/path_coverage/rewriter_nested.rb
102
- - lib/path_coverage/site.rb
103
- - lib/path_coverage/site_paths.rb
104
- - lib/path_coverage/site_tree.rb
105
+ - lib/path_coverage/runs_report.rb
105
106
  - lib/path_coverage/source_lines.rb
107
+ - lib/path_coverage/source_report.rb
108
+ - lib/path_coverage/stable_leaves.rb
106
109
  - lib/path_coverage/statement_arms.rb
107
110
  - lib/path_coverage/summary.rb
108
111
  - lib/path_coverage/totals.rb
109
112
  - lib/path_coverage/version.rb
113
+ - lib/path_coverage/walk.rb
114
+ - lib/path_coverage/way_algebras.rb
115
+ - lib/path_coverage/ways_report.rb
116
+ - lib/path_coverage/ways_totals.rb
110
117
  - lib/path_coverage/within_methods.rb
111
- homepage: https://github.com/cyber-dojo/path_coverage
118
+ homepage: https://github.com/path-coverage/ruby
112
119
  licenses:
113
120
  - BSD-2-Clause
114
121
  metadata:
@@ -1,14 +0,0 @@
1
- module PathCoverage
2
- # One card of a file's page, as the page lays out the code
3
- # around it: its first and last lines, its def's column, its
4
- # status, gaps or covered, whether it is a top card, of sites
5
- # outside every def, how many sites a top card holds, its
6
- # button showing that count, nil for a method's, and its HTML.
7
- Card = Data.define(:first, :last, :column, :status, :top, :sites,
8
- :html) do
9
- # True when line is one of the card's lines.
10
- def holds?(line)
11
- (first..last).cover?(line)
12
- end
13
- end
14
- end
@@ -1,33 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8"/>
5
- <meta name="viewport" content="width=device-width, initial-scale=1"/>
6
- <title>{{path}} · Path coverage</title>
7
- <style>
8
- /*<![CDATA[*/
9
- {{style}}
10
- /*]]>*/
11
- </style>
12
- </head>
13
- <body>
14
- <main class="page">
15
- <header class="head" data-head="">
16
- <div class="top"><p class="title"><a data-index="" href="{{index}}">Path coverage</a></p><h1 class="path"><a data-row="" href="{{index}}#row-{{path}}">{{path}}</a></h1><button type="button" class="theme" aria-label="Light or dark"></button></div>
17
- {{jumps}}
18
- </header>
19
- <div class="box">
20
- <div class="rail">
21
- {{rail}}
22
- </div>
23
- {{listing}}
24
- <div class="divider" role="separator" aria-orientation="vertical" title="Drag to share the width between paths and code"></div>
25
- </div>
26
- </main>
27
- <script>
28
- //<![CDATA[
29
- {{script}}
30
- //]]>
31
- </script>
32
- </body>
33
- </html>
@@ -1,29 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8"/>
5
- <meta name="viewport" content="width=device-width, initial-scale=1"/>
6
- <title>Path coverage</title>
7
- <style>
8
- /*<![CDATA[*/
9
- {{style}}
10
- /*]]>*/
11
- </style>
12
- </head>
13
- <body>
14
- <main class="page">
15
- <header class="head" data-head="">
16
- <div class="top"><h1 class="title">Path coverage</h1><button type="button" class="theme" aria-label="Light or dark"></button></div>
17
- </header>
18
- {{tabs}}
19
- <div class="box">
20
- {{tables}}
21
- </div>{{ignored}}
22
- </main>
23
- <script>
24
- //<![CDATA[
25
- {{script}}
26
- //]]>
27
- </script>
28
- </body>
29
- </html>
@@ -1,50 +0,0 @@
1
- // The report's settings, eg its theme. Each is carried by
2
- // every link to another page of the report, as ?name=, since some
3
- // browsers keep nothing shared between a report's local files, and
4
- // is also kept in the browser where it can be, for a page opened
5
- // afresh.
6
- window.pathCoverageSettings = (function () {
7
- // The value of setting name the link that opened this page
8
- // carried, else the one last kept, when it is one of allowed;
9
- // else null.
10
- function given(name, allowed) {
11
- var match = new RegExp('[?&]' + name + '=([a-z]+)').exec(window.location.search);
12
- if (match && allowed.indexOf(match[1]) >= 0) { return match[1]; }
13
- try {
14
- var kept = window.localStorage.getItem('path_coverage.' + name);
15
- return allowed.indexOf(kept) >= 0 ? kept : null;
16
- } catch (e) { return null; }
17
- }
18
-
19
- // Keeps value as setting name's, where the browser allows it.
20
- function keep(name, value) {
21
- try { window.localStorage.setItem('path_coverage.' + name, value); } catch (e) { /* carried by links only */ }
22
- }
23
-
24
- // href, a link to another page of the report, with its ?name=
25
- // set to value, before any #fragment, its other ?settings kept.
26
- function carrying(href, name, value) {
27
- var hash = href.indexOf('#');
28
- var fragment = hash < 0 ? '' : href.slice(hash);
29
- var rest = hash < 0 ? href : href.slice(0, hash);
30
- var query = rest.indexOf('?');
31
- var page = query < 0 ? rest : rest.slice(0, query);
32
- var settings = query < 0 ? [] : rest.slice(query + 1).split('&').filter(function (pair) {
33
- return pair && pair.split('=')[0] !== name;
34
- });
35
- settings.push(name + '=' + value);
36
- return page + '?' + settings.join('&') + fragment;
37
- }
38
-
39
- // Makes every link to another of the report's pages carry value
40
- // as setting name's.
41
- function carry(name, value) {
42
- document.querySelectorAll('a[href]').forEach(function (link) {
43
- var href = link.getAttribute('href');
44
- if (/^[a-z]+:|^#/.test(href) || !/\.html(\?|#|$)/.test(href)) { return; }
45
- link.setAttribute('href', carrying(href, name, value));
46
- });
47
- }
48
-
49
- return { given: given, keep: keep, carry: carry };
50
- })();