Skip to content

Commit 3eff8b7

Browse files
committed
minor refactor
1 parent 03d1180 commit 3eff8b7

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ tmp
2626
## PROJECT::SPECIFIC
2727

2828
.yardoc
29+
.ruby-version
2930
spec/fixtures/coverage
3031
spec/fixtures/frameworks/coverage
3132
test_projects/**/coverage

lib/simplecov/combine/files_combiner.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@ module FilesCombiner
1414
#
1515
# @return [Hash]
1616
#
17-
def combine(coverage_a, coverage_b)
17+
def combine(cov_a, cov_b)
1818
combination = {}
19-
combination[:lines] = Combine.combine(LinesCombiner, coverage_a[:lines], coverage_b[:lines])
19+
combination[:lines] = Combine.combine(LinesCombiner, cov_a[:lines], cov_b[:lines])
2020

21-
if SimpleCov.branch_coverage?
22-
combination[:branches] = Combine.combine(BranchesCombiner, coverage_a[:branches], coverage_b[:branches])
23-
combination[:methods] = Combine.combine(MethodsCombiner, coverage_a[:methods], coverage_b[:methods])
21+
if SimpleCov.branch_coverage? # rubocop:disable Style/IfUnlessModifier
22+
combination[:branches] = Combine.combine(BranchesCombiner, cov_a[:branches], cov_b[:branches])
23+
end
24+
25+
if SimpleCov.method_coverage? # rubocop:disable Style/IfUnlessModifier
26+
combination[:methods] = Combine.combine(MethodsCombiner, cov_a[:methods], cov_b[:methods])
2427
end
2528

2629
combination

lib/simplecov/configuration.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,7 @@ def method_coverage?
409409
end
410410

411411
def coverage_start_arguments_supported?
412-
# safe to cache as within one process this value should never
413-
# change
412+
# safe to cache as within one process this value should never change
414413
return @coverage_start_arguments_supported if defined?(@coverage_start_arguments_supported)
415414

416415
@coverage_start_arguments_supported = begin
@@ -426,19 +425,16 @@ def coverage_start_arguments_supported?
426425

427426
def raise_if_criterion_disabled(criterion)
428427
raise_if_criterion_unsupported(criterion)
429-
# rubocop:disable Style/IfUnlessModifier
430-
unless coverage_criterion_enabled?(criterion)
428+
429+
unless coverage_criterion_enabled?(criterion) # rubocop:disable Style/IfUnlessModifier
431430
raise "Coverage criterion #{criterion} is disabled! Please enable it first through enable_coverage #{criterion} (if supported)"
432431
end
433-
# rubocop:enable Style/IfUnlessModifier
434432
end
435433

436434
def raise_if_criterion_unsupported(criterion)
437-
# rubocop:disable Style/IfUnlessModifier
438-
unless SUPPORTED_COVERAGE_CRITERIA.member?(criterion)
435+
unless SUPPORTED_COVERAGE_CRITERIA.member?(criterion) # rubocop:disable Style/IfUnlessModifier
439436
raise "Unsupported coverage criterion #{criterion}, supported values are #{SUPPORTED_COVERAGE_CRITERIA}"
440437
end
441-
# rubocop:enable Style/IfUnlessModifier
442438
end
443439

444440
def minimum_possible_coverage_exceeded(coverage_option)

spec/combine/results_combiner_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949

5050
before do
5151
SimpleCov.enable_coverage :branch
52+
SimpleCov.enable_coverage :method
5253
end
5354

5455
context "a merge" do

0 commit comments

Comments
 (0)