coverband 5.1.0.rcmailer.1 → 5.2.0.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/diagram.yml +16 -0
  3. data/.github/workflows/main.yml +5 -5
  4. data/Gemfile +2 -5
  5. data/README.md +33 -1
  6. data/changes.md +19 -66
  7. data/coverband.gemspec +16 -4
  8. data/diagram.svg +1 -0
  9. data/lib/coverband/adapters/base.rb +8 -7
  10. data/lib/coverband/adapters/file_store.rb +1 -1
  11. data/lib/coverband/adapters/hash_redis_store.rb +1 -1
  12. data/lib/coverband/adapters/null_store.rb +42 -0
  13. data/lib/coverband/adapters/redis_store.rb +1 -1
  14. data/lib/coverband/at_exit.rb +3 -0
  15. data/lib/coverband/collectors/coverage.rb +19 -1
  16. data/lib/coverband/collectors/view_tracker.rb +27 -20
  17. data/lib/coverband/collectors/view_tracker_service.rb +3 -3
  18. data/lib/coverband/configuration.rb +9 -2
  19. data/lib/coverband/integrations/background.rb +6 -3
  20. data/lib/coverband/reporters/base.rb +1 -1
  21. data/lib/coverband/reporters/web.rb +4 -4
  22. data/lib/coverband/utils/dead_methods.rb +63 -0
  23. data/lib/coverband/utils/method_definition_scanner.rb +96 -0
  24. data/lib/coverband/utils/railtie.rb +3 -2
  25. data/lib/coverband/utils/result.rb +1 -1
  26. data/lib/coverband/utils/source_file.rb +2 -2
  27. data/lib/coverband/utils/tasks.rb +17 -3
  28. data/lib/coverband/version.rb +2 -2
  29. data/lib/coverband.rb +1 -0
  30. data/public/dependencies.js +4 -4
  31. data/roadmap.md +56 -0
  32. data/test/coverband/adapters/null_store_test.rb +39 -0
  33. data/test/coverband/configuration_test.rb +5 -5
  34. data/test/coverband/utils/dead_methods_test.rb +53 -0
  35. data/test/coverband/utils/method_definition_scanner_test.rb +85 -0
  36. data/test/fixtures/casting_invitor.rb +60 -0
  37. data/test/forked/rails_full_stack_test.rb +1 -1
  38. data/test/integration/full_stack_deferred_eager_test.rb +51 -0
  39. data/test/test_helper.rb +1 -0
  40. data/test/unique_files.rb +3 -3
  41. data/views/file_list.erb +2 -2
  42. metadata +25 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec5d51bc8a16c6d59cb6a04ae43ffd0f242677038851c7f44fe0f2720d1686c8
4
- data.tar.gz: 608b0442f7993d8e18c686c49037521dbe96325f2f240bb11a542229e3a0bbb8
3
+ metadata.gz: d0a758df9e83a3c4a146dc3c14a9d5a400a8acc842b535e1f6b1c10d6fce5e1d
4
+ data.tar.gz: 450e780dd71dacaaab91bf82a1f65a2504e17b433a0c9e85d57dd3d9b191cc67
5
5
  SHA512:
6
- metadata.gz: 9d88524814527a2df8c30d7e15005d3cbab174612fdc841035e46bef0847bd352450357c64a64945e8ed72935c0f288746e1f90773397836ed74fdce5c7f0f83
7
- data.tar.gz: d56b0c8f50e6d985b5eecac8051e2516359698c41b70f230d21256b73faab0392097ad5b1ece4cfad685251e5a816fa52db0bdcdbc5fbc71640c94686f6ef141
6
+ metadata.gz: 8a50d8a5858ab8291a54da9e3b3744c90e0229cf11fa3dfa9a598117d4e547ae2aa460ee356b5c0ba4930cfb5eff501c3c90bf1acd37b22f588c458ededcbe43
7
+ data.tar.gz: abbfe9d3debe2c58c60bdec9391e73fe2df1f44c10e03599993cdc351567b91fcfce92a9045ec3388e7f797e589a264f27ea6e5187d8491b17b5878377f03a67
@@ -0,0 +1,16 @@
1
+ name: Create diagram
2
+ on:
3
+ workflow_dispatch: {}
4
+ push:
5
+ branches:
6
+ - main
7
+ jobs:
8
+ get_data:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: Checkout code
12
+ uses: actions/checkout@master
13
+ - name: Update diagram
14
+ uses: githubocto/repo-visualizer@main
15
+ with:
16
+ excluded_paths: "ignore,.github"
@@ -3,9 +3,9 @@ name: CI
3
3
  on:
4
4
  # Triggers the workflow on push or pull request events but only for the master branch
5
5
  push:
