coverband 4.2.7.rc.1 → 5.0.0.rc.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/.standard.yml +26 -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 +30 -28
  10. data/config.ru +1 -1
  11. data/coverband.gemspec +31 -34
  12. data/lib/coverband.rb +68 -44
  13. data/lib/coverband/adapters/base.rb +17 -18
  14. data/lib/coverband/adapters/file_store.rb +38 -6
  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/adapters/stdout_store.rb +41 -0
  18. data/lib/coverband/adapters/web_service_store.rb +155 -0
  19. data/lib/coverband/at_exit.rb +1 -1
  20. data/lib/coverband/collectors/coverage.rb +15 -27
  21. data/lib/coverband/collectors/delta.rb +29 -9
  22. data/lib/coverband/collectors/view_tracker.rb +10 -10
  23. data/lib/coverband/collectors/view_tracker_service.rb +59 -0
  24. data/lib/coverband/configuration.rb +149 -112
  25. data/lib/coverband/integrations/background.rb +6 -6
  26. data/lib/coverband/integrations/rack_server_check.rb +3 -3
  27. data/lib/coverband/integrations/resque.rb +2 -2
  28. data/lib/coverband/reporters/base.rb +11 -12
  29. data/lib/coverband/reporters/console_report.rb +1 -1
  30. data/lib/coverband/reporters/html_report.rb +10 -30
  31. data/lib/coverband/reporters/web.rb +55 -50
  32. data/lib/coverband/utils/absolute_file_converter.rb +6 -6
  33. data/lib/coverband/utils/html_formatter.rb +32 -61
  34. data/lib/coverband/utils/railtie.rb +23 -6
  35. data/lib/coverband/utils/relative_file_converter.rb +2 -2
  36. data/lib/coverband/utils/result.rb +6 -11
  37. data/lib/coverband/utils/results.rb +0 -10
  38. data/lib/coverband/utils/source_file.rb +21 -30
  39. data/lib/coverband/utils/tasks.rb +8 -11
  40. data/lib/coverband/version.rb +1 -1
  41. data/public/application.js +0 -30
  42. data/test/benchmarks/benchmark.rake +97 -92
  43. data/test/benchmarks/dog.rb +1 -1
  44. data/test/benchmarks/init_rails.rake +4 -4
  45. data/test/coverband/adapters/base_test.rb +29 -30
  46. data/test/coverband/adapters/file_store_test.rb +19 -20
  47. data/test/coverband/adapters/hash_redis_store_test.rb +57 -57
  48. data/test/coverband/adapters/redis_store_test.rb +26 -26
  49. data/test/coverband/adapters/web_service_store_test.rb +56 -0
  50. data/test/coverband/at_exit_test.rb +2 -2
  51. data/test/coverband/collectors/coverage_test.rb +33 -47
  52. data/test/coverband/collectors/delta_test.rb +52 -23
  53. data/test/coverband/collectors/view_tracker_test.rb +35 -35
  54. data/test/coverband/configuration_test.rb +49 -36
  55. data/test/coverband/coverband_test.rb +11 -11
  56. data/test/coverband/integrations/background_middleware_test.rb +10 -10
  57. data/test/coverband/integrations/background_test.rb +17 -5
  58. data/test/coverband/integrations/rack_server_check_test.rb +7 -7
  59. data/test/coverband/integrations/report_middleware_test.rb +9 -9
  60. data/test/coverband/integrations/resque_worker_test.rb +9 -9
  61. data/test/coverband/integrations/test_resque_job.rb +1 -1
  62. data/test/coverband/reporters/base_test.rb +9 -9
  63. data/test/coverband/reporters/console_test.rb +6 -6
  64. data/test/coverband/reporters/html_test.rb +36 -48
  65. data/test/coverband/reporters/web_test.rb +16 -18
  66. data/test/coverband/utils/absolute_file_converter_test.rb +22 -22
  67. data/test/coverband/utils/file_hasher_test.rb +6 -12
  68. data/test/coverband/utils/file_list_test.rb +13 -13
  69. data/test/coverband/utils/html_formatter_test.rb +9 -23
  70. data/test/coverband/utils/lines_classifier_test.rb +29 -29
  71. data/test/coverband/utils/relative_file_converter_test.rb +13 -13
  72. data/test/coverband/utils/result_test.rb +18 -18
  73. data/test/coverband/utils/results_test.rb +17 -17
  74. data/test/coverband/utils/source_file_line_test.rb +46 -46
  75. data/test/coverband/utils/source_file_test.rb +38 -88
  76. data/test/dog.rb +1 -1
  77. data/test/fake_app/basic_rack.rb +2 -2
  78. data/test/fixtures/app/controllers/sample_controller.rb +1 -1
  79. data/test/fixtures/app/models/user.rb +1 -1
  80. data/test/fixtures/sample.rb +1 -1
  81. data/test/fixtures/utf-8.rb +0 -2
  82. data/test/forked/rails_full_stack_test.rb +24 -27
  83. data/test/forked/rails_rake_full_stack_test.rb +7 -26
  84. data/test/integration/full_stack_test.rb +11 -22
  85. data/test/jruby_check.rb +2 -3
  86. data/test/rails4_dummy/Rakefile +1 -1
  87. data/test/rails4_dummy/config.ru +1 -1
  88. data/test/rails4_dummy/config/application.rb +4 -4
  89. data/test/rails4_dummy/config/boot.rb +2 -2
  90. data/test/rails4_dummy/config/coverband.rb +1 -1
  91. data/test/rails4_dummy/config/coverband_missing_redis.rb +1 -1
  92. data/test/rails4_dummy/config/environment.rb +1 -1
  93. data/test/rails4_dummy/config/routes.rb +2 -2
  94. data/test/rails5_dummy/Rakefile +1 -1
  95. data/test/rails5_dummy/config.ru +1 -1
  96. data/test/rails5_dummy/config/application.rb +3 -3
  97. data/test/rails5_dummy/config/coverband.rb +8 -8
  98. data/test/rails5_dummy/config/coverband_missing_redis.rb +8 -8
  99. data/test/rails5_dummy/config/environment.rb +1 -1
  100. data/test/rails5_dummy/config/routes.rb +2 -2
  101. data/test/rails6_dummy/Rakefile +1 -1
  102. data/test/rails6_dummy/config.ru +1 -1
  103. data/test/rails6_dummy/config/application.rb +4 -4
  104. data/test/rails6_dummy/config/boot.rb +2 -2
  105. data/test/rails6_dummy/config/coverband.rb +1 -1
  106. data/test/rails6_dummy/config/coverband_missing_redis.rb +1 -1
  107. data/test/rails6_dummy/config/environment.rb +1 -1
  108. data/test/rails6_dummy/config/routes.rb +2 -2
  109. data/test/rails_test_helper.rb +11 -11
  110. data/test/test_helper.rb +44 -34
  111. data/test/unique_files.rb +10 -10
  112. data/views/layout.erb +2 -12
  113. metadata +27 -33
  114. data/.rubocop.yml +0 -84
  115. data/lib/coverband/integrations/bundler.rb +0 -8
  116. data/lib/coverband/utils/file_groups.rb +0 -53
  117. data/lib/coverband/utils/gem_list.rb +0 -31
  118. data/lib/coverband/utils/s3_report.rb +0 -105
  119. data/test/coverband/utils/file_groups_test.rb +0 -61
  120. data/test/coverband/utils/gem_list_test.rb +0 -48
  121. data/test/coverband/utils/s3_report_test.rb +0 -44
  122. data/views/gem_list.erb +0 -63
