Skip to content

Commit

Permalink
deprecate TO_FILE and make all private methods private
Browse files Browse the repository at this point in the history
  • Loading branch information
grosser committed Apr 17, 2015
1 parent 109173b commit b31437e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/code_climate/test_reporter/formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def format(result)

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

private

def partial?
tddium?
end
Expand Down Expand Up @@ -81,7 +83,6 @@ def to_payload(result)
}
end


def short_filename(filename)
return filename unless ::SimpleCov.root
filename = filename.gsub(::SimpleCov.root, '.').gsub(/^\.\//, '')
Expand All @@ -98,7 +99,13 @@ def round(numeric, precision)
Float(numeric).round(precision)
end

private
def write_to_file?
return true if tddium? || ENV["CODECLIMATE_TO_FILE"]
if ENV["TO_FILE"]
warn "TO_FILE is deprecated, use CODECLIMATE_TO_FILE"
true
end
end

def apply_prefix filename
prefix = CodeClimate::TestReporter.configuration.path_prefix
Expand Down

0 comments on commit b31437e

Please sign in to comment.