6
- branches: [master]
6
+ branches: [main]
7
7
  pull_request:
8
- branches: [master]
8
+ branches: [main]
9
9
  jobs:
10
10
  test:
11
11
  strategy:
@@ -17,12 +17,12 @@ jobs:
17
17
  # remove until I sort out CI issues for truffle
18
18
  # truffleruby,
19
19
  # truffleruby-head,
20
- ruby: [2.3, 2.4, 2.5, 2.6, 2.7, jruby, jruby-head]
21
- redis-version: [5]
20
+ ruby: [2.3, 2.4, 2.5, 2.6, 2.7, "3.0", jruby, jruby-head]
21
+ redis-version: [4, 5, 6]
22
22
  runs-on: ${{ matrix.os }}-latest
23
23
  steps:
24
24
  - uses: actions/checkout@v2
25
- - uses: supercharge/redis-github-action@1.1.0
25
+ - uses: supercharge/redis-github-action@1.2.0
26
26
  - uses: ruby/setup-ruby@v1
27
27
  with:
28
28
  ruby-version: ${{ matrix.ruby }}
data/Gemfile CHANGED
@@ -7,11 +7,8 @@ gemspec
7
7
 
8
8
  # add when debugging
9
9
  # require 'byebug'; byebug
10
- if ENV["CI"]
11
- # skipping pry-byebug as it has issues on Ruby 2.3 on travis
12
- # and we don't really need it on CI
13
- else
14
- gem "pry-byebug", platforms: [:mri, :mingw, :x64_mingw]
10
+ unless ENV["CI"]
11
+ gem "pry-byebug"
15
12
  end
16
13
 
17
14
  gem "rails", "~>5"
data/README.md CHANGED
@@ -12,6 +12,7 @@
12
12
  <a href="#installation">Installation</a> •
13
13
  <a href="#coverband-web-ui">Coverband Web UI</a> •
14
14
  <a href="#advanced-config">Advanced Config</a> •
15
+ <a href="#newer-features">Newer Features</a> •
15
16
  <a href="#license">License</a> •
16
17
  <a href="/changes.md">Change Log / Roadmap</a> •
17
18
  <a href="/CODE_OF_CONDUCT.md">Code of Conduct</a>
@@ -33,6 +34,7 @@ The primary goal of Coverband is giving deep insight into your production runtim
33
34
  - Development mode, offers deep insight of code usage details (number of LOC execution during single request, etc) during development.
34
35
  - Mountable web interface to easily share reports
35
36
 
37
+
36
38
  # Installation
37
39
 
38
40
  ## Redis
@@ -282,7 +284,7 @@ Between the release of 4.0 and 4.1 our data format changed. This resets all your
282
284
 
283
285
  ### Adding Rake Tasks outside of Rails
284
286
 
285
- Rails apps should automaticallly include the tasks via the Railtie.
287
+ Rails apps should automatically include the tasks via the Railtie.
286
288
 
287
289
  For non Rails apps, either add the below to your `Rakefile` or to a file included in your `Rakefile` such as `lib/tasks/coverband.rake` if you want to break it up that way.
288
290
 
@@ -337,6 +339,30 @@ gem 'coverband', require: ['alternative_coverband_patch']
337
339
 
338
340
  This conflict happens when a ruby method is patched twice, once using module prepend, and once using method aliasing. See this ruby issue for details. The fix is to apply all patches the same way. Coverband by default will apply its patch using prepend, but you can change that to method aliasing by adding require: ['alternative_coverband_patch'] to the gem line as shown above.
339
341
 
342
+ # Newer Features
343
+
344
+ ### Dead Method Scanning (ruby 2.6+)
345
+
346
+ Rake task that outputs dead methods based on current coverage data:
347
+
348
+ ```
349
+ bundle exec rake coverband:dead_methods
350
+ ```
351
+
352
+ Outputs:
353
+
354
+ ```
355
+ ---------------------------------------------------------------------------------------------------
356
+ | file | class | method | line_number |
357
+ | ./config/routes.rb | AdminConstraint | matches? | 20 |
358
+ | ./app/controllers/home_controller.rb | HomeController | trigger_jobs | 8 |
359
+ | ./app/controllers/home_controller.rb | HomeController | data_tracer | 14 |
360
+ | ./app/controllers/posts_controller.rb | PostsController | edit | 22 |
361
+ | ./app/controllers/posts_controller.rb | PostsController | destroy_bad_dangerously | 73 |
362
+ ---------------------------------------------------------------------------------------------------
363
+ ```
364
+
365
+
340
366
  # Prerequisites
341
367
 
342
368
  - Coverband 3.0.X+ requires Ruby 2.3+
@@ -401,6 +427,12 @@ What is the coverage data in Redis?
401
427
 
