coverband 4.2.7 → 5.0.0.rc.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/.standard.yml +25 -0
  3. data/.travis.yml +2 -1
  4. data/Gemfile +5 -7
  5. data/Gemfile.rails4 +0 -3
  6. data/Gemfile.rails6 +0 -3
  7. data/README.md +8 -77
  8. data/Rakefile +17 -17
  9. data/changes.md +18 -27
  10. data/config.ru +1 -1
  11. data/coverband.gemspec +29 -34
  12. data/lib/coverband.rb +55 -43
  13. data/lib/coverband/adapters/base.rb +17 -17
  14. data/lib/coverband/adapters/file_store.rb +2 -2
  15. data/lib/coverband/adapters/hash_redis_store.rb +24 -21
  16. data/lib/coverband/adapters/redis_store.rb +12 -12
  17. data/lib/coverband/at_exit.rb +1 -1
  18. data/lib/coverband/collectors/coverage.rb +15 -27
  19. data/lib/coverband/collectors/delta.rb +19 -9
  20. data/lib/coverband/collectors/view_tracker.rb +10 -10
  21. data/lib/coverband/configuration.rb +47 -83
  22. data/lib/coverband/integrations/background.rb +3 -3
  23. data/lib/coverband/integrations/rack_server_check.rb +3 -3
  24. data/lib/coverband/reporters/base.rb +10 -10
  25. data/lib/coverband/reporters/console_report.rb +1 -1
  26. data/lib/coverband/reporters/html_report.rb +10 -30
  27. data/lib/coverband/reporters/web.rb +56 -49
  28. data/lib/coverband/utils/absolute_file_converter.rb +6 -6
  29. data/lib/coverband/utils/html_formatter.rb +32 -61
  30. data/lib/coverband/utils/railtie.rb +16 -4
  31. data/lib/coverband/utils/relative_file_converter.rb +2 -2
  32. data/lib/coverband/utils/result.rb +6 -11
  33. data/lib/coverband/utils/results.rb +0 -10
  34. data/lib/coverband/utils/source_file.rb +21 -30
  35. data/lib/coverband/utils/tasks.rb +7 -11
  36. data/lib/coverband/version.rb +1 -1
  37. data/public/application.js +0 -30
  38. data/test/benchmarks/benchmark.rake +97 -92
  39. data/test/benchmarks/dog.rb +1 -1
  40. data/test/benchmarks/init_rails.rake +4 -4
  41. data/test/coverband/adapters/base_test.rb +29 -30
  42. data/test/coverband/adapters/file_store_test.rb +15 -16
  43. data/test/coverband/adapters/hash_redis_store_test.rb +57 -57
  44. data/test/coverband/adapters/redis_store_test.rb +26 -26
  45. data/test/coverband/at_exit_test.rb +2 -2
  46. data/test/coverband/collectors/coverage_test.rb +33 -47
  47. data/test/coverband/collectors/delta_test.rb +51 -23
  48. data/test/coverband/collectors/view_tracker_test.rb +35 -35
  49. data/test/coverband/configuration_test.rb +15 -41
  50. data/test/coverband/coverband_test.rb +11 -11
  51. data/test/coverband/integrations/background_middleware_test.rb +10 -10
  52. data/test/coverband/integrations/background_test.rb +3 -2
  53. data/test/coverband/integrations/rack_server_check_test.rb +7 -7
  54. data/test/coverband/integrations/report_middleware_test.rb +9 -9
  55. data/test/coverband/integrations/resque_worker_test.rb +9 -9
  56. data/test/coverband/integrations/test_resque_job.rb +1 -1
  57. data/test/coverband/reporters/base_test.rb +9 -9
  58. data/test/coverband/reporters/console_test.rb +6 -6
  59. data/test/coverband/reporters/html_test.rb +36 -48
  60. data/test/coverband/reporters/web_test.rb +16 -18
  61. data/test/coverband/utils/absolute_file_converter_test.rb +22 -22
  62. data/test/coverband/utils/file_hasher_test.rb +6 -12
  63. data/test/coverband/utils/file_list_test.rb +13 -13
  64. data/test/coverband/utils/html_formatter_test.rb +9 -23
  65. data/test/coverband/utils/lines_classifier_test.rb +29 -29
  66. data/test/coverband/utils/relative_file_converter_test.rb +13 -13
  67. data/test/coverband/utils/result_test.rb +18 -18
  68. data/test/coverband/utils/results_test.rb +17 -17
  69. data/test/coverband/utils/source_file_line_test.rb +46 -46
  70. data/test/coverband/utils/source_file_test.rb +38 -88
  71. data/test/dog.rb +1 -1
  72. data/test/fake_app/basic_rack.rb +2 -2
  73. data/test/fixtures/app/controllers/sample_controller.rb +1 -1
  74. data/test/fixtures/app/models/user.rb +1 -1
  75. data/test/fixtures/sample.rb +1 -1
  76. data/test/fixtures/utf-8.rb +0 -2
  77. data/test/forked/rails_full_stack_test.rb +24 -27
  78. data/test/forked/rails_rake_full_stack_test.rb +7 -26
  79. data/test/integration/full_stack_test.rb +11 -22
  80. data/test/jruby_check.rb +2 -3
  81. data/test/rails4_dummy/Rakefile +1 -1
  82. data/test/rails4_dummy/config.ru +1 -1
  83. data/test/rails4_dummy/config/application.rb +4 -4
  84. data/test/rails4_dummy/config/boot.rb +2 -2
  85. data/test/rails4_dummy/config/coverband.rb +1 -1
  86. data/test/rails4_dummy/config/coverband_missing_redis.rb +1 -1
  87. data/test/rails4_dummy/config/environment.rb +1 -1
  88. data/test/rails4_dummy/config/routes.rb +2 -2
  89. data/test/rails5_dummy/Rakefile +1 -1
  90. data/test/rails5_dummy/config.ru +1 -1
  91. data/test/rails5_dummy/config/application.rb +3 -3
  92. data/test/rails5_dummy/config/coverband.rb +8 -8
  93. data/test/rails5_dummy/config/coverband_missing_redis.rb +8 -8
  94. data/test/rails5_dummy/config/environment.rb +1 -1
  95. data/test/rails5_dummy/config/routes.rb +2 -2
  96. data/test/rails6_dummy/Rakefile +1 -1
  97. data/test/rails6_dummy/config.ru +1 -1
  98. data/test/rails6_dummy/config/application.rb +4 -4
  99. data/test/rails6_dummy/config/boot.rb +2 -2
  100. data/test/rails6_dummy/config/coverband.rb +1 -1
  101. data/test/rails6_dummy/config/coverband_missing_redis.rb +1 -1
  102. data/test/rails6_dummy/config/environment.rb +1 -1
  103. data/test/rails6_dummy/config/routes.rb +2 -2
  104. data/test/rails_test_helper.rb +11 -11
  105. data/test/test_helper.rb +41 -34
  106. data/test/unique_files.rb +10 -10
  107. data/views/layout.erb +2 -12
  108. metadata +6 -45
  109. data/.rubocop.yml +0 -86
  110. data/lib/coverband/integrations/bundler.rb +0 -8
  111. data/lib/coverband/utils/file_groups.rb +0 -53
  112. data/lib/coverband/utils/gem_list.rb +0 -31
  113. data/lib/coverband/utils/s3_report.rb +0 -105
  114. data/test/coverband/utils/file_groups_test.rb +0 -61
  115. data/test/coverband/utils/gem_list_test.rb +0 -48
  116. data/test/coverband/utils/s3_report_test.rb +0 -44
  117. data/views/gem_list.erb +0 -63
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20e9436ff0630bcadbcc20f7722e68ae741dc097f35a66f1cd475922735e0992
4
- data.tar.gz: c1e38bce438a659964742341b2717c48c70d01343ac577a573196e59e97f5500
3
+ metadata.gz: c59cff2fa063db7a0c165e9cfefa8607151ee39699bf57cbb6bb6fce849abe97
4
+ data.tar.gz: 6fedd5cc2efd695370b3136f293209184b8c633e093ae75ac2f7d083c1eec13d
5
5
  SHA512:
