Skip to content
This repository was archived by the owner on Feb 19, 2020. It is now read-only.

Commit 0b76c92

Browse files
committed
update api
1 parent 4a2a93a commit 0b76c92

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/main/scala/com/codacy/CodacyCoveragePlugin.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.codacy
22

33
import java.io.File
44

5+
import com.codacy.api.Language
56
import com.codacy.api.client.CodacyClient
67
import com.codacy.api.helpers.FileHelper
78
import com.codacy.api.service.CoverageServices
@@ -46,7 +47,7 @@ object CodacyCoveragePlugin extends AutoPlugin {
4647
FileHelper.withTokenAndCommit(codacyToken) {
4748
case (projectToken, commitUUID) =>
4849

49-
val reader = new CoberturaParser(coberturaFile, rootProjectDir)
50+
val reader = new CoberturaParser(Language.Scala, coberturaFile, rootProjectDir)
5051
val report = reader.generateReport()
5152

5253
FileHelper.writeJsonToFile(codacyCoverageFile, report)

src/main/scala/com/codacy/parsers/CoberturaParser.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package com.codacy.parsers
22

33
import java.io.File
44

5-
import com.codacy.api.{CoverageFileReport, CoverageReport}
5+
import com.codacy.api.{Language, CoverageFileReport, CoverageReport}
66

77
import scala.xml.factory.XMLLoader
88
import scala.xml.{Elem, Node, SAXParser}
@@ -20,7 +20,7 @@ object XML extends XMLLoader[Elem] {
2020
}
2121
}
2222

23-
class CoberturaParser(coberturaFile: File, rootProject: File) {
23+
class CoberturaParser(language: Language.Value, coberturaFile: File, rootProject: File) {
2424

2525
val elem = XML.loadFile(coberturaFile)
2626

@@ -39,7 +39,7 @@ class CoberturaParser(coberturaFile: File, rootProject: File) {
3939
lineCoverage(file)
4040
}.toSeq
4141

42-
CoverageReport(total, filesCoverage)
42+
CoverageReport(language, total, filesCoverage)
4343
}
4444

4545
private def lineCoverage(sourceFilename: String): CoverageFileReport = {

src/test/scala/com/codacy/parsers/CoberturaReaderTest.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ package com.codacy.parsers
22

33
import java.io.File
44

5+
import com.codacy.api.Language
56
import org.scalatest.{BeforeAndAfterAll, Matchers, WordSpec}
67

78
import scala.collection.mutable.ArrayBuffer
89

910
class CoberturaReaderTest extends WordSpec with BeforeAndAfterAll with Matchers {
1011

11-
val reader = new CoberturaParser(new File("src/test/resources/test_cobertura.xml"), new File(""))
12+
val reader = new CoberturaParser(Language.Scala, new File("src/test/resources/test_cobertura.xml"), new File(""))
1213

1314
"CoberturaReader" when {
1415
"reading a Cobertura file" should {

0 commit comments

Comments
 (0)