402
428
  `Coverband.configuration.store.coverage`
403
429
 
430
+ ### Diagram
431
+
432
+ A diagram of the code.
433
+
434
+ ![Visualization of this repo](./diagram.svg)
435
+
404
436
  ## Logo
405
437
 
406
438
  The Coverband logo was created by [Dave Woodall](http://davewoodall.com). Thanks Dave!
data/changes.md CHANGED
@@ -1,73 +1,32 @@
1
- # Future Roadmap
1
+ ### Coverband 5.2.0
2
2
 
3
- ### Research Alternative Redis formats
3
+ - (Fumiaki MATSUSHIMA) Fix CI setting for Ruby 3.0
4
+ - (Fumiaki MATSUSHIMA) Avoid calling coverage with the same type twice on get_coverage_report
5
+ - (kei-s) Fix filling zero for not loaded files
6
+ - (wonda-tea-coffee) cleanup readme / fix typos
7
+ - support deferred eager loading data
8
+ - (Donatas Stundys) Fix disabling views tracking
9
+ - (Simon) Improve View tracker to track render collection too
4
10
 
5
- - Look at alternative storage formats for Redis
6
- - [redis bitmaps](http://blog.getspool.com/2011/11/29/fast-easy-realtime-metrics-using-redis-bitmaps/)
7
- - [redis bitfield](https://stackoverflow.com/questions/47100606/optimal-way-to-store-array-of-integers-in-redis-database)
8
- - Add support for [zadd](http://redis.io/topics/data-types-intro) so one could determine single call versus multiple calls on a line, letting us determine the most executed code in production.
11
+ ### Coverband 5.1.1
9
12
 
10
- ### Coverband Future...
13
+ - Fix early report error
14
+ - Improved view tracker perf Hosam Aly
11
15
 
12
- Will be the fully modern release that drops maintenance legacy support in favor of increased performance, ease of use, and maintainability.
16
+ ### Coverband 5.1.0
13
17
 
14
- - Release will be aimed as significantly simplifying ease of use
15
- - near zero config setup for Rails apps
16
- - add built-in support for easy loading via Railties
17
- - built in support for activejob, sidekiq, and other common frameworks
18
- - reduced configuration options
19
- - support oneshot
20
- - drop middleware figure out a way to kick off background without middelware
21
- - options on reporting
22
- - background reporting
23
- - or middleware reporting
24
- - Support for file versions
25
- - md5 or release tags
26
- - add coverage timerange support
27
- - Drop Simplecov dependency
28
- - improved web reporting
29
- - lists current config options
30
- - eventually allow updating remote config
31
- - full theming
32
- - list redis data dump for debugging
33
- - additional adapters: Memcache, S3, and ActiveRecord
34
- - add articles / podcasts like prontos readme https://github.com/prontolabs/pronto
35
- - Add detailed Gem usage report, if we collect and send gem usage we can give percentage of gem code used, which should help application developers know when to remove gem dependencies (0%) or perhaps inline single methods for little usage (using <= 5%) for example.
36
- - add meta data information first seen last recorded to the coverage report views (probably need to drop simplecov for that).
37
- - more details in this issue: https://github.com/danmayer/coverband/issues/118
38
- - Make good video on setup, install, usage
39
- - See if we can add support for views / templates
40
- - using this technique https://github.com/ioquatix/covered
41
- - Better default grouping (could use groups features for gems for rails controllers, models, lib, etc)
42
- - Improved logging for easier debugging and development
43
- - drop the verbose mode and better support standard logger levels
44
- - Possibly setup a build assets system
45
- - my JS rules expanded the compressed JS at the top of application.js, basically we want to stitch together JS
46
- - I guess we could also load multiple JS files as most of the JS is just default compressed JS and a tiny amount of actual app JS.
47
- - lazy load for Coverband results
48
- - view layer file coverage
49
- - move all code to work with relative paths leaving only stdlib Coverage working on full paths
50
- - add gem_safe_lists to track only some gems
51
- - add gem_details_safe list to report on details on some gems
52
- - - display gems that are in loaded with 0 coverage, thanks @kbaum
53
-
54
- # Alpha / Beta / Release Candidates
55
-
56
- ### Coverband 5.0.4
57
-
58
- - ?
59
-
60
- # Released
18
+ - add support for dead method detection rake task
19
+ - add support for tracking email view templates/partials
61
20
 
62
21
  ### Coverband 5.0.3
63
22
 
64
- - fix for non standard root paths for view_tracker thx @markshawtoronto
23
+ - fix for non standard root paths for view_tracker thx @markshawtoronto
65
24
  - support basic auth for Rack prior to 2.0 thx @kadru
66
25
 
67
26
  ### Coverband 5.0.2
68
27
 
69
28
  - change default port of local server
70
- - update on readme about issue with scout app, thanks @mrbongiolo
29
+ - update on readme about issue with scout app, thanks @mrbongiolo
71
30
  - fix on configuration page not loading when redis can't load
72
31
 
73
32
  ### Coverband 5.0.1
@@ -82,13 +41,7 @@ Will be the fully modern release that drops maintenance legacy support in favor
82
41
  - drops static report support
83
42
  - drops gem support
84
43
  - only loaded web reporter files when required
85
- - configuration improvements
86
- - improved load order allowing more time for ENV vars (better dotenv, figaro, rails secrets support)
87
- - all config options can be set via coverband config, not requiring ENV var support
88
- - deprecation notices on soon to be removed config options
89
- - config exceptions on invalid configuration combinations
90
- - additional testing around configurations
91
- - improved defaults and reduced configuration options
44
+ - configuration improvements - improved load order allowing more time for ENV vars (better dotenv, figaro, rails secrets support) - all config options can be set via coverband config, not requiring ENV var support - deprecation notices on soon to be removed config options - config exceptions on invalid configuration combinations - additional testing around configurations - improved defaults and reduced configuration options
92
45
  - improved resque patching pattern
93
46
  - improved default ignores
94
47
  - additional adapters
@@ -155,7 +108,7 @@ Will be the fully modern release that drops maintenance legacy support in favor
155
108
  - larger changes
156
109
  - reduce memory usage
157
110
  - fix issue where reports didn't include files with 0 activity
158
- - updated runtime relavent lines and runtime percentages
111
+ - updated runtime relevant lines and runtime percentages
159
112
  - add Oneshot coverage support for Ruby 2.6.0 thanks @zwalker
160
113
  - I would consider this our test oneshot release, please report any issues
161
114
  - improved control over memory vs functionality
@@ -187,7 +140,7 @@ Will be the fully modern release that drops maintenance legacy support in favor
187
140
 
188
141
  ### Coverband 4.2.0
189
142
 
190
- **NOTE:** This release introduces load time and runtime Coverage. To get the full benifit of this feature you need to reset you coverage data (`rake coverband:clear` or clear via the web UI). Until you clear the combined result is still correct, but your runtime data will be mixed with previous data. This is due to an additive change in how we store coverage. We didn't reset by default as the coverage history for some folks may be more important than runtime breakdown.
143
+ **NOTE:** This release introduces load time and runtime Coverage. To get the full benefit of this feature you need to reset you coverage data (`rake coverband:clear` or clear via the web UI). Until you clear the combined result is still correct, but your runtime data will be mixed with previous data. This is due to an additive change in how we store coverage. We didn't reset by default as the coverage history for some folks may be more important than runtime breakdown.
191
144
 
192
145
  - loadtime vs runtime coverage
193
146
  - This fixes the coverage last seen date to exclude just load time data
data/coverband.gemspec CHANGED
@@ -8,16 +8,28 @@ Gem::Specification.new do |spec|
8
8
  spec.name = "coverband"
9
9
  spec.version = Coverband::VERSION
10
10
  spec.authors = ["Dan Mayer", "Karl Baum"]
11
- spec.email = ["dan@mayerdan.com"]
12
- spec.description = "Rack middleware to measure production code usage (LOC runtime usage)"
13
- spec.summary = "Rack middleware to measure production code usage (LOC runtime usage)"
11
+ spec.email = %w[dan@mayerdan.com]
12
+ spec.description =
13
+ "Rack middleware to measure production code usage (LOC runtime usage)"
14
+ spec.summary =
15
+ "Rack middleware to measure production code usage (LOC runtime usage)"
14
16
  spec.homepage = "https://github.com/danmayer/coverband"
15
17
  spec.license = "MIT"
16
18
 
17
19
  spec.files = `git ls-files`.split("\n").reject { |f| f.start_with?("docs") }
18
20
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
21
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
- spec.require_paths = ["lib"]
22
+ spec.require_paths = %w[lib]
23
+
24
+ spec.required_ruby_version = '>= 2.3'
25
+
26
+ spec.metadata = {
27
+ "homepage_uri" => "https://github.com/danmayer/coverband",
28
+ "bug_tracker_uri" => "https://github.com/danmayer/coverband/issues",
29
+ "documentation_uri" => "https://github.com/danmayer/coverband",
30
+ "changelog_uri" => "https://github.com/danmayer/coverband/blob/main/changes.md",
31
+ "source_code_uri" => "https://github.com/danmayer/coverband",
32
+ }
21
33
 
22
34
  spec.add_development_dependency "benchmark-ips"
23
35
  spec.add_development_dependency "capybara"