Skip to content

Commit b31437e

Browse files
committed
deprecate TO_FILE and make all private methods private
1 parent 109173b commit b31437e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/code_climate/test_reporter/formatter.rb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def format(result)
1919

2020
payload = to_payload(result)
2121
PayloadValidator.validate(payload)
22-
if tddium? || ENV["TO_FILE"]
22+
if write_to_file?
2323
file_path = File.join(Dir.tmpdir, "codeclimate-test-coverage-#{SecureRandom.uuid}.json")
2424
print "Coverage results saved to #{file_path}... "
2525
File.open(file_path, "w") { |file| file.write(payload.to_json) }
@@ -36,6 +36,8 @@ def format(result)
3636
false
3737
end
3838

39+
private
40+
3941
def partial?
4042
tddium?
4143
end
@@ -81,7 +83,6 @@ def to_payload(result)
8183
}
8284
end
8385

84-
8586
def short_filename(filename)
8687
return filename unless ::SimpleCov.root
8788
filename = filename.gsub(::SimpleCov.root, '.').gsub(/^\.\//, '')
@@ -98,7 +99,13 @@ def round(numeric, precision)
9899
Float(numeric).round(precision)
99100
end
100101

101-
private
102+
def write_to_file?
103+
return true if tddium? || ENV["CODECLIMATE_TO_FILE"]
104+
if ENV["TO_FILE"]
105+
warn "TO_FILE is deprecated, use CODECLIMATE_TO_FILE"
106+
true
107+
end
108+
end
102109

103110
def apply_prefix filename
104111
prefix = CodeClimate::TestReporter.configuration.path_prefix

0 commit comments

Comments
 (0)