6
- metadata.gz: 0e27f3a253494b84ece19a9c300f8e2b7272c2d00775bb881f4297f2bb4ca7481187979bfad3ebf61fa5c225ac882164a1ec760f650508fa7fef6d893b81584c
7
- data.tar.gz: 589cb836e0a278fc704afa55d873ea3c6e42fd420141b8480cb7d968e0a5e037a7ad34dd148d2a1c7a77c3dc09d6ba1e4bcddc05707c9f17471a4bf0a7da4030
6
+ metadata.gz: 75740ba292febb787cbb40beaa47b1a355d9303b23b43fc949d77f918848497fca538e080e86baf5d898b4a5001a9a838ed64846cb5a039a6aaa2a300f39edf0
7
+ data.tar.gz: 6ed03c519ee7a4a5d24f6399c8a1a747d2de58d0a6370575f72bed528a18cd4d24c941c6e7f60902ced21883e4f664158a91881b3518577722323cb5cc5b904c
@@ -0,0 +1,25 @@
1
+ ruby_version: 2.3
2
+ fix: false # default: false
3
+ parallel: true # default: false
4
+ format: progress # default: Standard::Formatter
5
+ default_ignores: false # default: true
6
+
7
+ ignore: # default: []
8
+ - "lib/**/*":
9
+ - Style/IdenticalConditionalBranches # these are just easier to read sometimes
10
+ - Style/IfInsideElse # these are just easier to read sometimes
11
+ - Standard/SemanticBlocks # not valid in older Ruby
12
+ - Style/Alias # This isn't always right and alias and alias_method can have different usage
13
+ - Style/RedundantRegexpEscape # fix later, enforcement changed
14
+ - Layout/ArrayAlignment # WTF all of master broken from a few changes in rubo
15
+ - Performance/RegexpMatch # Rubocop / standardrb have this WRONG for Ruby 2.3/2.4 not compatiable
16
+ - "vendor/**/*"
17
+ - "pkg/**/*"
18
+ - "test/**/*":
19
+ - Layout/AlignHash
20
+ - Style/GlobalVars
21
+ - Lint/InterpolationCheck # a test is verifying comments
22
+ - Standard/SemanticBlocks # not valid in older Ruby
23
+ - Layout/ArrayAlignment # ruby 2.3 / modern seem to dissagree on rubocop/standardrb
24
+ - "test/benchmarks/benchmark.rake":
25
+ - Lint/UselessAssignment # oddity of memory benchmarking
@@ -15,6 +15,7 @@ env:
15
15
  # --dev improves JRuby startup time
