coverband 4.2.6 → 5.0.0.rc.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.standard.yml +26 -0
- data/.travis.yml +2 -1
- data/Gemfile +5 -7
- data/Gemfile.rails4 +0 -3
- data/Gemfile.rails6 +0 -3
- data/README.md +24 -77
- data/Rakefile +17 -17
- data/changes.md +30 -28
- data/config.ru +1 -1
- data/coverband.gemspec +31 -34
- data/lib/alternative_coverband_patch.rb +5 -0
- data/lib/coverband.rb +68 -44
- data/lib/coverband/adapters/base.rb +17 -18
- data/lib/coverband/adapters/file_store.rb +38 -6
- data/lib/coverband/adapters/hash_redis_store.rb +24 -21
- data/lib/coverband/adapters/redis_store.rb +12 -12
- data/lib/coverband/adapters/stdout_store.rb +41 -0
- data/lib/coverband/adapters/web_service_store.rb +155 -0
- data/lib/coverband/at_exit.rb +1 -1
- data/lib/coverband/collectors/coverage.rb +15 -27
- data/lib/coverband/collectors/delta.rb +29 -9
- data/lib/coverband/collectors/view_tracker.rb +10 -10
- data/lib/coverband/collectors/view_tracker_service.rb +59 -0
- data/lib/coverband/configuration.rb +150 -113
- data/lib/coverband/integrations/background.rb +6 -6
- data/lib/coverband/integrations/rack_server_check.rb +3 -3
- data/lib/coverband/integrations/resque.rb +13 -1
- data/lib/coverband/reporters/base.rb +11 -12
- data/lib/coverband/reporters/console_report.rb +1 -1
- data/lib/coverband/reporters/html_report.rb +10 -30
- data/lib/coverband/reporters/web.rb +55 -50
- data/lib/coverband/utils/absolute_file_converter.rb +6 -6
- data/lib/coverband/utils/html_formatter.rb +32 -61
- data/lib/coverband/utils/railtie.rb +23 -6
- data/lib/coverband/utils/relative_file_converter.rb +2 -2
- data/lib/coverband/utils/result.rb +6 -11
- data/lib/coverband/utils/results.rb +0 -10
- data/lib/coverband/utils/source_file.rb +21 -30
- data/lib/coverband/utils/tasks.rb +8 -11
- data/lib/coverband/version.rb +1 -1
- data/public/application.js +0 -30
- data/test/benchmarks/benchmark.rake +97 -92
- data/test/benchmarks/dog.rb +1 -1
- data/test/benchmarks/init_rails.rake +4 -4
- data/test/coverband/adapters/base_test.rb +29 -30
- data/test/coverband/adapters/file_store_test.rb +19 -20
- data/test/coverband/adapters/hash_redis_store_test.rb +57 -57
- data/test/coverband/adapters/redis_store_test.rb +26 -26
- data/test/coverband/adapters/web_service_store_test.rb +56 -0
- data/test/coverband/at_exit_test.rb +2 -2
- data/test/coverband/collectors/coverage_test.rb +33 -47
- data/test/coverband/collectors/delta_test.rb +52 -23
- data/test/coverband/collectors/view_tracker_test.rb +35 -35
- data/test/coverband/configuration_test.rb +61 -48
- data/test/coverband/coverband_test.rb +11 -11
- data/test/coverband/integrations/background_middleware_test.rb +10 -10
- data/test/coverband/integrations/background_test.rb +17 -5
- data/test/coverband/integrations/rack_server_check_test.rb +7 -7
- data/test/coverband/integrations/report_middleware_test.rb +9 -9
- data/test/coverband/integrations/resque_worker_test.rb +9 -9
- data/test/coverband/integrations/test_resque_job.rb +1 -1
- data/test/coverband/reporters/base_test.rb +9 -9
- data/test/coverband/reporters/console_test.rb +6 -6
- data/test/coverband/reporters/html_test.rb +36 -48
- data/test/coverband/reporters/web_test.rb +16 -18
- data/test/coverband/utils/absolute_file_converter_test.rb +22 -22
- data/test/coverband/utils/file_hasher_test.rb +6 -12
- data/test/coverband/utils/file_list_test.rb +13 -13
- data/test/coverband/utils/html_formatter_test.rb +9 -23
- data/test/coverband/utils/lines_classifier_test.rb +29 -29
- data/test/coverband/utils/relative_file_converter_test.rb +13 -13
- data/test/coverband/utils/result_test.rb +18 -18
- data/test/coverband/utils/results_test.rb +17 -17
- data/test/coverband/utils/source_file_line_test.rb +46 -46
- data/test/coverband/utils/source_file_test.rb +38 -88
- data/test/dog.rb +1 -1
- data/test/fake_app/basic_rack.rb +2 -2
- data/test/fixtures/app/controllers/sample_controller.rb +1 -1
- data/test/fixtures/app/models/user.rb +1 -1
- data/test/fixtures/sample.rb +1 -1
- data/test/fixtures/utf-8.rb +0 -2
- data/test/forked/rails_full_stack_test.rb +24 -27
- data/test/forked/rails_rake_full_stack_test.rb +7 -26
- data/test/integration/full_stack_test.rb +11 -22
- data/test/jruby_check.rb +2 -3
- data/test/rails4_dummy/Rakefile +1 -1
- data/test/rails4_dummy/config.ru +1 -1
- data/test/rails4_dummy/config/application.rb +4 -4
- data/test/rails4_dummy/config/boot.rb +2 -2
- data/test/rails4_dummy/config/coverband.rb +1 -1
- data/test/rails4_dummy/config/coverband_missing_redis.rb +1 -1
- data/test/rails4_dummy/config/environment.rb +1 -1
- data/test/rails4_dummy/config/routes.rb +2 -2
- data/test/rails5_dummy/Rakefile +1 -1
- data/test/rails5_dummy/config.ru +1 -1
- data/test/rails5_dummy/config/application.rb +3 -3
- data/test/rails5_dummy/config/coverband.rb +8 -8
- data/test/rails5_dummy/config/coverband_missing_redis.rb +8 -8
- data/test/rails5_dummy/config/environment.rb +1 -1
- data/test/rails5_dummy/config/routes.rb +2 -2
- data/test/rails6_dummy/Rakefile +1 -1
- data/test/rails6_dummy/config.ru +1 -1
- data/test/rails6_dummy/config/application.rb +4 -4
- data/test/rails6_dummy/config/boot.rb +2 -2
- data/test/rails6_dummy/config/coverband.rb +1 -1
- data/test/rails6_dummy/config/coverband_missing_redis.rb +1 -1
- data/test/rails6_dummy/config/environment.rb +1 -1
- data/test/rails6_dummy/config/routes.rb +2 -2
- data/test/rails_test_helper.rb +11 -11
- data/test/test_helper.rb +44 -34
- data/test/unique_files.rb +10 -10
- data/views/layout.erb +2 -12
- metadata +29 -34
- data/.rubocop.yml +0 -84
- data/lib/coverband/integrations/bundler.rb +0 -8
- data/lib/coverband/utils/file_groups.rb +0 -53
- data/lib/coverband/utils/gem_list.rb +0 -31
- data/lib/coverband/utils/s3_report.rb +0 -105
- data/test/coverband/utils/file_groups_test.rb +0 -61
- data/test/coverband/utils/gem_list_test.rb +0 -48
- data/test/coverband/utils/s3_report_test.rb +0 -44
- data/views/gem_list.erb +0 -63
data/test/unique_files.rb
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
3
|
+
require "securerandom"
|
4
|
+
require "fileutils"
|
5
|
+
require "erb"
|
6
|
+
require "ostruct"
|
7
7
|
|
8
|
-
UNIQUE_FILES_DIR =
|
8
|
+
UNIQUE_FILES_DIR = "./test/unique_files"
|
9
9
|
|
10
|
-
def require_unique_file(file =
|
10
|
+
def require_unique_file(file = "dog.rb", variables = {})
|
11
11
|
uuid = SecureRandom.uuid
|
12
12
|
dir = "#{UNIQUE_FILES_DIR}/#{uuid}"
|
13
|
-
file_name = file.sub(
|
13
|
+
file_name = file.sub(".erb", "")
|
14
14
|
temp_file = "#{dir}/#{file_name}"
|
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,
|
18
|
+
File.open(temp_file, "w") { |w| w.write(file_contents) }
|
19
19
|
require temp_file
|
20
20
|
Coverband::Utils::RelativeFileConverter.convert(File.expand_path(temp_file))
|
21
21
|
end
|
22
22
|
|
23
23
|
@@dogs = 0
|
24
24
|
def require_class_unique_file
|
25
|
-
@@dogs +=1
|
26
|
-
require_unique_file(
|
25
|
+
@@dogs += 1
|
26
|
+
require_unique_file("dog.rb.erb", dog_number: @@dogs)
|
27
27
|
end
|
28
28
|
|
29
29
|
def remove_unique_files
|
data/views/layout.erb
CHANGED
@@ -18,11 +18,7 @@
|
|
18
18
|
<%= display_nav %>
|
19
19
|
|
20
20
|
<div id="content">
|
21
|
-
<%= formatted_file_list("
|
22
|
-
|
23
|
-
<% result.groups.each do |name, files| %>
|
24
|
-
<%= formatted_file_list(name, result, files) %>
|
25
|
-
<% end %>
|
21
|
+
<%= formatted_file_list("Coverage", result, result.source_files) %>
|
26
22
|
</div>
|
27
23
|
|
28
24
|
<div id="footer">
|
@@ -31,13 +27,7 @@
|
|
31
27
|
|
32
28
|
<div class="source_files">
|
33
29
|
<% result.source_files.each do |source_file| %>
|
34
|
-
|
35
|
-
<% if static_html? %>
|
36
|
-
<%= formatted_source_file(result, source_file) %>
|
37
|
-
<% else %>
|
38
|
-
<%= formatted_source_file_loader(result, source_file) %>
|
39
|
-
<% end %>
|
40
|
-
<% end %>
|
30
|
+
<%= formatted_source_file_loader(result, source_file) %>
|
41
31
|
<% end %>
|
42
32
|
</div>
|
43
33
|
</div>
|
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:
|
4
|
+
version: 5.0.0.rc.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Mayer
|
@@ -9,22 +9,8 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-08-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: aws-sdk-s3
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - "~>"
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '1'
|
21
|
-
type: :development
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - "~>"
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: '1'
|
28
14
|
- !ruby/object:Gem::Dependency
|
29
15
|
name: benchmark-ips
|
30
16
|
requirement: !ruby/object:Gem::Requirement
|
@@ -180,7 +166,21 @@ dependencies:
|
|
180
166
|
- !ruby/object:Gem::Version
|
181
167
|
version: '0'
|
182
168
|
- !ruby/object:Gem::Dependency
|
183
|
-
name:
|
169
|
+
name: standard
|
170
|
+
requirement: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - '='
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: 0.2.5
|
175
|
+
type: :development
|
176
|
+
prerelease: false
|
177
|
+
version_requirements: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - '='
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: 0.2.5
|
182
|
+
- !ruby/object:Gem::Dependency
|
183
|
+
name: standardrb
|
184
184
|
requirement: !ruby/object:Gem::Requirement
|
185
185
|
requirements:
|
186
186
|
- - ">="
|
@@ -194,7 +194,7 @@ dependencies:
|
|
194
194
|
- !ruby/object:Gem::Version
|
195
195
|
version: '0'
|
196
196
|
- !ruby/object:Gem::Dependency
|
197
|
-
name:
|
197
|
+
name: coveralls
|
198
198
|
requirement: !ruby/object:Gem::Requirement
|
199
199
|
requirements:
|
200
200
|
- - ">="
|
@@ -208,7 +208,7 @@ dependencies:
|
|
208
208
|
- !ruby/object:Gem::Version
|
209
209
|
version: '0'
|
210
210
|
- !ruby/object:Gem::Dependency
|
211
|
-
name:
|
211
|
+
name: minitest-profile
|
212
212
|
requirement: !ruby/object:Gem::Requirement
|
213
213
|
requirements:
|
214
214
|
- - ">="
|
@@ -222,7 +222,7 @@ dependencies:
|
|
222
222
|
- !ruby/object:Gem::Version
|
223
223
|
version: '0'
|
224
224
|
- !ruby/object:Gem::Dependency
|
225
|
-
name:
|
225
|
+
name: webmock
|
226
226
|
requirement: !ruby/object:Gem::Requirement
|
227
227
|
requirements:
|
228
228
|
- - ">="
|
@@ -258,7 +258,7 @@ extra_rdoc_files: []
|
|
258
258
|
files:
|
259
259
|
- ".gitignore"
|
260
260
|
- ".jrubyrc"
|
261
|
-
- ".
|
261
|
+
- ".standard.yml"
|
262
262
|
- ".travis.yml"
|
263
263
|
- CODE_OF_CONDUCT.md
|
264
264
|
- Gemfile
|
@@ -271,19 +271,22 @@ files:
|
|
271
271
|
- changes.md
|
272
272
|
- config.ru
|
273
273
|
- coverband.gemspec
|
274
|
+
- lib/alternative_coverband_patch.rb
|
274
275
|
- lib/coverband.rb
|
275
276
|
- lib/coverband/adapters/base.rb
|
276
277
|
- lib/coverband/adapters/file_store.rb
|
277
278
|
- lib/coverband/adapters/hash_redis_store.rb
|
278
279
|
- lib/coverband/adapters/redis_store.rb
|
280
|
+
- lib/coverband/adapters/stdout_store.rb
|
281
|
+
- lib/coverband/adapters/web_service_store.rb
|
279
282
|
- lib/coverband/at_exit.rb
|
280
283
|
- lib/coverband/collectors/coverage.rb
|
281
284
|
- lib/coverband/collectors/delta.rb
|
282
285
|
- lib/coverband/collectors/view_tracker.rb
|
286
|
+
- lib/coverband/collectors/view_tracker_service.rb
|
283
287
|
- lib/coverband/configuration.rb
|
284
288
|
- lib/coverband/integrations/background.rb
|
285
289
|
- lib/coverband/integrations/background_middleware.rb
|
286
|
-
- lib/coverband/integrations/bundler.rb
|
287
290
|
- lib/coverband/integrations/rack_server_check.rb
|
288
291
|
- lib/coverband/integrations/report_middleware.rb
|
289
292
|
- lib/coverband/integrations/resque.rb
|
@@ -292,10 +295,8 @@ files:
|
|
292
295
|
- lib/coverband/reporters/html_report.rb
|
293
296
|
- lib/coverband/reporters/web.rb
|
294
297
|
- lib/coverband/utils/absolute_file_converter.rb
|
295
|
-
- lib/coverband/utils/file_groups.rb
|
296
298
|
- lib/coverband/utils/file_hasher.rb
|
297
299
|
- lib/coverband/utils/file_list.rb
|
298
|
-
- lib/coverband/utils/gem_list.rb
|
299
300
|
- lib/coverband/utils/html_formatter.rb
|
300
301
|
- lib/coverband/utils/jruby_ext.rb
|
301
302
|
- lib/coverband/utils/lines_classifier.rb
|
@@ -303,7 +304,6 @@ files:
|
|
303
304
|
- lib/coverband/utils/relative_file_converter.rb
|
304
305
|
- lib/coverband/utils/result.rb
|
305
306
|
- lib/coverband/utils/results.rb
|
306
|
-
- lib/coverband/utils/s3_report.rb
|
307
307
|
- lib/coverband/utils/source_file.rb
|
308
308
|
- lib/coverband/utils/tasks.rb
|
309
309
|
- lib/coverband/version.rb
|
@@ -350,6 +350,7 @@ files:
|
|
350
350
|
- test/coverband/adapters/file_store_test.rb
|
351
351
|
- test/coverband/adapters/hash_redis_store_test.rb
|
352
352
|
- test/coverband/adapters/redis_store_test.rb
|
353
|
+
- test/coverband/adapters/web_service_store_test.rb
|
353
354
|
- test/coverband/at_exit_test.rb
|
354
355
|
- test/coverband/collectors/coverage_test.rb
|
355
356
|
- test/coverband/collectors/delta_test.rb
|
@@ -367,16 +368,13 @@ files:
|
|
367
368
|
- test/coverband/reporters/html_test.rb
|
368
369
|
- test/coverband/reporters/web_test.rb
|
369
370
|
- test/coverband/utils/absolute_file_converter_test.rb
|
370
|
-
- test/coverband/utils/file_groups_test.rb
|
371
371
|
- test/coverband/utils/file_hasher_test.rb
|
372
372
|
- test/coverband/utils/file_list_test.rb
|
373
|
-
- test/coverband/utils/gem_list_test.rb
|
374
373
|
- test/coverband/utils/html_formatter_test.rb
|
375
374
|
- test/coverband/utils/lines_classifier_test.rb
|
376
375
|
- test/coverband/utils/relative_file_converter_test.rb
|
377
376
|
- test/coverband/utils/result_test.rb
|
378
377
|
- test/coverband/utils/results_test.rb
|
379
|
-
- test/coverband/utils/s3_report_test.rb
|
380
378
|
- test/coverband/utils/source_file_line_test.rb
|
381
379
|
- test/coverband/utils/source_file_test.rb
|
382
380
|
- test/dog.rb
|
@@ -429,7 +427,6 @@ files:
|
|
429
427
|
- test/unique_files.rb
|
430
428
|
- views/data.erb
|
431
429
|
- views/file_list.erb
|
432
|
-
- views/gem_list.erb
|
433
430
|
- views/layout.erb
|
434
431
|
- views/nav.erb
|
435
432
|
- views/settings.erb
|
@@ -451,9 +448,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
451
448
|
version: '0'
|
452
449
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
453
450
|
requirements:
|
454
|
-
- - "
|
451
|
+
- - ">"
|
455
452
|
- !ruby/object:Gem::Version
|
456
|
-
version:
|
453
|
+
version: 1.3.1
|
457
454
|
requirements: []
|
458
455
|
rubygems_version: 3.0.3
|
459
456
|
signing_key:
|
@@ -471,6 +468,7 @@ test_files:
|
|
471
468
|
- test/coverband/adapters/file_store_test.rb
|
472
469
|
- test/coverband/adapters/hash_redis_store_test.rb
|
473
470
|
- test/coverband/adapters/redis_store_test.rb
|
471
|
+
- test/coverband/adapters/web_service_store_test.rb
|
474
472
|
- test/coverband/at_exit_test.rb
|
475
473
|
- test/coverband/collectors/coverage_test.rb
|
476
474
|
- test/coverband/collectors/delta_test.rb
|
@@ -488,16 +486,13 @@ test_files:
|
|
488
486
|
- test/coverband/reporters/html_test.rb
|
489
487
|
- test/coverband/reporters/web_test.rb
|
490
488
|
- test/coverband/utils/absolute_file_converter_test.rb
|
491
|
-
- test/coverband/utils/file_groups_test.rb
|
492
489
|
- test/coverband/utils/file_hasher_test.rb
|
493
490
|
- test/coverband/utils/file_list_test.rb
|
494
|
-
- test/coverband/utils/gem_list_test.rb
|
495
491
|
- test/coverband/utils/html_formatter_test.rb
|
496
492
|
- test/coverband/utils/lines_classifier_test.rb
|
497
493
|
- test/coverband/utils/relative_file_converter_test.rb
|
498
494
|
- test/coverband/utils/result_test.rb
|
499
495
|
- test/coverband/utils/results_test.rb
|
500
|
-
- test/coverband/utils/s3_report_test.rb
|
501
496
|
- test/coverband/utils/source_file_line_test.rb
|
502
497
|
- test/coverband/utils/source_file_test.rb
|
503
498
|
- test/dog.rb
|
data/.rubocop.yml
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
TargetRubyVersion: 2.4
|
3
|
-
Exclude:
|
4
|
-
- vendor/bundle/**/*
|
5
|
-
- docs/**/*
|
6
|
-
- test/rails6_dummy/**/*
|
7
|
-
- test/rails5_dummy/**/*
|
8
|
-
- test/fixtures/**/*
|
9
|
-
# Get the code passing first then we will enable for tests
|
10
|
-
- test/**/*
|
11
|
-
Documentation:
|
12
|
-
Enabled: false
|
13
|
-
Metrics/MethodLength:
|
14
|
-
Enabled: false
|
15
|
-
Layout/LineLength:
|
16
|
-
Max: 160
|
17
|
-
Metrics/BlockNesting:
|
18
|
-
Max: 5
|
19
|
-
Metrics/BlockLength:
|
20
|
-
Max: 30
|
21
|
-
Metrics/CyclomaticComplexity:
|
22
|
-
Enabled: false
|
23
|
-
Metrics/PerceivedComplexity:
|
24
|
-
Enabled: false
|
25
|
-
Metrics/AbcSize:
|
26
|
-
Enabled: false
|
27
|
-
Metrics/ClassLength:
|
28
|
-
Enabled: false
|
29
|
-
Metrics/ModuleLength:
|
30
|
-
Enabled: false
|
31
|
-
Metrics/ParameterLists:
|
32
|
-
Max: 10
|
33
|
-
Naming/AccessorMethodName:
|
34
|
-
Enabled: false
|
35
|
-
Naming/RescuedExceptionsVariableName:
|
36
|
-
Enabled: false
|
37
|
-
Naming/PredicateName:
|
38
|
-
Enabled: true
|
39
|
-
Style/TernaryParentheses:
|
40
|
-
Enabled: false
|
41
|
-
Style/MutableConstant:
|
42
|
-
Enabled: false
|
43
|
-
Style/IdenticalConditionalBranches:
|
44
|
-
Enabled: false
|
45
|
-
Style/ClassVars:
|
46
|
-
Enabled: false
|
47
|
-
Style/MultilineBlockChain:
|
48
|
-
Enabled: false
|
49
|
-
Style/StringLiterals:
|
50
|
-
Enabled: false
|
51
|
-
Style/IfInsideElse:
|
52
|
-
Enabled: false
|
53
|
-
Style/FrozenStringLiteralComment:
|
54
|
-
Enabled: true
|
55
|
-
Style/GuardClause:
|
56
|
-
Enabled: true
|
57
|
-
Style/NumericPredicate:
|
58
|
-
Enabled: true
|
59
|
-
Style/NumericLiterals:
|
60
|
-
Enabled: false
|
61
|
-
Style/NumericLiteralPrefix:
|
62
|
-
Enabled: false
|
63
|
-
Style/ClassAndModuleChildren:
|
64
|
-
Enabled: false
|
65
|
-
Style/SymbolArray:
|
66
|
-
Enabled: false
|
67
|
-
Style/SymbolProc:
|
68
|
-
Enabled: false
|
69
|
-
Style/RegexpLiteral:
|
70
|
-
Enabled: false
|
71
|
-
Layout/MultilineMethodCallIndentation:
|
72
|
-
Enabled: true
|
73
|
-
Layout/MultilineOperationIndentation:
|
74
|
-
Enabled: true
|
75
|
-
Lint/RescueException:
|
76
|
-
Enabled: true
|
77
|
-
Lint/UselessAccessModifier:
|
78
|
-
Enabled: true
|
79
|
-
Lint/ShadowingOuterLocalVariable:
|
80
|
-
Enabled: true
|
81
|
-
Style/FormatString:
|
82
|
-
Enabled: true
|
83
|
-
Security/Eval:
|
84
|
-
Enabled: true
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
#
|
4
|
-
# Applies the configured groups to the given array of Coverband::SourceFile items
|
5
|
-
#
|
6
|
-
module Coverband
|
7
|
-
module Utils
|
8
|
-
class FileGroups
|
9
|
-
def initialize(files)
|
10
|
-
@grouped = {}
|
11
|
-
@files = files
|
12
|
-
filter_to_groups
|
13
|
-
end
|
14
|
-
|
15
|
-
def grouped_results
|
16
|
-
@grouped
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def filter_to_groups
|
22
|
-
grouped_files = []
|
23
|
-
Coverband.configuration.groups.each do |name, filter|
|
24
|
-
if name == 'Gems'
|
25
|
-
gem_lists = gem_files(name, filter)
|
26
|
-
grouped_files.concat(gem_lists.flatten) if gem_lists.flatten.any?
|
27
|
-
else
|
28
|
-
app_files(name, filter)
|
29
|
-
grouped_files += @grouped[name]
|
30
|
-
end
|
31
|
-
end
|
32
|
-
if !Coverband.configuration.groups.empty? && !(other_files = @files.reject do |source_file|
|
33
|
-
grouped_files.include?(source_file)
|
34
|
-
end).empty?
|
35
|
-
@grouped['Ungrouped'] = Coverband::Utils::FileList.new(other_files)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def gem_files(name, filter)
|
40
|
-
grouped_gems = @files.select { |source_file| source_file.filename =~ /#{filter}/ }.group_by(&:gem_name)
|
41
|
-
gem_lists = grouped_gems.values.map { |gem_files| Coverband::Utils::FileList.new(gem_files) }
|
42
|
-
@grouped[name] = Coverband::Utils::GemList.new(gem_lists) if gem_lists.flatten.any?
|
43
|
-
gem_lists
|
44
|
-
end
|
45
|
-
|
46
|
-
def app_files(name, filter)
|
47
|
-
@grouped[name] = Coverband::Utils::FileList.new(@files.select do |source_file|
|
48
|
-
source_file.filename =~ /#{filter}/ && source_file.filename !~ /#{Coverband.configuration.gem_paths.first}/
|
49
|
-
end)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
####
|
4
|
-
# An array of FileLists instances with helpers to roll up the stats
|
5
|
-
# methods for calculating coverage across them etc.
|
6
|
-
####
|
7
|
-
module Coverband
|
8
|
-
module Utils
|
9
|
-
class GemList < FileList
|
10
|
-
# Returns the count of lines that have coverage
|
11
|
-
def covered_lines
|
12
|
-
to_a.map(&:covered_lines).inject(:+)
|
13
|
-
end
|
14
|
-
|
15
|
-
# Returns the count of lines that have been missed
|
16
|
-
def missed_lines
|
17
|
-
to_a.map(&:missed_lines).inject(:+)
|
18
|
-
end
|
19
|
-
|
20
|
-
# Returns the count of lines that are not relevant for coverage
|
21
|
-
def never_lines
|
22
|
-
to_a.map(&:never_lines).inject(:+)
|
23
|
-
end
|
24
|
-
|
25
|
-
# Returns the count of skipped lines
|
26
|
-
def skipped_lines
|
27
|
-
to_a.map(&:skipped_lines).inject(:+)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,105 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Coverband
|
4
|
-
module Utils
|
5
|
-
###
|
6
|
-
# TODO: this is currently a html report writer
|
7
|
-
# this should support writing coverage the current method should be fine
|
8
|
-
# to write every report to S3 and sum them later or use the 2 pass
|
9
|
-
# method we do for redis if in a background thread
|
10
|
-
###
|
11
|
-
class S3Report
|
12
|
-
def self.instance
|
13
|
-
s3_options = {
|
14
|
-
region: Coverband.configuration.s3_region,
|
15
|
-
access_key_id: Coverband.configuration.s3_access_key_id,
|
16
|
-
secret_access_key: Coverband.configuration.s3_secret_access_key
|
17
|
-
}
|
18
|
-
new(Coverband.configuration.s3_bucket, s3_options)
|
19
|
-
end
|
20
|
-
|
21
|
-
def initialize(bucket_name, options = {})
|
22
|
-
@bucket_name = bucket_name
|
23
|
-
@region = options[:region]
|
24
|
-
@access_key_id = options[:access_key_id]
|
25
|
-
@secret_access_key = options[:secret_access_key]
|
26
|
-
begin
|
27
|
-
require 'aws-sdk-s3'
|
28
|
-
rescue StandardError
|
29
|
-
err_msg = 'Coverband requires aws-sdk in order use S3Report.'
|
30
|
-
Coverband.configuration.logger&.error err_msg
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def persist!
|
35
|
-
if defined?(Aws)
|
36
|
-
object.put(body: coverage_content)
|
37
|
-
else
|
38
|
-
object.write(coverage_content)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def retrieve
|
43
|
-
if defined?(Aws)
|
44
|
-
s3_client.get_object(bucket: Coverband.configuration.s3_bucket,
|
45
|
-
key: 'coverband/index.html').body.read
|
46
|
-
else
|
47
|
-
object.read
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
private
|
52
|
-
|
53
|
-
def coverage_content
|
54
|
-
version = Coverband::VERSION
|
55
|
-
File.read("#{Coverband.configuration.root}/coverage/index.html").gsub("./assets/#{version}/", '')
|
56
|
-
end
|
57
|
-
|
58
|
-
def object
|
59
|
-
if defined?(Aws)
|
60
|
-
bucket.object('coverband/index.html')
|
61
|
-
else
|
62
|
-
bucket.objects['coverband/index.html']
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def client_options
|
67
|
-
{
|
68
|
-
region: @region,
|
69
|
-
access_key_id: @access_key_id,
|
70
|
-
secret_access_key: @secret_access_key
|
71
|
-
}
|
72
|
-
end
|
73
|
-
|
74
|
-
def s3_client
|
75
|
-
if defined?(Aws)
|
76
|
-
# AWS SDK v2
|
77
|
-
Aws::S3::Client.new(client_options)
|
78
|
-
else
|
79
|
-
# AWS SDK v1
|
80
|
-
AWS::S3::Client.new(client_options)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
def s3
|
85
|
-
resource_options = { client: s3_client }
|
86
|
-
resource_options = {} if client_options.values.any?(&:nil?)
|
87
|
-
if defined?(Aws)
|
88
|
-
# AWS SDK v2
|
89
|
-
Aws::S3::Resource.new(resource_options)
|
90
|
-
else
|
91
|
-
# AWS SDK v1
|
92
|
-
AWS::S3.new(resource_options)
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
def bucket
|
97
|
-
if defined?(Aws)
|
98
|
-
s3.bucket(@bucket_name)
|
99
|
-
else
|
100
|
-
s3.buckets[@bucket_name]
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|