coverband 6.0.2 → 6.0.3.rc.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +10 -0
  3. data/.github/workflows/main.yml +2 -3
  4. data/.standard.yml +1 -1
  5. data/Gemfile +1 -1
  6. data/LICENSE +1 -1
  7. data/README.md +3 -2
  8. data/Rakefile +1 -1
  9. data/changes.md +1 -1
  10. data/coverband.gemspec +3 -3
  11. data/lib/coverband/adapters/base.rb +10 -10
  12. data/lib/coverband/adapters/file_store.rb +1 -1
  13. data/lib/coverband/adapters/hash_redis_store.rb +69 -15
  14. data/lib/coverband/adapters/null_store.rb +1 -1
  15. data/lib/coverband/adapters/stdout_store.rb +1 -1
  16. data/lib/coverband/adapters/web_service_store.rb +5 -7
  17. data/lib/coverband/collectors/route_tracker.rb +1 -1
  18. data/lib/coverband/collectors/translation_tracker.rb +2 -2
  19. data/lib/coverband/collectors/view_tracker.rb +1 -1
  20. data/lib/coverband/configuration.rb +5 -5
  21. data/lib/coverband/integrations/rack_server_check.rb +1 -3
  22. data/lib/coverband/reporters/base.rb +7 -7
  23. data/lib/coverband/reporters/html_report.rb +12 -4
  24. data/lib/coverband/reporters/json_report.rb +42 -4
  25. data/lib/coverband/reporters/web.rb +16 -2
  26. data/lib/coverband/reporters/web_pager.rb +28 -0
  27. data/lib/coverband/utils/absolute_file_converter.rb +19 -19
  28. data/lib/coverband/utils/file_hasher.rb +3 -3
  29. data/lib/coverband/utils/html_formatter.rb +4 -4
  30. data/lib/coverband/utils/method_definition_scanner.rb +1 -1
  31. data/lib/coverband/utils/railtie.rb +4 -6
  32. data/lib/coverband/utils/relative_file_converter.rb +7 -7
  33. data/lib/coverband/utils/results.rb +1 -5
  34. data/lib/coverband/utils/source_file.rb +2 -2
  35. data/lib/coverband/utils/tasks.rb +1 -1
  36. data/lib/coverband/version.rb +1 -1
  37. data/lib/coverband.rb +19 -3
  38. data/public/application.js +36 -0
  39. data/public/dependencies.js +1 -1
  40. data/roadmap.md +1 -1
  41. data/test/benchmarks/benchmark.rake +5 -5
  42. data/test/coverband/adapters/file_store_test.rb +1 -1
  43. data/test/coverband/collectors/coverage_test.rb +1 -1
  44. data/test/coverband/reporters/json_test.rb +1 -1
  45. data/test/coverband/utils/source_file_test.rb +11 -11
  46. data/test/fixtures/casting_invitor.rb +1 -1
  47. data/test/fixtures/sample.rb +2 -2
  48. data/test/fixtures/skipped_and_executed.rb +1 -1
  49. data/test/forked/rails_rake_full_stack_test.rb +1 -1
  50. data/test/test_helper.rb +3 -5
  51. data/test/unique_files.rb +1 -1
  52. data/views/file_list.erb +38 -32
  53. data/views/layout.erb +3 -3
  54. metadata +12 -136
  55. data/LICENSE.txt +0 -22
data/test/unique_files.rb CHANGED
@@ -15,7 +15,7 @@ def require_unique_file(file = "dog.rb", variables = {})
15
15
  FileUtils.mkdir_p(Pathname.new(temp_file).dirname.to_s)
16
16
  file_contents = File.read("./test/#{file}")
17
17
  file_contents = ERB.new(file_contents).result(OpenStruct.new(variables).instance_eval { binding }) if variables.any?
18
- File.open(temp_file, "w") { |w| w.write(file_contents) }
18
+ File.write(temp_file, file_contents)
19
19
  require temp_file