16
16
  # See https://github.com/jruby/jruby/wiki/Improving-startup-time
17
17
  - JRUBY_OPTS="--dev"
18
+ - JAVA_OPTS="--add-opens java.base/{java.security.cert=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.util.zip=ALL-UNNAMED"
18
19
 
19
20
  jobs:
20
21
  exclude:
@@ -36,7 +37,7 @@ services:
36
37
  script:
37
38
  - sudo ./lua/install.sh
38
39
  - $HOME/lua51/bin/busted lua/test/*
39
- - bundle exec rake rubocop
40
+ - bundle exec standardrb
40
41
  - COVERBAND_HASH_REDIS_STORE=t bundle exec rake
41
42
  - COVERBAND_HASH_REDIS_STORE=t bundle exec rake forked_tests
42
43
  - bundle exec rake
data/Gemfile CHANGED
@@ -1,21 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
 
5
5
  # Specify your gem's dependencies in coverband.gemspec
6
6
  gemspec
7
7
 
8
8
  # add when debugging
9
9
  # require 'byebug'; byebug
10
- if ENV['CI']
10
+ if ENV["CI"]
11
11
  # skipping pry-byebug as it has issues on Ruby 2.3 on travis
12
12
  # and we don't really need it on CI
13
13
  else
14
- gem 'pry-byebug', platforms: [:mri, :mingw, :x64_mingw]
14
+ gem "pry-byebug", platforms: [:mri, :mingw, :x64_mingw]
15
15
  end
16
16
 
17
- gem 'rails', '~>5'
17
+ gem "rails", "~>5"
18
18
  # these gems are used for testing gem tracking
19
- gem 'irb', require: false
20
- gem 'pundit'
21
- gem 'rainbow', require: false
19
+ gem "irb", require: false
@@ -5,6 +5,3 @@ source 'https://rubygems.org'
5
5
  # Specify your gem's dependencies in coverband.gemspec
6
6
  gemspec
7
7
  gem 'rails', '~>4'
8
- # this is used for testing gem tracking
9
- gem 'rainbow', require: false
10
- gem 'pundit'
@@ -5,6 +5,3 @@ source 'https://rubygems.org'
5
5
  # Specify your gem's dependencies in coverband.gemspec
6
6
  gemspec
7
7
  gem 'rails', '~>6'
8
- # this is used for testing gem tracking
9
- gem 'rainbow', require: false
10
- gem 'pundit'
data/README.md CHANGED
@@ -30,7 +30,6 @@ The primary goal of Coverband is giving deep insight into your production runtim
30
30
  - Out of the box support for all standard code execution paths (web, cron, background jobs, rake tasks, etc)
31
31
  - Splits load time (Rails eager load) and Run time metrics
32
32
  - Easy to understand actionable insights from the report
33
- - Tracks Gem usage (still in experimental stages and not recommended for production)
34
33
  - Development mode, offers deep insight of code usage details (number of LOC execution during single request, etc) during development.
35
34
  - Mountable web interface to easily share reports
36
35
 
@@ -54,8 +53,6 @@ Add this line to your application's `Gemfile`, remember to `bundle install` afte
54
53
  gem 'coverband'
55
54
  ```
56
55
 
57
- If [tracking gem usage](#collecting-gem--library-usage), be sure to include coverband before other gems you would like to track.
58
-
59
56
  ## Upgrading to Latest
60
57
 
61
58
  ### No custom code or middleware required
@@ -66,7 +63,7 @@ See [changelog](https://github.com/danmayer/coverband/blob/master/changes.md).
66
63
 
67
64
  ## Rails
68
65
 
69
- The Railtie integration means you shouldn't need to do anything else other than ensure coverband is required after rails within your Gemfile. The only exception to this is gem tracking of `Bundle.require` which depends on requiring coverband within the application.rb. See [Collecting Gem / Library Usage](https://github.com/danmayer/coverband#collecting-gem--library-usage).
66
+ The Railtie integration means you shouldn't need to do anything else other than ensure Coverband is required after Rails within your Gemfile.
70
67
 
71
68
  ## Sinatra
72
69
 
@@ -117,14 +114,14 @@ The web endpoint is a barebones endpoint that you can either expose direct (afte
117
114
 
118
115
  ### JRuby Support
119
116
 
120
- Coverband is compatible with JRuby. If you want to run on JRuby note that I haven't benchmarked and I believe the perf impact on oldre versions of JRuby could be significant, improved Coverage support is in [JRuby master](https://github.com/jruby/jruby/pull/6180), and will be in the next release.
117
+ Coverband is compatible with JRuby. If you want to run on JRuby note that I haven't benchmarked and I believe the perf impact on older versions of JRuby could be significant, improved Coverage support is in [JRuby master](https://github.com/jruby/jruby/pull/6180), and will be in the next release.
121
118
 
122
- * older versions of JRuby need tracing enabled to work (and this could cause bad performance)
123
- * run Jruby with the `--debug` option
124
- * add into your `.jrubyrc` the `debug.fullTrace=true` setting
125
- * For best performance the `oneshot_lines` is recommended, and in the latest releases should have very low overhead
126
- * See JRuby support in a Rails app configured to run via JRuby, in [Coverband Demo](https://github.com/coverband-service/coverband_demo)
127
- * JRuby is tested via CI against Rails 5 and 6
119
+ - older versions of JRuby need tracing enabled to work (and this could cause bad performance)
120
+ - run Jruby with the `--debug` option
121
+ - add into your `.jrubyrc` the `debug.fullTrace=true` setting
122
+ - For best performance the `oneshot_lines` is recommended, and in the latest releases should have very low overhead
123
+ - See JRuby support in a Rails app configured to run via JRuby, in [Coverband Demo](https://github.com/coverband-service/coverband_demo)
124
+ - JRuby is tested via CI against Rails 5 and 6
128
125
 
129
126
  ### Rake Tasks
130
127
 
@@ -168,11 +165,6 @@ Below is an example config file for a Rails 5 app:
168
165
  Coverband.configure do |config|
169
166
  config.store = Coverband::Adapters::RedisStore.new(Redis.new(url: ENV['MY_REDIS_URL']))
170
167
  config.logger = Rails.logger
171
- # configure S3 integration
172
- config.s3_bucket = 'coverband-demo'
173
- config.s3_region = 'us-east-1'
174
- config.s3_access_key_id = ENV['AWS_ACCESS_KEY_ID']
175
- config.s3_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
176
168
 
177
169
  # config options false, true. (defaults to false)
178
170
  # true and debug can give helpful and interesting code usage information
@@ -228,27 +220,6 @@ To opt-in to this feature... enable the feature in your Coverband config.
228
220
 
229
221
  ![image](https://raw.github.com/danmayer/coverband/master/docs/coverband_view_tracker.png)
230
222
 
231
- ### Writing Coverband Results to S3
232
-
233
- If you add some additional Coverband configuration your coverage html report will be written directly to S3, update `config/coverband.rb` like below.
234
-
235
- ```
236
- # configure S3 integration
237
- config.s3_bucket = 'coverband-demo'
238
- config.s3_region = 'us-east-1'
239
- config.s3_access_key_id = ENV['AWS_ACCESS_KEY_ID']
240
- config.s3_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
241
- ```
242
-
243
- Alternatively, Coverband if you don't set via the `config.s3_*` accessor methods will look for the standard S3 environment variables.
244
-
245
- ```
246
- ENV['AWS_BUCKET']
247
- ENV['AWS_REGION']
248
- ENV['AWS_ACCESS_KEY_ID']
249
- ENV['AWS_SECRET_ACCESS_KEY']
250
- ```
251
-
252
223
  ### Fixing Coverage Only Shows Loading Hits
253
224
 
254
225
  If all your coverage is being counted as loading or eager_loading coverage, and nothing is showing as runtime Coverage the initialization hook failed for some reason. The most likely reason for this issue is manually calling `eager_load!` on some Plugin/Gem. If you or a plugin is altering the Rails initialization process, you can manually flip Coverband to runtime coverage by calling these two lines, in an `after_initialize` block, in `application.rb`.
@@ -322,46 +293,6 @@ rake coverband:clear # reset coverband coverage data
322
293
  rake coverband:coverage # report runtime coverband code coverage
323
294
  ```
324
295
 
325
- ### Collecting Gem / Library Usage
326
-
327
- **WARNING:** Gem Tracking is still in experimental stages and not recommended for production. We have some performance issues when view reports on large applications. Gem tracing also during background thread data collection has HIGH memory requirements, during report merging (seemingly around 128mb of extra memory, which is crazy). We recommend deploying WITHOUT `track_gems` first and only enabling it after confirming that Coverband is working and performing well.
328
-
329
- Gem usage can be tracked by enabling the `track_gems` config.
330
-
331
- ```
332
- Coverband.configure do |config|
333
- config.track_gems = true
334
- end
335
- ```
336
-
337
- The `track_gems` feature exposes a Gems tab in the report which prints out the percentage usage of each Gem. See demo [here](https://coverband-demo.herokuapp.com/coverage?#_Gems).
338
-
339
- When tracking gems, it is important that `Coverband#start` is called before the gems to be tracked are required. The best way to do this is to require coverband before Bundle.require is called. Within rails, require coverband within the application.rb like so:
340
-
341
- ```ruby
342
- require 'coverband'
343
- Bundler.require(*Rails.groups)
344
- ```
345
-
346
- If you are using the resque integration, resque needs to be required before coverband since the integration will not run unless resque is loaded. Within the application.rb just require resque before coverband.
347
-
348
- ```ruby
349
- require 'resque'
350
- require 'coverband'
351
- Bundler.require(*Rails.groups)
352
- ```
353
-
354
- The track_gems config only exposes the overall usage of a gem. In order to see the detail of each file, enable the `gem_details` flag.
355
-
356
- ```
357
- Coverband.configure do |config|
358
- config.track_gems = true
359
- config.gem_details = true
360
- end
361
- ```
362
-
363
- This flag exposes line by line usage of gem files. Unfortunately due to the way the coverband report is currently rendered, enabling `gem_details` slows down viewing of the coverage report in the browser and is not yet recommended.
364
-
365
296
  ### Manually Starting Coverband
366
297
 
367
298
  Coverband starts on require of the the library which is usually done within the Gemfile. This can be disabled by setting the `COVERBAND_DISABLE_AUTO_START` environment variable. This environment variable can be useful to toggle coverband on and off in certain environments.
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bundler/gem_tasks'
4
- import 'test/benchmarks/benchmark.rake'
5
- require 'rubocop/rake_task'
3
+ require "bundler/gem_tasks"
4
+ import "test/benchmarks/benchmark.rake"
5
+ require "rubocop/rake_task"
6
6
 
7
7
  RuboCop::RakeTask.new
8
8
 
@@ -11,40 +11,40 @@ task default: %i[test]
11
11
  task 'test:all': %i[rubocop test forked_tests benchmarks:memory benchmarks]
12
12
 
13
13
  task :test
14
- require 'rake/testtask'
14
+ require "rake/testtask"
15
15
  Rake::TestTask.new(:test) do |test|
16
- test.libs << 'lib' << 'test'
16
+ test.libs << "lib" << "test"
17
17
  # exclude benchmark from the tests as the way it functions resets code coverage during executions
18
18
  # test.pattern = 'test/unit/*_test.rb'
19
19
  # using test files opposed to pattern as it outputs which files are run
20
- test.test_files = FileList['test/integration/**/*_test.rb', 'test/coverband/**/*_test.rb']
20
+ test.test_files = FileList["test/integration/**/*_test.rb", "test/coverband/**/*_test.rb"]
21
21
  test.verbose = true