@@ -3,39 +3,40 @@
3
3
  module Coverband
4
4
  class Configuration
5
5
  attr_accessor :root_paths, :root,
6
- :additional_files, :verbose,
7
- :reporter, :redis_namespace, :redis_ttl,
8
- :background_reporting_enabled,
9
- :background_reporting_sleep_seconds, :test_env,
10
- :web_enable_clear, :gem_details, :web_debug, :report_on_exit,
11
- :simulate_oneshot_lines_coverage, :track_views, :view_tracker,
12
- :reporting_wiggle
13
-
6
+ :verbose,
7
+ :reporter, :redis_namespace, :redis_ttl,
8
+ :background_reporting_enabled,
9
+ :test_env, :web_enable_clear, :gem_details, :web_debug, :report_on_exit,
10
+ :simulate_oneshot_lines_coverage,
11
+ :view_tracker
14
12
  attr_writer :logger, :s3_region, :s3_bucket, :s3_access_key_id,
15
- :s3_secret_access_key, :password
13
+ :s3_secret_access_key, :password, :api_key, :service_url, :coverband_timeout, :service_dev_mode,
14
+ :service_test_mode, :process_type, :track_views, :redis_url,
15
+ :background_reporting_sleep_seconds, :reporting_wiggle
16
+
16
17
  attr_reader :track_gems, :ignore, :use_oneshot_lines_coverage
