Skip to content

Commit

Permalink
Merge pull request #219 from codacy/fix/change-json-tmp-dir
Browse files Browse the repository at this point in the history
fix: Change generated JSON file directory to tmp folder :breaking:
  • Loading branch information
Francisco Duarte authored May 26, 2020
2 parents c132b5c + 1bcfb33 commit 5b17668
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/main/scala/com/codacy/rules/ReportRules.scala
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,14 @@ class ReportRules(coverageServices: => CoverageServices) extends LogSupport {
if (report.fileReports.isEmpty)
Left(s"The provided coverage report ${file.getAbsolutePath} generated an empty result.")
else {
val codacyReportFilename =
s"${file.getAbsoluteFile.getParent}${File.separator}codacy-coverage.json"
logger.debug(s"Saving parsed report to $codacyReportFilename")
val codacyReportFile = new File(codacyReportFilename)
val codacyReportFile = File.createTempFile("codacy-coverage-", ".json")

logger.debug(s"Saving parsed report to ${codacyReportFile.getAbsolutePath}")
logger.debug(report.toString)
FileHelper.writeJsonToFile(codacyReportFile, report)

logUploadedFileInfo(codacyReportFile)
Right(codacyReportFilename)
Right(codacyReportFile.getAbsolutePath)
}
}

Expand Down

0 comments on commit 5b17668

Please sign in to comment.