22
22
  end
23
23
 
24
24
  Rake::TestTask.new(:forked_tests) do |test|
25
- if RUBY_PLATFORM == 'java'
26
- puts 'forked tests not supported on JRuby'
25
+ if RUBY_PLATFORM == "java"
26
+ puts "forked tests not supported on JRuby"
27
27
  else
28
- test.libs << 'lib' << 'test'
29
- test.test_files = FileList['test/forked/**/*_test.rb']
28
+ test.libs << "lib" << "test"
29
+ test.test_files = FileList["test/forked/**/*_test.rb"]
30
30
  test.verbose = true
31
31
  end
32
32
  end
33
33
 
34
- desc 'load irb with this gem'
34
+ desc "load irb with this gem"
35
35
  task :console do
36
- puts 'running console'
37
- exec 'bundle console'
36
+ puts "running console"
37
+ exec "bundle console"
38
38
  end
39
39
 
40
40
  # This is really just for testing and development because without configuration
41
41
  # Coverband can't do much
42
- desc 'start webserver'
42
+ desc "start webserver"
43
43
  task :server do
44
- exec 'rackup -I lib'
44
+ exec "rackup -I lib"
45
45
  end
46
46
 
47
- desc 'publish gem with 2 factor auth, reminder how'
47
+ desc "publish gem with 2 factor auth, reminder how"
48
48
  task :publish_gem do