17
18
 
18
19
  #####
19
20
  # TODO: This is is brittle and not a great solution to avoid deploy time
20
21
  # actions polluting the 'runtime' metrics
21
22
  #
22
- # * should we skip /bin/rails webpacker:compile ?
23
23
  # * Perhaps detect heroku deployment ENV var opposed to tasks?
24
24
  #####
25
- IGNORE_TASKS = ['coverband:clear',
26
- 'coverband:coverage',
27
- 'coverband:coverage_server',
28
- 'coverband:migrate',
29
- 'assets:precompile',
30
- 'db:version',
31
- 'db:create',
32
- 'db:drop',
33
- 'db:seed',
34
- 'db:setup',
35
- 'db:test:prepare',
36
- 'db:structure:dump',
37
- 'db:structure:load',
38
- 'db:version']
25
+ IGNORE_TASKS = ["coverband:clear",
26
+ "coverband:coverage",
27
+ "coverband:coverage_server",
28
+ "coverband:migrate",
29
+ "assets:precompile",
30
+ "webpacker:compile",
31
+ "db:version",
32
+ "db:create",
33
+ "db:drop",
34
+ "db:seed",
35
+ "db:setup",
36
+ "db:test:prepare",
37
+ "db:structure:dump",
38
+ "db:structure:load",
39
+ "db:version"]
39
40
 
40
41
  # Heroku when building assets runs code from a dynamic directory
41
42
  # /tmp was added to avoid coverage from /tmp/build directories during
@@ -55,86 +56,105 @@ module Coverband
55
56
  @root_paths = []
56
57
  @ignore = IGNORE_DEFAULTS.dup
57
58
  @search_paths = TRACKED_DEFAULT_PATHS.dup
58
- @additional_files = []
59
59
  @verbose = false
60
- @reporter = 'scov'
60
+ @reporter = "scov"
61
61
  @logger = nil
62
62
  @store = nil
63
63
  @background_reporting_enabled = true
64
- @background_reporting_sleep_seconds = 30
64
+ @background_reporting_sleep_seconds = nil
65
65
  @test_env = nil
66
66
  @web_enable_clear = false
67
- @track_gems = false
68
- @gem_details = false
69
- @track_views = false
70
- @groups = {}
67
+ @track_views = true
68
+ @view_tracker = nil
71
69
  @web_debug = false
72
70
  @report_on_exit = true
73
- @use_oneshot_lines_coverage = ENV['ONESHOT'] || false
74
- @simulate_oneshot_lines_coverage = ENV['SIMULATE_ONESHOT'] || false
71
+ @use_oneshot_lines_coverage = ENV["ONESHOT"] || false
72
+ @simulate_oneshot_lines_coverage = ENV["SIMULATE_ONESHOT"] || false
75
73
  @current_root = nil
76
74
  @all_root_paths = nil
77
75
  @all_root_patterns = nil
78
76
  @password = nil
79
77
 