20
20
  Coverband::Utils::RelativeFileConverter.convert(File.expand_path(temp_file))
21
21
  end
data/views/file_list.erb CHANGED
@@ -2,23 +2,27 @@
2
2
  <% unless options[:skip_nav] %>
3
3
  <h2>
4
4
  <span class="group_name"><%= title %></span>
5
- (<span class="covered_percent"><span class="<%= coverage_css_class(source_files.covered_percent) %>"><%= source_files.covered_percent.round(2) %>%</span></span>
6
- covered at
7
- <span class="covered_strength">
8
- <span class="<%= strength_css_class(source_files.covered_strength) %>">
9
- <%= source_files.covered_strength.round(2) %>
10
- </span>
11
- </span> hits/line)
5
+ <% unless page %>
6
+ (<span class="covered_percent"><span class="<%= coverage_css_class(source_files.covered_percent) %>"><%= source_files.covered_percent.round(2) %>%</span></span>
7
+ covered at
8
+ <span class="covered_strength">
9
+ <span class="<%= strength_css_class(source_files.covered_strength) %>">
10
+ <%= source_files.covered_strength.round(2) %>
11
+ </span>
12
+ </span> hits/line)
13
+ <% end %>
12
14
  </h2>
13
15
  <% end %>
14
16
  <a name="<%= title_id %>"></a>
15
17
  <div>
16
- <b><%= source_files.length %></b> files in total.
17
- <b><%= source_files.lines_of_code %></b> relevant lines.
18
- <span class="green"><b><%= source_files.covered_lines %></b> lines covered</span> and
19
- <span class="red"><b><%= source_files.missed_lines %></b> lines missed </span>
18
+ <% unless page %>
19
+ <b><%= source_files.length %></b> files in total.
20
+ <b><%= source_files.lines_of_code %></b> relevant lines.
21
+ <span class="green"><b><%= source_files.covered_lines %></b> lines covered</span> and
22
+ <span class="red"><b><%= source_files.missed_lines %></b> lines missed </span>
23
+ <% end %>
20
24
  </div>
21
- <table class="file_list">
25
+ <table class="file_list <%= page ? "unsorted" : "sorted" %>" data-coverageurl="<%= base_path %>">
22
26
  <thead>
23
27
  <tr>
24
28
  <th title="The source file name">File</th>
@@ -33,26 +37,28 @@
33
37
  </tr>
34
38
  </thead>
35
39
  <tbody>
36
- <% source_files.each do |source_file| %>
37
- <tr>
38
- <% source_class = source_file.never_loaded ? 'strong red' : 'strong'%>
39
- <td class="<%= source_class %>">
40
- <%= link_to_source_file(source_file) %>
41
- </td>
42
- <td class="<%= coverage_css_class(source_file.covered_percent) %> strong"><%= source_file.covered_percent.round(2).to_s %> %</td>
43
- <% runtime_percentage = result.runtime_relevant_coverage(source_file) %>
44
- <td class="<%= "#{coverage_css_class(runtime_percentage)}" %> strong">
45
- <%= "#{runtime_percentage || '0'} %" %>
46
- </td>
47
- <td><%= source_file.lines.count %></td>
48
- <td><%= source_file.covered_lines.count + source_file.missed_lines.count %></td>
49
- <td><%= source_file.covered_lines.count %></td>
50
- <td>
51
- <%= result.file_with_type(source_file, Coverband::RUNTIME_TYPE)&.covered_lines_count || 0 %>
52
- </td>
53
- <td><%= source_file.missed_lines.count %></td>
54
- <td><%= source_file.covered_strength %></td>
55
- </tr>
40
+ <% unless page %>
41
+ <% source_files.each do |source_file| %>
42
+ <tr>
43
+ <% source_class = source_file.never_loaded ? 'strong red' : 'strong'%>
44
+ <td class="<%= source_class %>">
45
+ <%= link_to_source_file(source_file) %>
46
+ </td>
47
+ <td class="<%= coverage_css_class(source_file.covered_percent) %> strong"><%= source_file.covered_percent.round(2).to_s %> %</td>
48
+ <% runtime_percentage = result.runtime_relevant_coverage(source_file) %>
49
+ <td class="<%= "#{coverage_css_class(runtime_percentage)}" %> strong">
50
+ <%= "#{runtime_percentage || '0'} %" %>
51
+ </td>
52
+ <td><%= source_file.lines.count %></td>
53
+ <td><%= source_file.covered_lines.count + source_file.missed_lines.count %></td>
54
+ <td><%= source_file.covered_lines.count %></td>
55
+ <td>
56
+ <%= result.file_with_type(source_file, Coverband::RUNTIME_TYPE)&.covered_lines_count || 0 %>
57
+ </td>
58
+ <td><%= source_file.missed_lines.count %></td>
59
+ <td><%= source_file.covered_strength %></td>
60
+ </tr>
61
+ <% end %>
56
62
  <% end %>