49
- exec 'gem push pkg/coverband-4.2.3.XXX.gem'
49
+ exec "gem push pkg/coverband-4.2.3.XXX.gem"
50
50
  end
data/changes.md CHANGED
@@ -51,34 +51,27 @@ Will be the fully modern release that drops maintenance legacy support in favor
51
51
  - add gem_details_safe list to report on details on some gems
52
52
  - - display gems that are in loaded with 0 coverage, thanks @kbaum
53
53
 
54
- ### Coverband_jam_session
55
-
56
- This is a possible gem to host experimental or more complex features, which would require tuning, configuration, and performance trade offs. If something is really valuable it could be promoted into the main line.
57
-
58
- Feature Ideas:
59
-
60
- - per request coverage implemented via Ruby 2.6.0 coverage.clear https://bugs.ruby-lang.org/issues/15022
61
- - statsd adapters (it would allow passing in date ranges on usage)
62
- - Possibly add ability to record code run for a given route
63
- - integrate recording with deploy tag or deploy timestamp
64
- - diff code usage across deployed versions
65
- - what methods increased usage or decreased
66
- - ability to change the Coverband config at runtime by changing the config pushed to the Redis hash. In memory cache around the changes to only make that call periodically.
67
- - Opposed to just showing code usage on a route allow 'tagging' events which would record line coverage for that tag (this would allow tagging all code that modified an ActiveRecord model for example
68
- - additional adapters (tracepoint, ruby-profiler, etc)
69
- - tagged coverage reports
70
- - code route tracing (entry point to all code executed for example /some_path -> code coverage of that path)
71
- - deploy git hash tagging of reported Coverage
72
- - allow only to collect coverage based on route (limiting or scoped coverage)
73
- - coverage over some other variable like a set of alpha users
74
- - document how to use this on staging / selenium test suite runs
75
- - possible add API to pull report at end of run
76
-
77
54
  # Alpha / Beta / Release Candidates
78
55
 
79
- ### Coverband 4.2.6
56
+ ### Coverband 5.0.0
57
+
58
+ - Full JRuby support
59
+ - Reduced footprint
60
+ - drops S3 support
61
+ - drops static report support
62
+ - drops gem support
63
+ - ?
64
+
65
+ # Released
66
+
67
+ ###Coverband 4.2.7
80
68
 
81
- - Address Redis `exists` deprecation warning by baffers
69
+ - Ignore patterns too aggressive #382, thanks @thijsnado
70
+ - Stack level too deep error when running certain activejob jobs #367, thanks @kejordan and @hanslauwers
71
+
72
+ ###Coverband 4.2.6
73
+
74
+ - Address Redis exists deprecation warning by baffers
82
75
 
83
76
  ### Coverband 4.2.5
84
77
 
@@ -86,8 +79,6 @@ Feature Ideas:
86
79
  - fix for rails 4.0 by rswaminathan
87
80
  - do not error on branch coverage / simplecov compatibility by desertcart
88
81
 
89
- # Released
90
-
91
82
  ### Coverband 4.2.4
92
83
 
93
84
  - fixes related to startup without Redis, skipping Coverband on common rake tasks (assets:precompile), etc
data/config.ru CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require ::File.expand_path('../lib/coverband', __FILE__)
3
+ require ::File.expand_path("../lib/coverband", __FILE__)
4
4
  run Coverband::Reporters::Web.new
@@ -1,49 +1,44 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path('lib', __dir__)
3
+ lib = File.expand_path("lib", __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'coverband/version'
5
+ require "coverband/version"
6
6
 
7
7
  Gem::Specification.new do |spec|
8
- spec.name = 'coverband'
9
- spec.version = Coverband::VERSION
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)'
14
- spec.homepage = 'https://github.com/danmayer/coverband'
15
- spec.license = 'MIT'
8
+ spec.name = "coverband"
9
+ spec.version = Coverband::VERSION
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)"
14
+ spec.homepage = "https://github.com/danmayer/coverband"
15
+ spec.license = "MIT"
16
16
 