80
- # TODO: should we push these to adapter configs
78
+ # coverband service settings
79
+ @api_key = nil
80
+ @service_url = nil
81
+ @coverband_timeout = nil
82
+ @service_dev_mode = nil
83
+ @service_test_mode = nil
84
+ @proces_type = nil
85
+
86
+ @redis_url = nil
87
+ @redis_namespace = nil
88
+ @redis_ttl = 2_592_000 # in seconds. Default is 30 days.
89
+ @reporting_wiggle = nil
90
+
91
+ # TODO: these are deprecated
81
92
  @s3_region = nil
82
93
  @s3_bucket = nil
83
94
  @s3_access_key_id = nil
84
95
  @s3_secret_access_key = nil
85
- @redis_namespace = nil
86
- @redis_ttl = 2_592_000 # in seconds. Default is 30 days.
87
- @reporting_wiggle = nil
96
+ @track_gems = false
97
+ @gem_details = false
88
98
  end
89
99
 
90
100
  def logger
91
101
  @logger ||= if defined?(Rails.logger) && Rails.logger
92
- Rails.logger
93
- else
94
- Logger.new(STDOUT)
95
- end
102
+ Rails.logger
103
+ else
104
+ Logger.new(STDOUT)
105
+ end
96
106
  end
97
107
 
98
108
  def password
99
- @password || ENV['COVERBAND_PASSWORD']
109
+ @password || ENV["COVERBAND_PASSWORD"]
100
110
  end
101
111
 
102
- def s3_bucket
103
- @s3_bucket || ENV['AWS_BUCKET']
112
+ # The adjustments here either protect the redis or service from being overloaded
113
+ # the tradeoff being the delay in when reporting data is available
114
+ # if running your own redis increasing this number reduces load on the redis CPU
115
+ def background_reporting_sleep_seconds
116
+ @background_reporting_sleep_seconds ||= if service?
117
+ # default to 10m for service
118
+ Coverband.configuration.coverband_env == "production" ? 600 : 60
119
+ elsif store.is_a?(Coverband::Adapters::HashRedisStore)
120
+ # Default to 5 minutes if using the hash redis store
121
+ 300
122
+ else
123
+ 60
124
+ end
104
125
  end
105
126
 
106
- def s3_region
107
- @s3_region || ENV['AWS_REGION']
108
- end
109
-
110
- def s3_access_key_id
111
- @s3_access_key_id || ENV['AWS_ACCESS_KEY_ID']
112
- end
113
-
114
- def s3_secret_access_key
115
- @s3_secret_access_key || ENV['AWS_SECRET_ACCESS_KEY']
127
+ def reporting_wiggle
128
+ @reporting_wiggle ||= 30
116
129
  end
117
130
 
118
131
  def store
119
- @store ||= Coverband::Adapters::RedisStore.new(Redis.new(url: redis_url), redis_store_options)
132
+ @store ||= if service?
133
+ raise "invalid configuration: unclear default store coverband expects either api_key or redis_url" if redis_url
134
+ require "coverband/adapters/web_service_store"
135
+ Coverband::Adapters::WebServiceStore.new(service_url)
136
+ else
137
+ Coverband::Adapters::RedisStore.new(Redis.new(url: redis_url), redis_store_options)
138
+ end
120
139
  end
121
140
 
122
141
  def store=(store)
123
- raise 'Pass in an instance of Coverband::Adapters' unless store.is_a?(Coverband::Adapters::Base)
124
-
125
- # Default to 5 minutes if using the hash redis store
126
- # This is a safer default for the high server volumes that need the hash store
127
- # it should avoid overloading the redis with lots of load
128
- @background_reporting_sleep_seconds = 300 if store.is_a?(Coverband::Adapters::HashRedisStore)
142
+ raise "Pass in an instance of Coverband::Adapters" unless store.is_a?(Coverband::Adapters::Base)
143
+ raise "invalid configuration: only coverband service expects an API Key" if api_key && store.class.to_s != "Coverband::Adapters::WebServiceStore"
144
+ raise "invalid configuration: coverband service shouldn't have redis url set" if redis_url && store.class.to_s == "Coverband::Adapters::WebServiceStore"
129
145
 
130
146
  @store = store
131
147
  end
132
148
 
