From adb037efe6f8fb05e719a46fd798a70d0b6cc536 Mon Sep 17 00:00:00 2001 From: Lorenzo Gabriele Date: Tue, 31 Oct 2023 16:31:42 +0100 Subject: [PATCH 1/2] fix: Merge results on the same line instead of replacing --- .../implementation/CoberturaParser.scala | 19 +++++++++++++------ .../src/test/resources/test_cobertura.xml | 4 ++++ .../codacy/parsers/CoberturaParserTest.scala | 2 +- .../parsers/CoverageParserFactoryTest.scala | 2 +- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/coverage-parser/src/main/scala/com/codacy/parsers/implementation/CoberturaParser.scala b/coverage-parser/src/main/scala/com/codacy/parsers/implementation/CoberturaParser.scala index 3568de3b..da256eab 100644 --- a/coverage-parser/src/main/scala/com/codacy/parsers/implementation/CoberturaParser.scala +++ b/coverage-parser/src/main/scala/com/codacy/parsers/implementation/CoberturaParser.scala @@ -7,6 +7,7 @@ import com.codacy.parsers.util.MathUtils._ import com.codacy.parsers.util.TextUtils import com.codacy.parsers.{CoverageParser, XmlReportParser} +import scala.collection.mutable import scala.xml.{Elem, NodeSeq} object CoberturaParser extends CoverageParser with XmlReportParser { @@ -50,12 +51,18 @@ object CoberturaParser extends CoverageParser with XmlReportParser { } val fileHit = if (classHit.nonEmpty) { classHit.sum / classHit.length } else 0 - val lineHitMap: Map[Int, Int] = - (for { - xClass <- classes - line <- xClass \\ "line" - } yield (line \@ "number").toInt -> (line \@ "hits").toIntOrMaxValue).toMap + val map = mutable.Map.empty[Int, Int] - CoverageFileReport(sourceFilename, fileHit, lineHitMap) + for { + xClass <- classes + line <- xClass \\ "line" + } { + val key = (line \@ "number").toInt + val value = (line \@ "hits").toIntOrMaxValue + + map(key) = map.get(key).getOrElse(0) + value + } + + CoverageFileReport(sourceFilename, fileHit, map.toMap) } } diff --git a/coverage-parser/src/test/resources/test_cobertura.xml b/coverage-parser/src/test/resources/test_cobertura.xml index ff31301a..e7ee31a1 100644 --- a/coverage-parser/src/test/resources/test_cobertura.xml +++ b/coverage-parser/src/test/resources/test_cobertura.xml @@ -9,6 +9,10 @@ + + + + diff --git a/coverage-parser/src/test/scala/com/codacy/parsers/CoberturaParserTest.scala b/coverage-parser/src/test/scala/com/codacy/parsers/CoberturaParserTest.scala index 540d198e..bfa3f115 100644 --- a/coverage-parser/src/test/scala/com/codacy/parsers/CoberturaParserTest.scala +++ b/coverage-parser/src/test/scala/com/codacy/parsers/CoberturaParserTest.scala @@ -36,7 +36,7 @@ class CoberturaParserTest extends WordSpec with BeforeAndAfterAll with Matchers CoverageFileReport( "coverage-parser/src/test/resources/TestSourceFile.scala", 87, - Map(5 -> 1, 10 -> 1, 6 -> 2, 9 -> 1, 3 -> 0, 4 -> 1) + Map(5 -> 1, 10 -> 1, 6 -> 2, 9 -> 1, 3 -> 0, 4 -> 1, 7 -> 1, 8 -> 3) ) ) ) diff --git a/coverage-parser/src/test/scala/com/codacy/parsers/CoverageParserFactoryTest.scala b/coverage-parser/src/test/scala/com/codacy/parsers/CoverageParserFactoryTest.scala index b89a1085..2814d42b 100644 --- a/coverage-parser/src/test/scala/com/codacy/parsers/CoverageParserFactoryTest.scala +++ b/coverage-parser/src/test/scala/com/codacy/parsers/CoverageParserFactoryTest.scala @@ -21,7 +21,7 @@ class CoverageParserFactoryTest extends WordSpec with BeforeAndAfterAll with Mat CoverageFileReport( "coverage-parser/src/test/resources/TestSourceFile.scala", 87, - Map(5 -> 1, 10 -> 1, 6 -> 2, 9 -> 1, 3 -> 0, 4 -> 1) + Map(5 -> 1, 10 -> 1, 6 -> 2, 9 -> 1, 3 -> 0, 4 -> 1, 7 -> 1, 8 -> 3) ) ) ) From 05a72907fb27fc54d98100a4cf67c25bbacc4b3a Mon Sep 17 00:00:00 2001 From: Lorenzo Gabriele Date: Tue, 31 Oct 2023 16:53:33 +0100 Subject: [PATCH 2/2] fix: Fix zlib download link --- graalvm/build-deps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graalvm/build-deps.sh b/graalvm/build-deps.sh index 2fbedf5c..bac5a54b 100755 --- a/graalvm/build-deps.sh +++ b/graalvm/build-deps.sh @@ -12,7 +12,7 @@ export CC=$TOOLCHAIN_DIR/bin/gcc zlib='zlib-1.2.13' zlibtargz=$zlib.tar.gz -curl https://zlib.net/$zlibtargz --output $zlibtargz +curl https://zlib.net/fossils/$zlibtargz --output $zlibtargz tar -xf $zlibtargz (