57
63
  </tbody>
58
64
  </table>
data/views/layout.erb CHANGED
@@ -26,9 +26,9 @@
26
26
  </div>
27
27
 
28
28
  <div class="source_files">
29
- <% result.source_files.each do |source_file| %>
30
- <%= formatted_source_file_loader(result, source_file) %>
31
- <% end %>
29
+ <% result.source_files.each do |source_file| %>
30
+ <%= formatted_source_file_loader(result, source_file) %>
31
+ <% end %>
32
32
  </div>
33
33
  </div>
34
34
  </body>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coverband
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.2
4
+ version: 6.0.3.rc.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Mayer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-01-24 00:00:00.000000000 Z
12
+ date: 2024-03-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: benchmark-ips
@@ -183,16 +183,16 @@ dependencies:
183
183
  name: standard
184
184
  requirement: !ruby/object:Gem::Requirement
185
185
  requirements:
186
- - - '='
186
+ - - "~>"
187
187
  - !ruby/object:Gem::Version
188
- version: 0.2.5
188
+ version: 1.34.0
189
189
  type: :development
190
190
  prerelease: false
191
191
  version_requirements: !ruby/object:Gem::Requirement
192
192
  requirements:
193
- - - '='
193
+ - - "~>"
194
194
  - !ruby/object:Gem::Version
195
- version: 0.2.5
195
+ version: 1.34.0
196
196
  - !ruby/object:Gem::Dependency
197
197
  name: standardrb
198
198
  requirement: !ruby/object:Gem::Requirement
@@ -258,6 +258,7 @@ extra_rdoc_files: []
258
258
  files:
259
259
  - ".github/ISSUE_TEMPLATE/bug_report.md"
260
260
  - ".github/ISSUE_TEMPLATE/feature_request.md"
261
+ - ".github/dependabot.yml"
261
262
  - ".github/workflows/diagram.yml"
262
263
  - ".github/workflows/main.yml"
263
264
  - ".gitignore"
@@ -272,7 +273,6 @@ files:
272
273
  - Gemfile.rails7.0
273
274
  - Gemfile.rails7.1
274
275
  - LICENSE
275
- - LICENSE.txt
276
276
  - README.md
277
277
  - Rakefile
278
278
  - changes.md
@@ -307,6 +307,7 @@ files:
307
307
  - lib/coverband/reporters/html_report.rb
308
308
  - lib/coverband/reporters/json_report.rb
309
309
  - lib/coverband/reporters/web.rb
310
+ - lib/coverband/reporters/web_pager.rb
310
311
  - lib/coverband/utils/absolute_file_converter.rb
311
312
  - lib/coverband/utils/configuration_template.rb
312
313
  - lib/coverband/utils/dead_methods.rb
@@ -507,140 +508,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
507
508
  requirements:
508
509
  - - ">="
509
510
  - !ruby/object:Gem::Version
510
- version: '2.3'
511
+ version: '2.7'
511
512
  required_rubygems_version: !ruby/object:Gem::Requirement
512
513
  requirements:
513
- - - ">="
514
+ - - ">"
514
515
  - !ruby/object:Gem::Version
515
- version: '0'
516
+ version: 1.3.1
516
517
  requirements: []
517
518
  rubygems_version: 3.4.10
518
519
  signing_key:
519
520
  specification_version: 4
520
521
  summary: Rack middleware to measure production code usage (LOC runtime usage)
521
- test_files:
522
- - test/benchmarks/.gitignore
523
- - test/benchmarks/benchmark.rake
524
- - test/benchmarks/coverage_fork.sh
525
- - test/benchmarks/dog.rb
526
- - test/benchmarks/graph_bench.sh
527
- - test/benchmarks/init_rails.rake
528
- - test/big_dog.rb.erb
529
- - test/coverband/adapters/base_test.rb
530
- - test/coverband/adapters/file_store_test.rb
531
- - test/coverband/adapters/hash_redis_store_test.rb
532
- - test/coverband/adapters/null_store_test.rb
533
- - test/coverband/adapters/redis_store_test.rb
534
- - test/coverband/adapters/web_service_store_test.rb
535
- - test/coverband/at_exit_test.rb
536
- - test/coverband/collectors/coverage_test.rb
537
- - test/coverband/collectors/delta_test.rb
538
- - test/coverband/collectors/route_tracker_test.rb
539
- - test/coverband/collectors/translation_tracker_test.rb
540
- - test/coverband/collectors/view_tracker_test.rb
541
- - test/coverband/configuration_test.rb
542
- - test/coverband/coverband_test.rb
543
- - test/coverband/integrations/background_middleware_test.rb
544
- - test/coverband/integrations/background_test.rb
545
- - test/coverband/integrations/rack_server_check_test.rb
546
- - test/coverband/integrations/report_middleware_test.rb
547
- - test/coverband/integrations/resque_worker_test.rb
548
- - test/coverband/integrations/test_resque_job.rb
549
- - test/coverband/reporters/base_test.rb
550
- - test/coverband/reporters/console_test.rb
551
- - test/coverband/reporters/html_test.rb
552
- - test/coverband/reporters/json_test.rb
553
- - test/coverband/reporters/web_test.rb
554
- - test/coverband/utils/absolute_file_converter_test.rb
555
- - test/coverband/utils/dead_methods_test.rb
556
- - test/coverband/utils/file_hasher_test.rb
557
- - test/coverband/utils/file_list_test.rb
558
- - test/coverband/utils/html_formatter_test.rb
559
- - test/coverband/utils/lines_classifier_test.rb
560
- - test/coverband/utils/method_definition_scanner_test.rb
561
- - test/coverband/utils/relative_file_converter_test.rb
562
- - test/coverband/utils/result_test.rb
563
- - test/coverband/utils/results_test.rb
564
- - test/coverband/utils/source_file_line_test.rb
565
- - test/coverband/utils/source_file_test.rb
566
- - test/dog.rb
567
- - test/dog.rb.erb
568
- - test/fake_app/basic_rack.rb
569
- - test/fixtures/app/controllers/sample_controller.rb
570
- - test/fixtures/app/models/user.rb
571
- - test/fixtures/casting_invitor.rb
572
- - test/fixtures/never.rb
573
- - test/fixtures/sample.rb
574
- - test/fixtures/skipped.rb
575
- - test/fixtures/skipped_and_executed.rb
576
- - test/fixtures/utf-8.rb
577
- - test/forked/rails_full_stack_test.rb
578
- - test/forked/rails_full_stack_views_test.rb
579
- - test/forked/rails_rake_full_stack_test.rb
580
- - test/forked/rails_route_tracker_stack_test.rb
581
- - test/forked/rails_view_tracker_stack_test.rb
582
- - test/integration/full_stack_deferred_eager_test.rb
583
- - test/integration/full_stack_send_deferred_eager_test.rb
584
- - test/integration/full_stack_test.rb
585
- - test/jruby_check.rb
586
- - test/rails4_dummy/Rakefile
587
- - test/rails4_dummy/app/controllers/dummy_controller.rb
588
- - test/rails4_dummy/app/controllers/dummy_view_controller.rb
589
- - test/rails4_dummy/app/views/dummy_view/show.html.erb
590
- - test/rails4_dummy/app/views/dummy_view/show_haml.html.haml
591
- - test/rails4_dummy/app/views/dummy_view/show_slim.html.slim
592
- - test/rails4_dummy/config.ru
593
- - test/rails4_dummy/config/application.rb
594
- - test/rails4_dummy/config/boot.rb
595
- - test/rails4_dummy/config/coverband.rb
596
- - test/rails4_dummy/config/coverband_missing_redis.rb
597
- - test/rails4_dummy/config/environment.rb
598
- - test/rails4_dummy/config/routes.rb
599
- - test/rails4_dummy/config/secrets.yml
600
- - test/rails4_dummy/tmp/.keep
601
- - test/rails5_dummy/Rakefile
602
- - test/rails5_dummy/app/controllers/dummy_controller.rb
603
- - test/rails5_dummy/app/controllers/dummy_view_controller.rb
604
- - test/rails5_dummy/app/views/dummy_view/show.html.erb
605
- - test/rails5_dummy/app/views/dummy_view/show_haml.html.haml
606
- - test/rails5_dummy/app/views/dummy_view/show_slim.html.slim
607
- - test/rails5_dummy/config.ru
608
- - test/rails5_dummy/config/application.rb
609
- - test/rails5_dummy/config/coverband.rb
610
- - test/rails5_dummy/config/coverband_missing_redis.rb
611
- - test/rails5_dummy/config/environment.rb
612
- - test/rails5_dummy/config/routes.rb
613
- - test/rails5_dummy/tmp/.keep
614
- - test/rails6_dummy/Rakefile
615
- - test/rails6_dummy/app/controllers/dummy_controller.rb
616
- - test/rails6_dummy/app/controllers/dummy_view_controller.rb
617
- - test/rails6_dummy/app/views/dummy_view/show.html.erb
618
- - test/rails6_dummy/app/views/dummy_view/show_haml.html.haml
619
- - test/rails6_dummy/app/views/dummy_view/show_slim.html.slim
620
- - test/rails6_dummy/config.ru
621
- - test/rails6_dummy/config/application.rb
622
- - test/rails6_dummy/config/boot.rb
623
- - test/rails6_dummy/config/coverband.rb
624
- - test/rails6_dummy/config/coverband_missing_redis.rb
625
- - test/rails6_dummy/config/environment.rb
626
- - test/rails6_dummy/config/routes.rb
627
- - test/rails6_dummy/config/secrets.yml
628
- - test/rails6_dummy/tmp/.keep
629
- - test/rails7_dummy/Rakefile
630
- - test/rails7_dummy/app/controllers/dummy_controller.rb
631
- - test/rails7_dummy/app/controllers/dummy_view_controller.rb
632
- - test/rails7_dummy/app/views/dummy_view/show.html.erb
633
- - test/rails7_dummy/app/views/dummy_view/show_haml.html.haml
634
- - test/rails7_dummy/app/views/dummy_view/show_slim.html.slim
635
- - test/rails7_dummy/config.ru
636
- - test/rails7_dummy/config/application.rb
637
- - test/rails7_dummy/config/boot.rb
638
- - test/rails7_dummy/config/coverband.rb
639
- - test/rails7_dummy/config/coverband_missing_redis.rb
640
- - test/rails7_dummy/config/environment.rb
641
- - test/rails7_dummy/config/routes.rb
642
- - test/rails7_dummy/config/secrets.yml
643
- - test/rails7_dummy/tmp/.keep
644
- - test/rails_test_helper.rb
645
- - test/test_helper.rb
646
- - test/unique_files.rb
522
+ test_files: []
data/LICENSE.txt DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2010-2020 Dan Mayer
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.