149
+ def track_views
150
+ @track_views ||= service_disabled_dev_test_env? ? false : true
151
+ end
152
+
133
153
  ###
134
154
  # Search Paths
135
155
  ###
136
156
  def tracked_search_paths
137
- "#{Coverband.configuration.current_root}/{#{@search_paths.join(',')}}/**/*.{rb}"
157
+ "#{Coverband.configuration.current_root}/{#{@search_paths.join(",")}}/**/*.{rb}"
138
158
  end
139
159
 
140
160
  ###
@@ -151,45 +171,6 @@ module Coverband
151
171
  @ignore = (@ignore + ignored_array).uniq
152
172
  end
153
173
 
154
- def track_gems=(value)
155
- @track_gems = value
156
- return unless @track_gems
157
-
158
- # by default we ignore vendor where many deployments put gems
159
- # we will remove this default if track_gems is set
160
- @ignore.delete('vendor/')
161
- # while we want to allow vendored gems we don't want to track vendored ruby STDLIB
162
- @ignore << 'vendor/ruby-*' unless @ignore.include?('vendor/ruby-*')
163
- add_group('App', root)
164
- # TODO: rework support for multiple gem paths
165
- # this works but seems hacky and error prone
166
- # basically since it is converted to a regex we join all the paths
167
- # with a regex 'OR' using '|'
168
- add_group('Gems', gem_paths.join('|'))
169
- end
170
-
171
- #
172
- # Returns the configured groups. Add groups using SimpleCov.add_group
173
- #
174
- def groups
175
- @groups ||= {}
176
- end
177
-
178
- #
179
- # Define a group for files. Works similar to add_filter, only that the first
180
- # argument is the desired group name and files PASSING the filter end up in the group
181
- # (while filters exclude when the filter is applicable).
182
- #
183
- def add_group(group_name, filter_argument = nil)
184
- groups[group_name] = filter_argument
185
- end
186
-
187
- def gem_paths
188
- # notes ignore any paths that aren't on this system, resolves
189
- # bug related to multiple ruby version managers / bad dot files
190
- Gem::PathSupport.new(ENV).path.select { |path| File.exist?(path) }
191
- end
192
-
193
174
  def current_root
194
175
  @current_root ||= File.expand_path(Coverband.configuration.root).freeze
195
176
  end
@@ -198,7 +179,6 @@ module Coverband
198
179
  return @all_root_paths if @all_root_paths
199
180
 
200
181
  @all_root_paths = Coverband.configuration.root_paths.dup
201
- @all_root_paths += Coverband.configuration.gem_paths.dup if Coverband.configuration.track_gems
202
182
  @all_root_paths << "#{Coverband.configuration.current_root}/"
203
183
  @all_root_paths
204
184
  end
