coverband 5.1.0.rcmailer.2 → 5.2.0.rc.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) 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/collectors/coverage.rb +19 -1
  15. data/lib/coverband/collectors/view_tracker.rb +27 -20
  16. data/lib/coverband/collectors/view_tracker_service.rb +3 -3
  17. data/lib/coverband/configuration.rb +11 -2
  18. data/lib/coverband/integrations/background.rb +6 -3
  19. data/lib/coverband/reporters/base.rb +1 -1
  20. data/lib/coverband/reporters/web.rb +4 -4
  21. data/lib/coverband/utils/dead_methods.rb +63 -0
  22. data/lib/coverband/utils/method_definition_scanner.rb +96 -0
  23. data/lib/coverband/utils/railtie.rb +3 -2
  24. data/lib/coverband/utils/result.rb +1 -1
  25. data/lib/coverband/utils/source_file.rb +2 -2
  26. data/lib/coverband/utils/tasks.rb +17 -3
  27. data/lib/coverband/version.rb +2 -2
  28. data/lib/coverband.rb +1 -0
  29. data/public/dependencies.js +4 -4
  30. data/roadmap.md +56 -0
  31. data/test/coverband/adapters/null_store_test.rb +39 -0
  32. data/test/coverband/configuration_test.rb +5 -5
  33. data/test/coverband/utils/dead_methods_test.rb +53 -0
  34. data/test/coverband/utils/method_definition_scanner_test.rb +85 -0
  35. data/test/fixtures/casting_invitor.rb +60 -0
  36. data/test/forked/rails_full_stack_test.rb +1 -1
  37. data/test/integration/full_stack_deferred_eager_test.rb +51 -0
  38. data/test/test_helper.rb +1 -0
  39. data/test/unique_files.rb +3 -3
  40. data/views/file_list.erb +2 -2
  41. metadata +25 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 356bd2d155bece44c71e186cc25072ede61e25e3e8236c311cd2c160c93fd6b0
4
- data.tar.gz: 609ac60c8757360b59ad63051e14357635bd2395b0ba9ba09add3140505415c7
3
+ metadata.gz: 4ede2aae4c544308de7eff72d8b0b5b4f6affc9d5802a298073ecc094c31603a
4
+ data.tar.gz: b508d4d3fbc9f32b034ae1d82bed9884f71db9ce2bb0a0fb8903d01e1af73f05
5
5
  SHA512:
6
- metadata.gz: 929208aaadba979be02db9eb55153f91515c14bed94c94de7115255ea89413b87547518a6bbf11f250df506f8604dd1f64c9582b6536a4595943fd2692736776
7
- data.tar.gz: 37ca9ec442e80223284a4b5e9ec6234d1fbff014270f7b9e905db71a9c7513e700a07417f47a123ecbc4b561b0adc075f2e68dd328763599c0f8b2676c555d08
6
+ metadata.gz: 2f2271547dc6da0ba6ab2f738b494419d5944e040bb248d2fddeff317459ab358a6d72a8922a85484b6c47dd1c189be6e4101f0333b5bec370cb285df082e88c
7
+ data.tar.gz: e0090c22100ab00c72657bb782590c19b8b20ebd3d3a2ccd8dcf20a3b11a51b4368b602deb2f324050e9274172325f6743f1601609b3d1358c1d284ff185edf3
@@ -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"