17
- spec.files = `git ls-files`.split("\n").reject { |f| f.start_with?('docs') }
18
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
- spec.require_paths = ['lib']
17
+ spec.files = `git ls-files`.split("\n").reject { |f| f.start_with?("docs") }
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
21
 
22
- # to test support for sdk 1, uncomment this line
23
- # spec.add_development_dependency 'aws-sdk', '~> 1'
24
- # to test sdk 2 use this one
25
- spec.add_development_dependency 'aws-sdk-s3', '~> 1'
26
- spec.add_development_dependency 'benchmark-ips'
27
- spec.add_development_dependency 'capybara'
28
- spec.add_development_dependency 'm'
29
- spec.add_development_dependency 'memory_profiler'
30
- spec.add_development_dependency 'minitest'
31
- spec.add_development_dependency 'minitest-fork_executor'
32
- spec.add_development_dependency 'mocha', '~> 1.7.0'
33
- spec.add_development_dependency 'rack'
34
- spec.add_development_dependency 'rack-test'
35
- spec.add_development_dependency 'rake'
36
- spec.add_development_dependency 'resque'
37
- spec.add_development_dependency 'rubocop'
38
- spec.add_development_dependency 'rubocop-performance'
22
+ spec.add_development_dependency "benchmark-ips"
23
+ spec.add_development_dependency "capybara"
24
+ spec.add_development_dependency "m"
25
+ spec.add_development_dependency "memory_profiler"
26
+ spec.add_development_dependency "minitest"
27
+ spec.add_development_dependency "minitest-fork_executor"
28
+ spec.add_development_dependency "mocha", "~> 1.7.0"
29
+ spec.add_development_dependency "rack"
30
+ spec.add_development_dependency "rack-test"
31
+ spec.add_development_dependency "rake"
32
+ spec.add_development_dependency "resque"
33
+ spec.add_development_dependency "standardrb"
39
34
 