@@ -207,33 +187,90 @@ module Coverband
207
187
  @all_root_patterns ||= all_root_paths.map { |path| /^#{path}/ }.freeze
208
188
  end
209
189
 
210
- SKIPPED_SETTINGS = %w[@s3_secret_access_key @store]
190
+ SKIPPED_SETTINGS = %w[@s3_secret_access_key @store @api_key @password]
211
191
  def to_h
212
192
  instance_variables
213
- .each_with_object('gem_paths': gem_paths) do |var, hash|
214
- hash[var.to_s.delete('@')] = instance_variable_get(var) unless SKIPPED_SETTINGS.include?(var.to_s)
193
+ .each_with_object({}) do |var, hash|
194
+ hash[var.to_s.delete("@")] = instance_variable_get(var) unless SKIPPED_SETTINGS.include?(var.to_s)
215
195
  end
216
196
  end
217
197
 
218
198
  def use_oneshot_lines_coverage=(value)
219
- raise(Exception, 'One shot line coverage is only available in ruby >= 2.6') unless one_shot_coverage_implemented_in_ruby_version? || !value
199
+ raise(StandardError, "One shot line coverage is only available in ruby >= 2.6") unless one_shot_coverage_implemented_in_ruby_version? || !value
220
200
 
221
201
  @use_oneshot_lines_coverage = value
222
202
  end
223
203
 
224
204
  def one_shot_coverage_implemented_in_ruby_version?
225
- Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.6.0')
205
+ Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.6.0")
226
206
  end
227
207
 
228
- private
229
-
230
208
  def redis_url
231
- ENV['COVERBAND_REDIS_URL'] || ENV['REDIS_URL']
209
+ @redis_url ||= ENV["COVERBAND_REDIS_URL"] || ENV["REDIS_URL"]
210
+ end
211
+
212
+ def api_key
213
+ @api_key ||= ENV["COVERBAND_API_KEY"]
214
+ end
215
+
216
+ def service_url
217
+ @service_url ||= ENV["COVERBAND_URL"] || "https://coverband.io"
218
+ end
219
+
220
+ def coverband_env
221
+ ENV["RACK_ENV"] || ENV["RAILS_ENV"] || (defined?(Rails) && Rails.respond_to?(:env) ? Rails.env : "unknown")
222
+ end
223
+
224
+ def coverband_timeout
225
+ @coverband_timeout ||= coverband_env == "development" ? 5 : 2
226
+ end
227
+
228
+ def service_dev_mode
229
+ @service_dev_mode ||= ENV["COVERBAND_ENABLE_DEV_MODE"] || false
230
+ end
231
+
232
+ def service_test_mode
233
+ @service_dev_mode ||= ENV["COVERBAND_ENABLE_TEST_MODE"] || false
234
+ end
235
+
236
+ def process_type
237
+ @process_type ||= ENV["PROCESS_TYPE"] || "unknown"
238
+ end
239
+
240
+ def service?
241
+ Coverband.coverband_service? || !api_key.nil?
232
242
  end
233
243
 
244
+ def service_disabled_dev_test_env?
245
+ (coverband_env == "test" && !Coverband.configuration.service_test_mode) ||
246
+ (coverband_env == "development" && !Coverband.configuration.service_dev_mode)
247
+ end
248
+
249
+ def s3_bucket
250
+ puts "deprecated, s3 is no longer support"
251
+ end
252
+
253
+ def s3_region
254
+ puts "deprecated, s3 is no longer support"
255
+ end
256
+
257
+ def s3_access_key_id
258
+ puts "deprecated, s3 is no longer support"
259
+ end
260
+
261
+ def s3_secret_access_key
262
+ puts "deprecated, s3 is no longer support"
263
+ end
264
+
265
+ def track_gems=(_value)
266
+ puts "gem tracking is deprecated, setting this will be ignored"
267
+ end
268
+
269
+ private
270
+
234
271
  def redis_store_options
235
- { ttl: Coverband.configuration.redis_ttl,
236
- redis_namespace: Coverband.configuration.redis_namespace }
272
+ {ttl: Coverband.configuration.redis_ttl,
273
+ redis_namespace: Coverband.configuration.redis_namespace}
237
274
  end
238
275
  end
239
276
  end
@@ -27,21 +27,21 @@ module Coverband
27
27
  @semaphore.synchronize do
28
28
  return if running?
29
29
 
30
- logger.debug('Coverband: Starting background reporting') if Coverband.configuration.verbose
31
- sleep_seconds = Coverband.configuration.background_reporting_sleep_seconds
32
- @thread = Thread.new do
30
+ logger.debug("Coverband: Starting background reporting") if Coverband.configuration.verbose
31
+ sleep_seconds = Coverband.configuration.background_reporting_sleep_seconds.to_i
32
+ @thread = Thread.new {
33
33
  loop do
34
34
  Coverband.report_coverage
35
35
  Coverband.configuration.view_tracker&.report_views_tracked
36
36
  if Coverband.configuration.reporting_wiggle
37
- sleep_seconds = Coverband.configuration.background_reporting_sleep_seconds + rand(Coverband.configuration.reporting_wiggle.to_i)
37
+ sleep_seconds = Coverband.configuration.background_reporting_sleep_seconds.to_i + rand(Coverband.configuration.reporting_wiggle.to_i)
38
38
  end
39
39
  if Coverband.configuration.verbose
40
40
  logger.debug("Coverband: background reporting coverage (#{Coverband.configuration.store.type}). Sleeping #{sleep_seconds}s")
41
41
  end
42
- sleep(sleep_seconds)
42
+ sleep(sleep_seconds.to_i)
43
43
  end
44
- end
44
+ }
45
45
  end
46
46
  end
47
47
  end
@@ -15,14 +15,14 @@ module Coverband
15
15
  end
16
16
 
17
17
  def rack_server?
18
- @stack.any? { |line| line.path.include?('lib/rack/') }
18
+ @stack.any? { |line| line.path.include?("lib/rack/") }
19
19
  end
20
20
 
21
21
  def rails_server?
22
22
  @stack.any? do |location|
23
23
  (
24
- location.path.include?('rails/commands/commands_tasks.rb') && location.label == 'server' ||
25
- location.path.include?('rails/commands/server/server_command.rb') && location.label == 'perform'
24
+ location.path.include?("rails/commands/commands_tasks.rb") && location.label == "server" ||
25
+ location.path.include?("rails/commands/server/server_command.rb") && location.label == "perform"
26
26
  )
27
27
  end
28
28
  end
@@ -29,8 +29,8 @@ if defined?(Coverband::COVERBAND_ALTERNATE_PATCH)
29
29
  ensure
30
30
  Coverband.report_coverage
31
31
  end
32
- alias_method perform_without_coverband perform
33
- alias_method perform perform_with_coverband
32
+ alias perform_without_coverband perform
33
+ alias perform perform_with_coverband
34
34
  end
35
35
  else
36
36
  Resque::Job.prepend(Coverband::ResqueWorker)
@@ -8,7 +8,7 @@ module Coverband
8
8
  ###
9
9
  class Base
10
10
  class << self
11
- DATA_KEY = 'data'
11
+ DATA_KEY = "data"
12
12
 
13
13
  def report(store, _options = {})
14
14
  all_roots = Coverband.configuration.all_root_paths
@@ -49,7 +49,7 @@ module Coverband
49
49
  protected
50
50
 
51
51
  def fix_file_names(report_hash, roots)
52
- Coverband.configuration.logger.debug "fixing root: #{roots.join(', ')}" if Coverband.configuration.verbose
52
+ Coverband.configuration.logger.debug "fixing root: #{roots.join(", ")}" if Coverband.configuration.verbose
53
53
 
54
54
  # normalize names across servers
55
55
  report_hash.each_with_object({}) do |(name, report), fixed_report|
@@ -57,12 +57,12 @@ module Coverband
57
57
  report.each_pair do |key, vals|
58
58
  filename = Coverband::Utils::AbsoluteFileConverter.convert(key)
59
59
  fixed_report[name][filename] = if fixed_report[name].key?(filename) && fixed_report[name][filename][DATA_KEY] && vals[DATA_KEY]
60
- merged_data = merge_arrays(fixed_report[name][filename][DATA_KEY], vals[DATA_KEY])
61
- vals[DATA_KEY] = merged_data
62
- vals
63
- else
64
- vals
65
- end
60
+ merged_data = merge_arrays(fixed_report[name][filename][DATA_KEY], vals[DATA_KEY])
61
+ vals[DATA_KEY] = merged_data
62
+ vals
63
+ else
64
+ vals
65
+ end
66
66
  end
67
67
  end
68
68
  end
@@ -75,8 +75,8 @@ module Coverband
75
75
 
76
76
  longest.each_with_index do |_line, index|
77
77
  merged[index] = if first[index] || second[index]
78
- (first[index].to_i + second[index].to_i)
79
- end
78
+ (first[index].to_i + second[index].to_i)
79
+ end
80
80
  end
81
81
 
82
82
  merged
@@ -101,8 +101,7 @@ module Coverband
101
101
  end
102
102
  end
103
103
 
104
- scov_style_report = fix_file_names(scov_style_report, roots)
105
- scov_style_report
104
+ fix_file_names(scov_style_report, roots)
106
105
  end
107
106
  end
108
107
  end