40
- spec.add_development_dependency 'coveralls'
41
- spec.add_development_dependency 'minitest-profile'
35
+ spec.add_development_dependency "coveralls"
36
+ spec.add_development_dependency "minitest-profile"
42
37
 
43
38
  # TODO: Remove when other production adapters exist
44
39
  # because the default configuration of redis store, we really do require
45
40
  # redis now. I was reluctant to add this, but until we offer another production
46
41
  # quality adapter, I think this is more honest about requirements and reduces confusion
47
42
  # without this there was a race condition on calling coverband configure before redis was loaded
48
- spec.add_runtime_dependency 'redis'
43
+ spec.add_runtime_dependency "redis"
49
44
  end
@@ -1,42 +1,31 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'logger'
4
- require 'json'
5
- require 'redis'
6
- require 'coverband/version'
7
- require 'coverband/at_exit'
8
- require 'coverband/configuration'
9
- require 'coverband/utils/relative_file_converter'
10
- require 'coverband/utils/absolute_file_converter'
11
- require 'coverband/adapters/base'
12
- require 'coverband/adapters/redis_store'
13
- require 'coverband/adapters/hash_redis_store'
14
- require 'coverband/adapters/file_store'
15
- require 'coverband/utils/file_hasher'
16
- require 'coverband/utils/s3_report'
17
- require 'coverband/utils/html_formatter'
18
- require 'coverband/utils/result'
19
- require 'coverband/utils/file_list'
20
- require 'coverband/utils/gem_list'
21
- require 'coverband/utils/source_file'
22
- require 'coverband/utils/file_groups'
23
- require 'coverband/utils/lines_classifier'
24
- require 'coverband/utils/results'
25
- require 'coverband/collectors/coverage'
26
- require 'coverband/collectors/view_tracker'
27
- require 'coverband/reporters/base'
28
- require 'coverband/reporters/html_report'
29
- require 'coverband/reporters/console_report'
30
- require 'coverband/reporters/web'
31
- require 'coverband/integrations/background'
32
- require 'coverband/integrations/background_middleware'
33
- require 'coverband/integrations/rack_server_check'
3
+ require "logger"
4
+ require "json"
5
+ require "redis"
6
+ require "coverband/version"
7
+ require "coverband/at_exit"
8
+ require "coverband/configuration"
9
+ require "coverband/utils/relative_file_converter"
10
+ require "coverband/utils/absolute_file_converter"
11
+ require "coverband/adapters/base"
12
+ require "coverband/adapters/redis_store"
13
+ require "coverband/adapters/hash_redis_store"
14
+ require "coverband/adapters/file_store"
15
+ require "coverband/utils/file_hasher"
16
+ require "coverband/collectors/coverage"
17
+ require "coverband/collectors/view_tracker"
18
+ require "coverband/reporters/base"
19
+ require "coverband/reporters/console_report"
20
+ require "coverband/integrations/background"
21
+ require "coverband/integrations/background_middleware"
22
+ require "coverband/integrations/rack_server_check"
34
23
 
35
- Coverband::Adapters::RedisStore = Coverband::Adapters::HashRedisStore if ENV['COVERBAND_HASH_REDIS_STORE']
24
+ Coverband::Adapters::RedisStore = Coverband::Adapters::HashRedisStore if ENV["COVERBAND_HASH_REDIS_STORE"]
36
25
 
37
26
  module Coverband
38
27
  @@configured = false
39
- CONFIG_FILE = './config/coverband.rb'
28
+ CONFIG_FILE = "./config/coverband.rb"
40
29
  RUNTIME_TYPE = :runtime
41
30
  EAGER_TYPE = :eager_loading
42
31
  MERGED_TYPE = :merged
@@ -44,14 +33,14 @@ module Coverband
44
33
  ALL_TYPES = TYPES + [:merged]
45
34
 
46
35
  def self.configure(file = nil)
47
- configuration_file = file || ENV.fetch('COVERBAND_CONFIG', CONFIG_FILE)
36
+ configuration_file = file || ENV.fetch("COVERBAND_CONFIG", CONFIG_FILE)
48
37
  configuration
49
38
  if block_given?
50
39
  yield(configuration)
51
40
  elsif File.exist?(configuration_file)
52
41
  load configuration_file
53
42
  else
54
- configuration.logger.debug('using default configuration')
43
+ configuration.logger.debug("using default configuration")
55
44
  end
56
45
  @@configured = true
57
46
  coverage_instance.reset_instance
@@ -98,19 +87,42 @@ module Coverband
98
87
  private_class_method def self.coverage_instance
99
88
  Coverband::Collectors::Coverage.instance
100
89
  end
101
- unless ENV['COVERBAND_DISABLE_AUTO_START']
90
+ unless ENV["COVERBAND_DISABLE_AUTO_START"]
102
91
  begin
103
- require 'coverband/utils/jruby_ext' if RUBY_PLATFORM == 'java'
104
92
  # Coverband should be setup as early as possible
105
93
  # to capture usage of things loaded by initializers or other Rails engines
106
- configure
107
- start
108
- require 'coverband/utils/railtie' if defined? ::Rails::Railtie
109
- require 'coverband/integrations/resque' if defined? ::Resque
110
- require 'coverband/integrations/bundler' if defined? ::Bundler
94
+ # but after gems are loaded to avoid slowing down gem usage
95
+ # best is in application.rb after the bundler line but we get close with Railtie
96
+ if defined? ::Rails::Railtie
97
+ require "coverband/utils/railtie"
98
+ else
99
+ configure
100
+ start
101
+ end
102
+ require "coverband/integrations/resque" if defined? ::Resque
111
103
  rescue Redis::CannotConnectError => error
112
104
  Coverband.configuration.logger.info "Redis is not available (#{error}), Coverband not configured"
113
- Coverband.configuration.logger.info 'If this is a setup task like assets:precompile feel free to ignore'
105
+ Coverband.configuration.logger.info "If this is a setup task like assets:precompile feel free to ignore"
106
+ end
107
+ end
108
+
109
+ module Reporters
110
+ class Web
111
+ ###
112
+ # NOTE: if the user doesn't setup the webreporter
113
+ # we don't need any of the below files loaded or using memory
114
+ ###
115
+ def initialize
116
+ require "coverband/reporters/web"
117
+ require "coverband/utils/html_formatter"
118
+ require "coverband/utils/result"
119
+ require "coverband/utils/file_list"
120
+ require "coverband/utils/source_file"
121
+ require "coverband/utils/lines_classifier"
122
+ require "coverband/utils/results"
123
+ require "coverband/reporters/html_report"
124
+ init_web
125
+ end
114
126
  end
115
127
  end
116
128
  end