From 2ea235385e7b0bba4e042b736123db1d1f10057e Mon Sep 17 00:00:00 2001 From: Lorenzo Gabriele Date: Fri, 14 Jun 2024 17:07:30 +0200 Subject: [PATCH 1/4] clean: Merge all modules into one --- build.sbt | 172 +++++++----------- .../scala/com/codacy/api/CoverageReport.scala | 0 .../com/codacy/api/client/CodacyClient.scala | 0 .../scala/com/codacy/api/client/Request.scala | 0 .../codacy/api/client/RequestResponse.scala | 0 .../codacy/api/client/RequestSuccess.scala | 0 .../codacy/api/client/RequestTimeout.scala | 0 .../com/codacy/api/helpers/FileHelper.scala | 0 .../codacy/api/helpers/vcs/GitClient.scala | 0 .../codacy/api/service/CoverageServices.scala | 0 .../scala/com/codacy/api/util/JsonOps.scala | 0 .../com/codacy/parsers/CoverageParser.scala | 0 .../com/codacy/parsers/XmlReportParser.scala | 0 .../parsers/implementation/CloverParser.scala | 0 .../implementation/CoberturaParser.scala | 0 .../implementation/DotcoverParser.scala | 0 .../parsers/implementation/GoParser.scala | 0 .../parsers/implementation/JacocoParser.scala | 0 .../parsers/implementation/LCOVParser.scala | 0 .../implementation/OpenCoverParser.scala | 0 .../implementation/PhpUnitXmlParser.scala | 0 .../com/codacy/parsers/util/MathUtils.scala | 0 .../com/codacy/parsers/util/TextUtils.scala | 0 .../com/codacy/parsers/util/XMLoader.scala | 0 .../test/resources/TestSourceFile.scala | 0 .../test/resources/TestSourceFile2.scala | 0 .../resources/go/changed_package_name.out | 0 .../test/resources/go/original_package.out | 0 .../test/resources/invalid_report.lcov | 0 .../test/resources/invalid_report.xml | 0 .../test/resources/phpunitxml/Api/Api.php.xml | 0 .../phpunitxml/CodacyPhpCoverage.php.xml | 0 .../test/resources/phpunitxml/Config.php.xml | 0 .../phpunitxml/Git/GitClient.php.xml | 0 .../phpunitxml/Parser/CloverParser.php.xml | 0 .../phpunitxml/Parser/Parser.php.xml | 0 .../Parser/PhpUnitXmlParser.php.xml | 0 .../phpunitxml/Report/CoverageReport.php.xml | 0 .../phpunitxml/Report/FileReport.php.xml | 0 .../phpunitxml/Report/JsonProducer.php.xml | 0 .../resources/phpunitxml/incorrect_index.xml | 0 .../test/resources/phpunitxml/index.xml | 0 .../test/resources/test_clover.xml | 0 .../test/resources/test_clover_with_paths.xml | 0 .../test_clover_without_packages.xml | 0 .../test/resources/test_cobertura.xml | 0 .../test/resources/test_dotcover.xml | 0 .../src => src}/test/resources/test_go.out | 0 .../test/resources/test_jacoco.xml | 0 .../src => src}/test/resources/test_lcov.lcov | 0 .../test/resources/test_opencover.xml | 0 .../test/resources/thousand_sep_cobertura.xml | 0 .../resources/windows_paths_cobertura.xml | 0 .../scala/com/codacy/api/GitClientTest.scala | 0 .../com/codacy/parsers/CloverParserTest.scala | 0 .../codacy/parsers/CoberturaParserTest.scala | 0 .../parsers/CoverageParserFactoryTest.scala | 0 .../codacy/parsers/CoverageParserTest.scala | 0 .../codacy/parsers/DotCoverParserTest.scala | 0 .../com/codacy/parsers/GoParserTest.scala | 0 .../com/codacy/parsers/JacocoParserTest.scala | 0 .../com/codacy/parsers/LCOVParserTest.scala | 0 .../codacy/parsers/OpenCoverParserTest.scala | 0 .../codacy/parsers/PhpUnitXmlParserTest.scala | 0 64 files changed, 70 insertions(+), 102 deletions(-) rename {api-scala/src => src}/main/scala/com/codacy/api/CoverageReport.scala (100%) rename {api-scala/src => src}/main/scala/com/codacy/api/client/CodacyClient.scala (100%) rename {api-scala/src => src}/main/scala/com/codacy/api/client/Request.scala (100%) rename {api-scala/src => src}/main/scala/com/codacy/api/client/RequestResponse.scala (100%) rename {api-scala/src => src}/main/scala/com/codacy/api/client/RequestSuccess.scala (100%) rename {api-scala/src => src}/main/scala/com/codacy/api/client/RequestTimeout.scala (100%) rename {api-scala/src => src}/main/scala/com/codacy/api/helpers/FileHelper.scala (100%) rename {api-scala/src => src}/main/scala/com/codacy/api/helpers/vcs/GitClient.scala (100%) rename {api-scala/src => src}/main/scala/com/codacy/api/service/CoverageServices.scala (100%) rename {api-scala/src => src}/main/scala/com/codacy/api/util/JsonOps.scala (100%) rename {coverage-parser/src => src}/main/scala/com/codacy/parsers/CoverageParser.scala (100%) rename {coverage-parser/src => src}/main/scala/com/codacy/parsers/XmlReportParser.scala (100%) rename {coverage-parser/src => src}/main/scala/com/codacy/parsers/implementation/CloverParser.scala (100%) rename {coverage-parser/src => src}/main/scala/com/codacy/parsers/implementation/CoberturaParser.scala (100%) rename {coverage-parser/src => src}/main/scala/com/codacy/parsers/implementation/DotcoverParser.scala (100%) rename {coverage-parser/src => src}/main/scala/com/codacy/parsers/implementation/GoParser.scala (100%) rename {coverage-parser/src => src}/main/scala/com/codacy/parsers/implementation/JacocoParser.scala (100%) rename {coverage-parser/src => src}/main/scala/com/codacy/parsers/implementation/LCOVParser.scala (100%) rename {coverage-parser/src => src}/main/scala/com/codacy/parsers/implementation/OpenCoverParser.scala (100%) rename {coverage-parser/src => src}/main/scala/com/codacy/parsers/implementation/PhpUnitXmlParser.scala (100%) rename {coverage-parser/src => src}/main/scala/com/codacy/parsers/util/MathUtils.scala (100%) rename {coverage-parser/src => src}/main/scala/com/codacy/parsers/util/TextUtils.scala (100%) rename {coverage-parser/src => src}/main/scala/com/codacy/parsers/util/XMLoader.scala (100%) rename {coverage-parser/src => src}/test/resources/TestSourceFile.scala (100%) rename {coverage-parser/src => src}/test/resources/TestSourceFile2.scala (100%) rename {coverage-parser/src => src}/test/resources/go/changed_package_name.out (100%) rename {coverage-parser/src => src}/test/resources/go/original_package.out (100%) rename {coverage-parser/src => src}/test/resources/invalid_report.lcov (100%) rename {coverage-parser/src => src}/test/resources/invalid_report.xml (100%) rename {coverage-parser/src => src}/test/resources/phpunitxml/Api/Api.php.xml (100%) rename {coverage-parser/src => src}/test/resources/phpunitxml/CodacyPhpCoverage.php.xml (100%) rename {coverage-parser/src => src}/test/resources/phpunitxml/Config.php.xml (100%) rename {coverage-parser/src => src}/test/resources/phpunitxml/Git/GitClient.php.xml (100%) rename {coverage-parser/src => src}/test/resources/phpunitxml/Parser/CloverParser.php.xml (100%) rename {coverage-parser/src => src}/test/resources/phpunitxml/Parser/Parser.php.xml (100%) rename {coverage-parser/src => src}/test/resources/phpunitxml/Parser/PhpUnitXmlParser.php.xml (100%) rename {coverage-parser/src => src}/test/resources/phpunitxml/Report/CoverageReport.php.xml (100%) rename {coverage-parser/src => src}/test/resources/phpunitxml/Report/FileReport.php.xml (100%) rename {coverage-parser/src => src}/test/resources/phpunitxml/Report/JsonProducer.php.xml (100%) rename {coverage-parser/src => src}/test/resources/phpunitxml/incorrect_index.xml (100%) rename {coverage-parser/src => src}/test/resources/phpunitxml/index.xml (100%) rename {coverage-parser/src => src}/test/resources/test_clover.xml (100%) rename {coverage-parser/src => src}/test/resources/test_clover_with_paths.xml (100%) rename {coverage-parser/src => src}/test/resources/test_clover_without_packages.xml (100%) rename {coverage-parser/src => src}/test/resources/test_cobertura.xml (100%) rename {coverage-parser/src => src}/test/resources/test_dotcover.xml (100%) rename {coverage-parser/src => src}/test/resources/test_go.out (100%) rename {coverage-parser/src => src}/test/resources/test_jacoco.xml (100%) rename {coverage-parser/src => src}/test/resources/test_lcov.lcov (100%) rename {coverage-parser/src => src}/test/resources/test_opencover.xml (100%) rename {coverage-parser/src => src}/test/resources/thousand_sep_cobertura.xml (100%) rename {coverage-parser/src => src}/test/resources/windows_paths_cobertura.xml (100%) rename {api-scala/src => src}/test/scala/com/codacy/api/GitClientTest.scala (100%) rename {coverage-parser/src => src}/test/scala/com/codacy/parsers/CloverParserTest.scala (100%) rename {coverage-parser/src => src}/test/scala/com/codacy/parsers/CoberturaParserTest.scala (100%) rename {coverage-parser/src => src}/test/scala/com/codacy/parsers/CoverageParserFactoryTest.scala (100%) rename {coverage-parser/src => src}/test/scala/com/codacy/parsers/CoverageParserTest.scala (100%) rename {coverage-parser/src => src}/test/scala/com/codacy/parsers/DotCoverParserTest.scala (100%) rename {coverage-parser/src => src}/test/scala/com/codacy/parsers/GoParserTest.scala (100%) rename {coverage-parser/src => src}/test/scala/com/codacy/parsers/JacocoParserTest.scala (100%) rename {coverage-parser/src => src}/test/scala/com/codacy/parsers/LCOVParserTest.scala (100%) rename {coverage-parser/src => src}/test/scala/com/codacy/parsers/OpenCoverParserTest.scala (100%) rename {coverage-parser/src => src}/test/scala/com/codacy/parsers/PhpUnitXmlParserTest.scala (100%) diff --git a/build.sbt b/build.sbt index eb72cfff..9ff395af 100644 --- a/build.sbt +++ b/build.sbt @@ -1,108 +1,76 @@ -inThisBuild(Seq(scalaVersion := "3.3.3")) - -def commonSettings = - Seq(scalacOptions := { - val toFilter = Set("-deprecation:false") - scalacOptions.value.filterNot(toFilter) ++ Seq("-deprecation") - }) - -name := "codacy-coverage-reporter" - -// Runtime dependencies -libraryDependencies ++= Seq( - "com.github.alexarchambault" %% "case-app" % "2.1.0-M28", - "org.wvlet.airframe" %% "airframe-log" % "24.6.0" -) - -// Test dependencies -libraryDependencies ++= Seq(scalatest % "it,test", "org.scalamock" %% "scalamock" % "6.0.0" % Test) - -assembly / mainClass := Some("com.codacy.CodacyCoverageReporter") -assembly / assemblyMergeStrategy := { - case PathList("META-INF", "MANIFEST.MF") => MergeStrategy.discard - case m if m.toLowerCase.matches("meta-inf.*\\.sf$") => MergeStrategy.discard - case _ => MergeStrategy.first -} -assembly / test := {} -crossPaths := false -run / fork := true - -// HACK: Since we are only using the public resolvers we need to remove the private for it to not fail -resolvers ~= { - _.filterNot(_.name.toLowerCase.contains("codacy")) -} - -description := "CLI to send coverage reports to Codacy through the API" - -scmInfo := Some( - ScmInfo( - url("https://github.com/codacy/codacy-coverage-reporter"), - "scm:git:git@github.com:codacy/codacy-coverage-reporter.git" - ) -) - -Test / fork := true -Global / cancelable := true - -javacOptions ++= Seq("-source", "11", "-target", "11") - -enablePlugins(NativeImagePlugin) - -nativeImageVersion := "22.3.0" - -val osSpecificOptions = - if (sys.props("os.name") == "Mac OS X") Seq.empty[String] - else Seq("--static", "--libc=musl") - -nativeImageOptions := Seq( - "--verbose", - "--no-server", - "--enable-http", - "--enable-https", - "--enable-url-protocols=http,https,jar", - "--enable-all-security-services", - "-H:+JNI", - "-H:IncludeResourceBundles=com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", - "-H:+ReportExceptionStackTraces", - "--no-fallback", - "--report-unsupported-elements-at-runtime" -) ++ osSpecificOptions - -dependsOn(coverageParser) - -commonSettings - -val scalatest = "org.scalatest" %% "scalatest" % "3.2.18" - -lazy val apiScala = project - .in(file("api-scala")) +lazy val root = project + .in(file(".")) .settings( - commonSettings, + scalaVersion := "3.3.3", + scalacOptions := { + val toFilter = Set("-deprecation:false") + scalacOptions.value.filterNot(toFilter) ++ Seq("-deprecation") + }, + name := "codacy-coverage-reporter", +// Runtime dependencies libraryDependencies ++= Seq( + "com.github.alexarchambault" %% "case-app" % "2.1.0-M28", + "org.wvlet.airframe" %% "airframe-log" % "24.6.0", + "com.codacy" %% "codacy-plugins-api" % "8.1.4", + "org.scala-lang.modules" %% "scala-xml" % "2.3.0", "com.typesafe.play" %% "play-json" % "2.10.5", ("org.scalaj" %% "scalaj-http" % "2.4.2").cross(CrossVersion.for3Use2_13), - "org.eclipse.jgit" % "org.eclipse.jgit" % "4.11.9.201909030838-r", - scalatest % Test - ) - ) - -lazy val coverageParser = project - .in(file("coverage-parser")) - .settings( - commonSettings, + "org.eclipse.jgit" % "org.eclipse.jgit" % "4.11.9.201909030838-r" + ), +// Test dependencies libraryDependencies ++= Seq( - "com.codacy" %% "codacy-plugins-api" % "8.1.4", - "org.scala-lang.modules" %% "scala-xml" % "2.3.0", - scalatest % Test - ) + "org.scalatest" %% "scalatest" % "3.2.18" % "it,test", + "org.scalamock" %% "scalamock" % "6.0.0" % Test + ), + assembly / mainClass := Some("com.codacy.CodacyCoverageReporter"), + assembly / assemblyMergeStrategy := { + case PathList("META-INF", "MANIFEST.MF") => MergeStrategy.discard + case m if m.toLowerCase.matches("meta-inf.*\\.sf$") => MergeStrategy.discard + case _ => MergeStrategy.first + }, + assembly / test := {}, + crossPaths := false, + run / fork := true, +// HACK: Since we are only using the public resolvers we need to remove the private for it to not fail + resolvers ~= { + _.filterNot(_.name.toLowerCase.contains("codacy")) + }, + description := "CLI to send coverage reports to Codacy through the API", + scmInfo := Some( + ScmInfo( + url("https://github.com/codacy/codacy-coverage-reporter"), + "scm:git:git@github.com:codacy/codacy-coverage-reporter.git" + ) + ), + Test / fork := true, + Global / cancelable := true, + javacOptions ++= Seq("-source", "11", "-target", "11"), + nativeImageVersion := "22.3.0", { + val osSpecificOptions = + if (sys.props("os.name") == "Mac OS X") Seq.empty[String] + else Seq("--static", "--libc=musl") + + nativeImageOptions := Seq( + "--verbose", + "--no-server", + "--enable-http", + "--enable-https", + "--enable-url-protocols=http,https,jar", + "--enable-all-security-services", + "-H:+JNI", + "-H:IncludeResourceBundles=com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", + "-H:+ReportExceptionStackTraces", + "--no-fallback", + "--report-unsupported-elements-at-runtime" + ) ++ osSpecificOptions + }, + // https://github.com/sbt/sbt-assembly/issues/146 + assemblyMergeStrategy := { + case PathList("module-info.class") => MergeStrategy.discard + case x if x.endsWith("/module-info.class") => MergeStrategy.discard + case x => + val oldStrategy = (ThisBuild / assemblyMergeStrategy).value + oldStrategy(x) + } ) - .dependsOn(apiScala) - -// https://github.com/sbt/sbt-assembly/issues/146 -ThisBuild / assemblyMergeStrategy := { - case PathList("module-info.class") => MergeStrategy.discard - case x if x.endsWith("/module-info.class") => MergeStrategy.discard - case x => - val oldStrategy = (ThisBuild / assemblyMergeStrategy).value - oldStrategy(x) -} + .enablePlugins(NativeImagePlugin) diff --git a/api-scala/src/main/scala/com/codacy/api/CoverageReport.scala b/src/main/scala/com/codacy/api/CoverageReport.scala similarity index 100% rename from api-scala/src/main/scala/com/codacy/api/CoverageReport.scala rename to src/main/scala/com/codacy/api/CoverageReport.scala diff --git a/api-scala/src/main/scala/com/codacy/api/client/CodacyClient.scala b/src/main/scala/com/codacy/api/client/CodacyClient.scala similarity index 100% rename from api-scala/src/main/scala/com/codacy/api/client/CodacyClient.scala rename to src/main/scala/com/codacy/api/client/CodacyClient.scala diff --git a/api-scala/src/main/scala/com/codacy/api/client/Request.scala b/src/main/scala/com/codacy/api/client/Request.scala similarity index 100% rename from api-scala/src/main/scala/com/codacy/api/client/Request.scala rename to src/main/scala/com/codacy/api/client/Request.scala diff --git a/api-scala/src/main/scala/com/codacy/api/client/RequestResponse.scala b/src/main/scala/com/codacy/api/client/RequestResponse.scala similarity index 100% rename from api-scala/src/main/scala/com/codacy/api/client/RequestResponse.scala rename to src/main/scala/com/codacy/api/client/RequestResponse.scala diff --git a/api-scala/src/main/scala/com/codacy/api/client/RequestSuccess.scala b/src/main/scala/com/codacy/api/client/RequestSuccess.scala similarity index 100% rename from api-scala/src/main/scala/com/codacy/api/client/RequestSuccess.scala rename to src/main/scala/com/codacy/api/client/RequestSuccess.scala diff --git a/api-scala/src/main/scala/com/codacy/api/client/RequestTimeout.scala b/src/main/scala/com/codacy/api/client/RequestTimeout.scala similarity index 100% rename from api-scala/src/main/scala/com/codacy/api/client/RequestTimeout.scala rename to src/main/scala/com/codacy/api/client/RequestTimeout.scala diff --git a/api-scala/src/main/scala/com/codacy/api/helpers/FileHelper.scala b/src/main/scala/com/codacy/api/helpers/FileHelper.scala similarity index 100% rename from api-scala/src/main/scala/com/codacy/api/helpers/FileHelper.scala rename to src/main/scala/com/codacy/api/helpers/FileHelper.scala diff --git a/api-scala/src/main/scala/com/codacy/api/helpers/vcs/GitClient.scala b/src/main/scala/com/codacy/api/helpers/vcs/GitClient.scala similarity index 100% rename from api-scala/src/main/scala/com/codacy/api/helpers/vcs/GitClient.scala rename to src/main/scala/com/codacy/api/helpers/vcs/GitClient.scala diff --git a/api-scala/src/main/scala/com/codacy/api/service/CoverageServices.scala b/src/main/scala/com/codacy/api/service/CoverageServices.scala similarity index 100% rename from api-scala/src/main/scala/com/codacy/api/service/CoverageServices.scala rename to src/main/scala/com/codacy/api/service/CoverageServices.scala diff --git a/api-scala/src/main/scala/com/codacy/api/util/JsonOps.scala b/src/main/scala/com/codacy/api/util/JsonOps.scala similarity index 100% rename from api-scala/src/main/scala/com/codacy/api/util/JsonOps.scala rename to src/main/scala/com/codacy/api/util/JsonOps.scala diff --git a/coverage-parser/src/main/scala/com/codacy/parsers/CoverageParser.scala b/src/main/scala/com/codacy/parsers/CoverageParser.scala similarity index 100% rename from coverage-parser/src/main/scala/com/codacy/parsers/CoverageParser.scala rename to src/main/scala/com/codacy/parsers/CoverageParser.scala diff --git a/coverage-parser/src/main/scala/com/codacy/parsers/XmlReportParser.scala b/src/main/scala/com/codacy/parsers/XmlReportParser.scala similarity index 100% rename from coverage-parser/src/main/scala/com/codacy/parsers/XmlReportParser.scala rename to src/main/scala/com/codacy/parsers/XmlReportParser.scala diff --git a/coverage-parser/src/main/scala/com/codacy/parsers/implementation/CloverParser.scala b/src/main/scala/com/codacy/parsers/implementation/CloverParser.scala similarity index 100% rename from coverage-parser/src/main/scala/com/codacy/parsers/implementation/CloverParser.scala rename to src/main/scala/com/codacy/parsers/implementation/CloverParser.scala diff --git a/coverage-parser/src/main/scala/com/codacy/parsers/implementation/CoberturaParser.scala b/src/main/scala/com/codacy/parsers/implementation/CoberturaParser.scala similarity index 100% rename from coverage-parser/src/main/scala/com/codacy/parsers/implementation/CoberturaParser.scala rename to src/main/scala/com/codacy/parsers/implementation/CoberturaParser.scala diff --git a/coverage-parser/src/main/scala/com/codacy/parsers/implementation/DotcoverParser.scala b/src/main/scala/com/codacy/parsers/implementation/DotcoverParser.scala similarity index 100% rename from coverage-parser/src/main/scala/com/codacy/parsers/implementation/DotcoverParser.scala rename to src/main/scala/com/codacy/parsers/implementation/DotcoverParser.scala diff --git a/coverage-parser/src/main/scala/com/codacy/parsers/implementation/GoParser.scala b/src/main/scala/com/codacy/parsers/implementation/GoParser.scala similarity index 100% rename from coverage-parser/src/main/scala/com/codacy/parsers/implementation/GoParser.scala rename to src/main/scala/com/codacy/parsers/implementation/GoParser.scala diff --git a/coverage-parser/src/main/scala/com/codacy/parsers/implementation/JacocoParser.scala b/src/main/scala/com/codacy/parsers/implementation/JacocoParser.scala similarity index 100% rename from coverage-parser/src/main/scala/com/codacy/parsers/implementation/JacocoParser.scala rename to src/main/scala/com/codacy/parsers/implementation/JacocoParser.scala diff --git a/coverage-parser/src/main/scala/com/codacy/parsers/implementation/LCOVParser.scala b/src/main/scala/com/codacy/parsers/implementation/LCOVParser.scala similarity index 100% rename from coverage-parser/src/main/scala/com/codacy/parsers/implementation/LCOVParser.scala rename to src/main/scala/com/codacy/parsers/implementation/LCOVParser.scala diff --git a/coverage-parser/src/main/scala/com/codacy/parsers/implementation/OpenCoverParser.scala b/src/main/scala/com/codacy/parsers/implementation/OpenCoverParser.scala similarity index 100% rename from coverage-parser/src/main/scala/com/codacy/parsers/implementation/OpenCoverParser.scala rename to src/main/scala/com/codacy/parsers/implementation/OpenCoverParser.scala diff --git a/coverage-parser/src/main/scala/com/codacy/parsers/implementation/PhpUnitXmlParser.scala b/src/main/scala/com/codacy/parsers/implementation/PhpUnitXmlParser.scala similarity index 100% rename from coverage-parser/src/main/scala/com/codacy/parsers/implementation/PhpUnitXmlParser.scala rename to src/main/scala/com/codacy/parsers/implementation/PhpUnitXmlParser.scala diff --git a/coverage-parser/src/main/scala/com/codacy/parsers/util/MathUtils.scala b/src/main/scala/com/codacy/parsers/util/MathUtils.scala similarity index 100% rename from coverage-parser/src/main/scala/com/codacy/parsers/util/MathUtils.scala rename to src/main/scala/com/codacy/parsers/util/MathUtils.scala diff --git a/coverage-parser/src/main/scala/com/codacy/parsers/util/TextUtils.scala b/src/main/scala/com/codacy/parsers/util/TextUtils.scala similarity index 100% rename from coverage-parser/src/main/scala/com/codacy/parsers/util/TextUtils.scala rename to src/main/scala/com/codacy/parsers/util/TextUtils.scala diff --git a/coverage-parser/src/main/scala/com/codacy/parsers/util/XMLoader.scala b/src/main/scala/com/codacy/parsers/util/XMLoader.scala similarity index 100% rename from coverage-parser/src/main/scala/com/codacy/parsers/util/XMLoader.scala rename to src/main/scala/com/codacy/parsers/util/XMLoader.scala diff --git a/coverage-parser/src/test/resources/TestSourceFile.scala b/src/test/resources/TestSourceFile.scala similarity index 100% rename from coverage-parser/src/test/resources/TestSourceFile.scala rename to src/test/resources/TestSourceFile.scala diff --git a/coverage-parser/src/test/resources/TestSourceFile2.scala b/src/test/resources/TestSourceFile2.scala similarity index 100% rename from coverage-parser/src/test/resources/TestSourceFile2.scala rename to src/test/resources/TestSourceFile2.scala diff --git a/coverage-parser/src/test/resources/go/changed_package_name.out b/src/test/resources/go/changed_package_name.out similarity index 100% rename from coverage-parser/src/test/resources/go/changed_package_name.out rename to src/test/resources/go/changed_package_name.out diff --git a/coverage-parser/src/test/resources/go/original_package.out b/src/test/resources/go/original_package.out similarity index 100% rename from coverage-parser/src/test/resources/go/original_package.out rename to src/test/resources/go/original_package.out diff --git a/coverage-parser/src/test/resources/invalid_report.lcov b/src/test/resources/invalid_report.lcov similarity index 100% rename from coverage-parser/src/test/resources/invalid_report.lcov rename to src/test/resources/invalid_report.lcov diff --git a/coverage-parser/src/test/resources/invalid_report.xml b/src/test/resources/invalid_report.xml similarity index 100% rename from coverage-parser/src/test/resources/invalid_report.xml rename to src/test/resources/invalid_report.xml diff --git a/coverage-parser/src/test/resources/phpunitxml/Api/Api.php.xml b/src/test/resources/phpunitxml/Api/Api.php.xml similarity index 100% rename from coverage-parser/src/test/resources/phpunitxml/Api/Api.php.xml rename to src/test/resources/phpunitxml/Api/Api.php.xml diff --git a/coverage-parser/src/test/resources/phpunitxml/CodacyPhpCoverage.php.xml b/src/test/resources/phpunitxml/CodacyPhpCoverage.php.xml similarity index 100% rename from coverage-parser/src/test/resources/phpunitxml/CodacyPhpCoverage.php.xml rename to src/test/resources/phpunitxml/CodacyPhpCoverage.php.xml diff --git a/coverage-parser/src/test/resources/phpunitxml/Config.php.xml b/src/test/resources/phpunitxml/Config.php.xml similarity index 100% rename from coverage-parser/src/test/resources/phpunitxml/Config.php.xml rename to src/test/resources/phpunitxml/Config.php.xml diff --git a/coverage-parser/src/test/resources/phpunitxml/Git/GitClient.php.xml b/src/test/resources/phpunitxml/Git/GitClient.php.xml similarity index 100% rename from coverage-parser/src/test/resources/phpunitxml/Git/GitClient.php.xml rename to src/test/resources/phpunitxml/Git/GitClient.php.xml diff --git a/coverage-parser/src/test/resources/phpunitxml/Parser/CloverParser.php.xml b/src/test/resources/phpunitxml/Parser/CloverParser.php.xml similarity index 100% rename from coverage-parser/src/test/resources/phpunitxml/Parser/CloverParser.php.xml rename to src/test/resources/phpunitxml/Parser/CloverParser.php.xml diff --git a/coverage-parser/src/test/resources/phpunitxml/Parser/Parser.php.xml b/src/test/resources/phpunitxml/Parser/Parser.php.xml similarity index 100% rename from coverage-parser/src/test/resources/phpunitxml/Parser/Parser.php.xml rename to src/test/resources/phpunitxml/Parser/Parser.php.xml diff --git a/coverage-parser/src/test/resources/phpunitxml/Parser/PhpUnitXmlParser.php.xml b/src/test/resources/phpunitxml/Parser/PhpUnitXmlParser.php.xml similarity index 100% rename from coverage-parser/src/test/resources/phpunitxml/Parser/PhpUnitXmlParser.php.xml rename to src/test/resources/phpunitxml/Parser/PhpUnitXmlParser.php.xml diff --git a/coverage-parser/src/test/resources/phpunitxml/Report/CoverageReport.php.xml b/src/test/resources/phpunitxml/Report/CoverageReport.php.xml similarity index 100% rename from coverage-parser/src/test/resources/phpunitxml/Report/CoverageReport.php.xml rename to src/test/resources/phpunitxml/Report/CoverageReport.php.xml diff --git a/coverage-parser/src/test/resources/phpunitxml/Report/FileReport.php.xml b/src/test/resources/phpunitxml/Report/FileReport.php.xml similarity index 100% rename from coverage-parser/src/test/resources/phpunitxml/Report/FileReport.php.xml rename to src/test/resources/phpunitxml/Report/FileReport.php.xml diff --git a/coverage-parser/src/test/resources/phpunitxml/Report/JsonProducer.php.xml b/src/test/resources/phpunitxml/Report/JsonProducer.php.xml similarity index 100% rename from coverage-parser/src/test/resources/phpunitxml/Report/JsonProducer.php.xml rename to src/test/resources/phpunitxml/Report/JsonProducer.php.xml diff --git a/coverage-parser/src/test/resources/phpunitxml/incorrect_index.xml b/src/test/resources/phpunitxml/incorrect_index.xml similarity index 100% rename from coverage-parser/src/test/resources/phpunitxml/incorrect_index.xml rename to src/test/resources/phpunitxml/incorrect_index.xml diff --git a/coverage-parser/src/test/resources/phpunitxml/index.xml b/src/test/resources/phpunitxml/index.xml similarity index 100% rename from coverage-parser/src/test/resources/phpunitxml/index.xml rename to src/test/resources/phpunitxml/index.xml diff --git a/coverage-parser/src/test/resources/test_clover.xml b/src/test/resources/test_clover.xml similarity index 100% rename from coverage-parser/src/test/resources/test_clover.xml rename to src/test/resources/test_clover.xml diff --git a/coverage-parser/src/test/resources/test_clover_with_paths.xml b/src/test/resources/test_clover_with_paths.xml similarity index 100% rename from coverage-parser/src/test/resources/test_clover_with_paths.xml rename to src/test/resources/test_clover_with_paths.xml diff --git a/coverage-parser/src/test/resources/test_clover_without_packages.xml b/src/test/resources/test_clover_without_packages.xml similarity index 100% rename from coverage-parser/src/test/resources/test_clover_without_packages.xml rename to src/test/resources/test_clover_without_packages.xml diff --git a/coverage-parser/src/test/resources/test_cobertura.xml b/src/test/resources/test_cobertura.xml similarity index 100% rename from coverage-parser/src/test/resources/test_cobertura.xml rename to src/test/resources/test_cobertura.xml diff --git a/coverage-parser/src/test/resources/test_dotcover.xml b/src/test/resources/test_dotcover.xml similarity index 100% rename from coverage-parser/src/test/resources/test_dotcover.xml rename to src/test/resources/test_dotcover.xml diff --git a/coverage-parser/src/test/resources/test_go.out b/src/test/resources/test_go.out similarity index 100% rename from coverage-parser/src/test/resources/test_go.out rename to src/test/resources/test_go.out diff --git a/coverage-parser/src/test/resources/test_jacoco.xml b/src/test/resources/test_jacoco.xml similarity index 100% rename from coverage-parser/src/test/resources/test_jacoco.xml rename to src/test/resources/test_jacoco.xml diff --git a/coverage-parser/src/test/resources/test_lcov.lcov b/src/test/resources/test_lcov.lcov similarity index 100% rename from coverage-parser/src/test/resources/test_lcov.lcov rename to src/test/resources/test_lcov.lcov diff --git a/coverage-parser/src/test/resources/test_opencover.xml b/src/test/resources/test_opencover.xml similarity index 100% rename from coverage-parser/src/test/resources/test_opencover.xml rename to src/test/resources/test_opencover.xml diff --git a/coverage-parser/src/test/resources/thousand_sep_cobertura.xml b/src/test/resources/thousand_sep_cobertura.xml similarity index 100% rename from coverage-parser/src/test/resources/thousand_sep_cobertura.xml rename to src/test/resources/thousand_sep_cobertura.xml diff --git a/coverage-parser/src/test/resources/windows_paths_cobertura.xml b/src/test/resources/windows_paths_cobertura.xml similarity index 100% rename from coverage-parser/src/test/resources/windows_paths_cobertura.xml rename to src/test/resources/windows_paths_cobertura.xml diff --git a/api-scala/src/test/scala/com/codacy/api/GitClientTest.scala b/src/test/scala/com/codacy/api/GitClientTest.scala similarity index 100% rename from api-scala/src/test/scala/com/codacy/api/GitClientTest.scala rename to src/test/scala/com/codacy/api/GitClientTest.scala diff --git a/coverage-parser/src/test/scala/com/codacy/parsers/CloverParserTest.scala b/src/test/scala/com/codacy/parsers/CloverParserTest.scala similarity index 100% rename from coverage-parser/src/test/scala/com/codacy/parsers/CloverParserTest.scala rename to src/test/scala/com/codacy/parsers/CloverParserTest.scala diff --git a/coverage-parser/src/test/scala/com/codacy/parsers/CoberturaParserTest.scala b/src/test/scala/com/codacy/parsers/CoberturaParserTest.scala similarity index 100% rename from coverage-parser/src/test/scala/com/codacy/parsers/CoberturaParserTest.scala rename to src/test/scala/com/codacy/parsers/CoberturaParserTest.scala diff --git a/coverage-parser/src/test/scala/com/codacy/parsers/CoverageParserFactoryTest.scala b/src/test/scala/com/codacy/parsers/CoverageParserFactoryTest.scala similarity index 100% rename from coverage-parser/src/test/scala/com/codacy/parsers/CoverageParserFactoryTest.scala rename to src/test/scala/com/codacy/parsers/CoverageParserFactoryTest.scala diff --git a/coverage-parser/src/test/scala/com/codacy/parsers/CoverageParserTest.scala b/src/test/scala/com/codacy/parsers/CoverageParserTest.scala similarity index 100% rename from coverage-parser/src/test/scala/com/codacy/parsers/CoverageParserTest.scala rename to src/test/scala/com/codacy/parsers/CoverageParserTest.scala diff --git a/coverage-parser/src/test/scala/com/codacy/parsers/DotCoverParserTest.scala b/src/test/scala/com/codacy/parsers/DotCoverParserTest.scala similarity index 100% rename from coverage-parser/src/test/scala/com/codacy/parsers/DotCoverParserTest.scala rename to src/test/scala/com/codacy/parsers/DotCoverParserTest.scala diff --git a/coverage-parser/src/test/scala/com/codacy/parsers/GoParserTest.scala b/src/test/scala/com/codacy/parsers/GoParserTest.scala similarity index 100% rename from coverage-parser/src/test/scala/com/codacy/parsers/GoParserTest.scala rename to src/test/scala/com/codacy/parsers/GoParserTest.scala diff --git a/coverage-parser/src/test/scala/com/codacy/parsers/JacocoParserTest.scala b/src/test/scala/com/codacy/parsers/JacocoParserTest.scala similarity index 100% rename from coverage-parser/src/test/scala/com/codacy/parsers/JacocoParserTest.scala rename to src/test/scala/com/codacy/parsers/JacocoParserTest.scala diff --git a/coverage-parser/src/test/scala/com/codacy/parsers/LCOVParserTest.scala b/src/test/scala/com/codacy/parsers/LCOVParserTest.scala similarity index 100% rename from coverage-parser/src/test/scala/com/codacy/parsers/LCOVParserTest.scala rename to src/test/scala/com/codacy/parsers/LCOVParserTest.scala diff --git a/coverage-parser/src/test/scala/com/codacy/parsers/OpenCoverParserTest.scala b/src/test/scala/com/codacy/parsers/OpenCoverParserTest.scala similarity index 100% rename from coverage-parser/src/test/scala/com/codacy/parsers/OpenCoverParserTest.scala rename to src/test/scala/com/codacy/parsers/OpenCoverParserTest.scala diff --git a/coverage-parser/src/test/scala/com/codacy/parsers/PhpUnitXmlParserTest.scala b/src/test/scala/com/codacy/parsers/PhpUnitXmlParserTest.scala similarity index 100% rename from coverage-parser/src/test/scala/com/codacy/parsers/PhpUnitXmlParserTest.scala rename to src/test/scala/com/codacy/parsers/PhpUnitXmlParserTest.scala From ebbe6747521c386e4c1739e73673fe92e7e97eba Mon Sep 17 00:00:00 2001 From: Lorenzo Gabriele Date: Fri, 14 Jun 2024 17:41:47 +0200 Subject: [PATCH 2/4] fix: Paths in tests --- src/test/resources/test_cobertura.xml | 6 ++--- src/test/resources/test_lcov.lcov | 4 ++-- src/test/resources/thousand_sep_cobertura.xml | 6 ++--- .../com/codacy/parsers/CloverParserTest.scala | 12 +++++----- .../codacy/parsers/CoberturaParserTest.scala | 22 +++++++++---------- .../parsers/CoverageParserFactoryTest.scala | 8 +++---- .../codacy/parsers/CoverageParserTest.scala | 4 ++-- .../codacy/parsers/DotCoverParserTest.scala | 6 ++--- .../com/codacy/parsers/GoParserTest.scala | 8 +++---- .../com/codacy/parsers/JacocoParserTest.scala | 6 ++--- .../com/codacy/parsers/LCOVParserTest.scala | 14 ++++++------ .../codacy/parsers/OpenCoverParserTest.scala | 6 ++--- .../codacy/parsers/PhpUnitXmlParserTest.scala | 8 +++---- 13 files changed, 55 insertions(+), 55 deletions(-) diff --git a/src/test/resources/test_cobertura.xml b/src/test/resources/test_cobertura.xml index bcd5fd48..fff9f5ed 100644 --- a/src/test/resources/test_cobertura.xml +++ b/src/test/resources/test_cobertura.xml @@ -2,7 +2,7 @@ - + @@ -16,14 +16,14 @@ - + - + diff --git a/src/test/resources/test_lcov.lcov b/src/test/resources/test_lcov.lcov index 5c5a4ba5..8b9f5048 100644 --- a/src/test/resources/test_lcov.lcov +++ b/src/test/resources/test_lcov.lcov @@ -1,9 +1,9 @@ -SF:coverage-parser/src/test/resources/TestSourceFile.scala +SF:src/test/resources/TestSourceFile.scala DA:3,0 DA:4,1 DA:5,1 DA:6,2 -SF:coverage-parser/src/test/resources/TestSourceFile2.scala +SF:src/test/resources/TestSourceFile2.scala DA:1,1 DA:2,1 DA:3,1 diff --git a/src/test/resources/thousand_sep_cobertura.xml b/src/test/resources/thousand_sep_cobertura.xml index 768e8990..3754583b 100644 --- a/src/test/resources/thousand_sep_cobertura.xml +++ b/src/test/resources/thousand_sep_cobertura.xml @@ -2,7 +2,7 @@ - + @@ -10,7 +10,7 @@ - + @@ -18,7 +18,7 @@ - + diff --git a/src/test/scala/com/codacy/parsers/CloverParserTest.scala b/src/test/scala/com/codacy/parsers/CloverParserTest.scala index 9722ca91..d9206604 100644 --- a/src/test/scala/com/codacy/parsers/CloverParserTest.scala +++ b/src/test/scala/com/codacy/parsers/CloverParserTest.scala @@ -15,7 +15,7 @@ class CloverParserTest extends AnyWordSpec with Matchers with EitherValues { "the report file does not exist" in { // Arrange - val nonExistentReportPath = "coverage-parser/src/test/resources/non-existent.xml" + val nonExistentReportPath = "src/test/resources/non-existent.xml" // Act val parseResult = CloverParser.parse(new File("."), new File(nonExistentReportPath)) @@ -23,12 +23,12 @@ class CloverParserTest extends AnyWordSpec with Matchers with EitherValues { // Assert val error = parseResult.left.value error should startWith("Unparseable report. ") - error should endWith("coverage-parser/src/test/resources/non-existent.xml (No such file or directory)") + error should endWith("src/test/resources/non-existent.xml (No such file or directory)") } "the report is not in the Clover format" in { // Arrange - val reportNotInCloverFormat = "coverage-parser/src/test/resources/test_cobertura.xml" + val reportNotInCloverFormat = "src/test/resources/test_cobertura.xml" // Act val parseResult = CloverParser.parse(new File("."), new File(reportNotInCloverFormat)) @@ -38,8 +38,8 @@ class CloverParserTest extends AnyWordSpec with Matchers with EitherValues { } } - val cloverReportPath = "coverage-parser/src/test/resources/test_clover.xml" - val cloverWithoutPackagesFilePath = "coverage-parser/src/test/resources/test_clover_without_packages.xml" + val cloverReportPath = "src/test/resources/test_clover.xml" + val cloverWithoutPackagesFilePath = "src/test/resources/test_clover_without_packages.xml" "succeed to parse a valid report" when { @@ -66,7 +66,7 @@ class CloverParserTest extends AnyWordSpec with Matchers with EitherValues { "reports contain both name and path attributes in file tags" in { // Arrange - val cloverWithPaths = new File("coverage-parser/src/test/resources/test_clover_with_paths.xml") + val cloverWithPaths = new File("src/test/resources/test_clover_with_paths.xml") // Act val parsedReportFilePaths = diff --git a/src/test/scala/com/codacy/parsers/CoberturaParserTest.scala b/src/test/scala/com/codacy/parsers/CoberturaParserTest.scala index c416a442..d2d03a91 100644 --- a/src/test/scala/com/codacy/parsers/CoberturaParserTest.scala +++ b/src/test/scala/com/codacy/parsers/CoberturaParserTest.scala @@ -13,27 +13,27 @@ class CoberturaParserTest extends AnyWordSpec with BeforeAndAfterAll with Matche "CoberturaParser" should { "identify if report is invalid" in { - val reader = CoberturaParser.parse(new File("."), new File("coverage-parser/src/test/resources/test_jacoco.xml")) + val reader = CoberturaParser.parse(new File("."), new File("src/test/resources/test_jacoco.xml")) reader.isLeft shouldBe true } "identify if report is valid" in { val reader = - CoberturaParser.parse(new File("."), new File("coverage-parser/src/test/resources/test_cobertura.xml")) + CoberturaParser.parse(new File("."), new File("src/test/resources/test_cobertura.xml")) reader.isRight shouldBe true } "return a valid report" in { val reader = - CoberturaParser.parse(new File("."), new File("coverage-parser/src/test/resources/test_cobertura.xml")) + CoberturaParser.parse(new File("."), new File("src/test/resources/test_cobertura.xml")) val testReport = CoverageReport( List( CoverageFileReport( - "coverage-parser/src/test/resources/TestSourceFile.scala", + "src/test/resources/TestSourceFile.scala", Map(5 -> 1, 10 -> 1, 6 -> 2, 9 -> Int.MaxValue, 3 -> 0, 4 -> 1, 7 -> 1, 8 -> 3) ), - CoverageFileReport("coverage-parser/src/test/resources/TestSourceFile2.scala", Map(1 -> 1, 2 -> 1, 3 -> 1)), + CoverageFileReport("src/test/resources/TestSourceFile2.scala", Map(1 -> 1, 2 -> 1, 3 -> 1)), ) ) @@ -42,15 +42,15 @@ class CoberturaParserTest extends AnyWordSpec with BeforeAndAfterAll with Matche "not crash on thousands separators" in { val reader = - CoberturaParser.parse(new File("."), new File("coverage-parser/src/test/resources/thousand_sep_cobertura.xml")) + CoberturaParser.parse(new File("."), new File("src/test/resources/thousand_sep_cobertura.xml")) val testReport = CoverageReport( List( CoverageFileReport( - "coverage-parser/src/test/resources/TestSourceFile.scala", + "src/test/resources/TestSourceFile.scala", Map(5 -> 1, 10 -> 1, 6 -> 2, 9 -> 1, 9 -> 0, 8 -> 1, 4 -> 1) ), - CoverageFileReport("coverage-parser/src/test/resources/TestSourceFile2.scala", Map(1 -> 1, 2 -> 1, 3 -> 1)), + CoverageFileReport("src/test/resources/TestSourceFile2.scala", Map(1 -> 1, 2 -> 1, 3 -> 1)), ) ) @@ -59,15 +59,15 @@ class CoberturaParserTest extends AnyWordSpec with BeforeAndAfterAll with Matche "return a valid report with windows file path separator" in { val reader = - CoberturaParser.parse(new File("."), new File("coverage-parser/src/test/resources/windows_paths_cobertura.xml")) + CoberturaParser.parse(new File("."), new File("src/test/resources/windows_paths_cobertura.xml")) val testReport = CoverageReport( List( CoverageFileReport( - "coverage-parser/src/test/resources/TestSourceFile.scala", + "src/test/resources/TestSourceFile.scala", Map(5 -> 1, 10 -> 1, 6 -> 2, 9 -> 1, 3 -> 0, 4 -> 1) ), - CoverageFileReport("coverage-parser/src/test/resources/TestSourceFile2.scala", Map(1 -> 1, 2 -> 1, 3 -> 1)), + CoverageFileReport("src/test/resources/TestSourceFile2.scala", Map(1 -> 1, 2 -> 1, 3 -> 1)), ) ) diff --git a/src/test/scala/com/codacy/parsers/CoverageParserFactoryTest.scala b/src/test/scala/com/codacy/parsers/CoverageParserFactoryTest.scala index 1db73310..d63bd864 100644 --- a/src/test/scala/com/codacy/parsers/CoverageParserFactoryTest.scala +++ b/src/test/scala/com/codacy/parsers/CoverageParserFactoryTest.scala @@ -15,15 +15,15 @@ class CoverageParserFactoryTest extends AnyWordSpec with BeforeAndAfterAll with val expectedReport = CoverageReport( List( CoverageFileReport( - "coverage-parser/src/test/resources/TestSourceFile.scala", + "src/test/resources/TestSourceFile.scala", Map(5 -> 1, 10 -> 1, 6 -> 2, 9 -> 1, 3 -> 0, 4 -> 1, 7 -> 1, 8 -> 3, 9 -> Int.MaxValue) ), - CoverageFileReport("coverage-parser/src/test/resources/TestSourceFile2.scala", Map(1 -> 1, 2 -> 1, 3 -> 1)) + CoverageFileReport("src/test/resources/TestSourceFile2.scala", Map(1 -> 1, 2 -> 1, 3 -> 1)) ) ) CoverageParser - .parse(new File("."), new File("coverage-parser/src/test/resources/test_cobertura.xml")) shouldEqual Right( + .parse(new File("."), new File("src/test/resources/test_cobertura.xml")) shouldEqual Right( expectedReport ) } @@ -40,7 +40,7 @@ class CoverageParserFactoryTest extends AnyWordSpec with BeforeAndAfterAll with ) CoverageParser - .parse(new File("."), new File("coverage-parser/src/test/resources/test_jacoco.xml")) shouldEqual Right( + .parse(new File("."), new File("src/test/resources/test_jacoco.xml")) shouldEqual Right( expectedReport ) } diff --git a/src/test/scala/com/codacy/parsers/CoverageParserTest.scala b/src/test/scala/com/codacy/parsers/CoverageParserTest.scala index e0759f8b..acc4485d 100644 --- a/src/test/scala/com/codacy/parsers/CoverageParserTest.scala +++ b/src/test/scala/com/codacy/parsers/CoverageParserTest.scala @@ -8,8 +8,8 @@ import org.scalatest.wordspec.AnyWordSpec import org.scalatest.matchers.should.Matchers class CoverageParserTest extends AnyWordSpec with BeforeAndAfterAll with Matchers with EitherValues { - private val coberturaReportPath = "coverage-parser/src/test/resources/test_cobertura.xml" - private val cloverReportPath = "coverage-parser/src/test/resources/test_clover.xml" + private val coberturaReportPath = "src/test/resources/test_cobertura.xml" + private val cloverReportPath = "src/test/resources/test_clover.xml" "parse" should { "return the specific error" when { diff --git a/src/test/scala/com/codacy/parsers/DotCoverParserTest.scala b/src/test/scala/com/codacy/parsers/DotCoverParserTest.scala index 3ebd3d35..66830f26 100644 --- a/src/test/scala/com/codacy/parsers/DotCoverParserTest.scala +++ b/src/test/scala/com/codacy/parsers/DotCoverParserTest.scala @@ -9,9 +9,9 @@ import org.scalatest.wordspec.AnyWordSpec import org.scalatest.matchers.should.Matchers class DotCoverParserTest extends AnyWordSpec with BeforeAndAfterAll with Matchers with EitherValues { - private val nonExistentFile = "coverage-parser/src/test/resources/non-existent.xml" - private val dotCoverReport = "coverage-parser/src/test/resources/test_dotcover.xml" - private val differentFormatReport = "coverage-parser/src/test/resources/test_cobertura.xml" + private val nonExistentFile = "src/test/resources/non-existent.xml" + private val dotCoverReport = "src/test/resources/test_dotcover.xml" + private val differentFormatReport = "src/test/resources/test_cobertura.xml" "parse" should { "return an invalid report" when { "report file does not exist" in { diff --git a/src/test/scala/com/codacy/parsers/GoParserTest.scala b/src/test/scala/com/codacy/parsers/GoParserTest.scala index 90832201..47391c61 100644 --- a/src/test/scala/com/codacy/parsers/GoParserTest.scala +++ b/src/test/scala/com/codacy/parsers/GoParserTest.scala @@ -17,7 +17,7 @@ class GoParserTest extends AnyWordSpec with Matchers with EitherValues { "the report file does not exist" in { // Arrange - val nonExistentReportPath = "coverage-parser/src/test/resources/non-existent.xml" + val nonExistentReportPath = "src/test/resources/non-existent.xml" // Act val parseResult = GoParser.parse(new File("."), new File(nonExistentReportPath)) @@ -28,7 +28,7 @@ class GoParserTest extends AnyWordSpec with Matchers with EitherValues { } "return a valid report" in { - val reader = GoParser.parse(new File("."), new File("coverage-parser/src/test/resources/test_go.out")) + val reader = GoParser.parse(new File("."), new File("src/test/resources/test_go.out")) val testReport = CoverageReport( List( @@ -44,9 +44,9 @@ class GoParserTest extends AnyWordSpec with Matchers with EitherValues { "return consistent values" in { //given two reports where the package names were only changed, should return the same results COV-207 - val reader = GoParser.parse(new File("."), new File("coverage-parser/src/test/resources/go/original_package.out")) + val reader = GoParser.parse(new File("."), new File("src/test/resources/go/original_package.out")) val reader1 = - GoParser.parse(new File("."), new File("coverage-parser/src/test/resources/go/changed_package_name.out")) + GoParser.parse(new File("."), new File("src/test/resources/go/changed_package_name.out")) reader.value.fileReports(0).coverage should equal(reader1.value.fileReports(0).coverage) } diff --git a/src/test/scala/com/codacy/parsers/JacocoParserTest.scala b/src/test/scala/com/codacy/parsers/JacocoParserTest.scala index 408c93b6..fb84f2d2 100644 --- a/src/test/scala/com/codacy/parsers/JacocoParserTest.scala +++ b/src/test/scala/com/codacy/parsers/JacocoParserTest.scala @@ -14,20 +14,20 @@ class JacocoParserTest extends AnyWordSpec with BeforeAndAfterAll with Matchers "identify if report is invalid" in { val reader = - JacocoParser.parse(new File("."), new File("coverage-parser/src/test/resources/test_cobertura.xml")) + JacocoParser.parse(new File("."), new File("src/test/resources/test_cobertura.xml")) reader.isLeft shouldBe true } "identify if report is valid" in { val reader = - JacocoParser.parse(new File("."), new File("coverage-parser/src/test/resources/test_jacoco.xml")) + JacocoParser.parse(new File("."), new File("src/test/resources/test_jacoco.xml")) reader.isRight shouldBe true } "return a valid report" in { val reader = JacocoParser - .parse(new File("."), new File("coverage-parser/src/test/resources/test_jacoco.xml")) + .parse(new File("."), new File("src/test/resources/test_jacoco.xml")) val testReport = CoverageReport( List( diff --git a/src/test/scala/com/codacy/parsers/LCOVParserTest.scala b/src/test/scala/com/codacy/parsers/LCOVParserTest.scala index 8727a82b..2e2c77b0 100644 --- a/src/test/scala/com/codacy/parsers/LCOVParserTest.scala +++ b/src/test/scala/com/codacy/parsers/LCOVParserTest.scala @@ -13,33 +13,33 @@ class LCOVParserTest extends AnyWordSpec with BeforeAndAfterAll with Matchers wi "LCOVParser" should { "identify if report is invalid" in { - val reader = LCOVParser.parse(new File("."), new File("coverage-parser/src/test/resources/invalid_report.lcov")) + val reader = LCOVParser.parse(new File("."), new File("src/test/resources/invalid_report.lcov")) reader.isLeft shouldBe true } "identify if report is invalid beacuse is cobertura format" in { - val reader = LCOVParser.parse(new File("."), new File("coverage-parser/src/test/resources/test_cobertura.xml")) + val reader = LCOVParser.parse(new File("."), new File("src/test/resources/test_cobertura.xml")) reader.isLeft shouldBe true } "identify if report is invalid beacuse is clover format" in { - val reader = LCOVParser.parse(new File("."), new File("coverage-parser/src/test/resources/test_clover.xml")) + val reader = LCOVParser.parse(new File("."), new File("src/test/resources/test_clover.xml")) reader.isLeft shouldBe true } "identify if report is valid" in { - val reader = LCOVParser.parse(new File("."), new File("coverage-parser/src/test/resources/test_lcov.lcov")) + val reader = LCOVParser.parse(new File("."), new File("src/test/resources/test_lcov.lcov")) reader.isRight shouldBe true } "return a valid report" in { - val reader = LCOVParser.parse(new File("."), new File("coverage-parser/src/test/resources/test_lcov.lcov")) + val reader = LCOVParser.parse(new File("."), new File("src/test/resources/test_lcov.lcov")) val testReport = CoverageReport( List( - CoverageFileReport("coverage-parser/src/test/resources/TestSourceFile2.scala", Map(1 -> 1, 2 -> 1, 3 -> 1)), + CoverageFileReport("src/test/resources/TestSourceFile2.scala", Map(1 -> 1, 2 -> 1, 3 -> 1)), CoverageFileReport( - "coverage-parser/src/test/resources/TestSourceFile.scala", + "src/test/resources/TestSourceFile.scala", Map(3 -> 0, 4 -> 1, 5 -> 1, 6 -> 2) ) ) diff --git a/src/test/scala/com/codacy/parsers/OpenCoverParserTest.scala b/src/test/scala/com/codacy/parsers/OpenCoverParserTest.scala index c5bffd95..c86bb83a 100644 --- a/src/test/scala/com/codacy/parsers/OpenCoverParserTest.scala +++ b/src/test/scala/com/codacy/parsers/OpenCoverParserTest.scala @@ -9,9 +9,9 @@ import org.scalatest.wordspec.AnyWordSpec import org.scalatest.matchers.should.Matchers class OpenCoverParserTest extends AnyWordSpec with BeforeAndAfterAll with Matchers with EitherValues { - private val openCoverReportPath = "coverage-parser/src/test/resources/test_opencover.xml" - private val nonExistentReportPath = "coverage-parser/src/test/resources/non_existent.xml" - private val coberturaReportPath = "coverage-parser/src/test/resources/test_cobertura.xml" + private val openCoverReportPath = "src/test/resources/test_opencover.xml" + private val nonExistentReportPath = "src/test/resources/non_existent.xml" + private val coberturaReportPath = "src/test/resources/test_cobertura.xml" "parse" should { "return an invalid report" when { "report file does not exist" in { diff --git a/src/test/scala/com/codacy/parsers/PhpUnitXmlParserTest.scala b/src/test/scala/com/codacy/parsers/PhpUnitXmlParserTest.scala index ad4100cb..e2a41d56 100644 --- a/src/test/scala/com/codacy/parsers/PhpUnitXmlParserTest.scala +++ b/src/test/scala/com/codacy/parsers/PhpUnitXmlParserTest.scala @@ -9,10 +9,10 @@ import org.scalatest.matchers.should.Matchers class PhpUnitXmlParserTest extends AnyWordSpec with BeforeAndAfterAll with Matchers with EitherValues { private val rootPath = "/home/codacy-php/" - private val validReport = "coverage-parser/src/test/resources/phpunitxml/index.xml" - private val incorrectReport = "coverage-parser/src/test/resources/phpunitxml/incorrect_index.xml" - private val coberturaReport = "coverage-parser/src/test/resources/test_cobertura.xml" - private val nonExistentReport = "coverage-parser/src/test/resources/non_existent_file.xml" + private val validReport = "src/test/resources/phpunitxml/index.xml" + private val incorrectReport = "src/test/resources/phpunitxml/incorrect_index.xml" + private val coberturaReport = "src/test/resources/test_cobertura.xml" + private val nonExistentReport = "src/test/resources/non_existent_file.xml" private val configPhpFile = "Config.php" "parse" should { From 7ed93f451cf68709295a73246c80219ea32cd823 Mon Sep 17 00:00:00 2001 From: Lorenzo Gabriele Date: Fri, 14 Jun 2024 18:02:09 +0200 Subject: [PATCH 3/4] fix: Scalafmt --- .../com/codacy/parsers/CoverageParserFactoryTest.scala | 8 ++------ src/test/scala/com/codacy/parsers/LCOVParserTest.scala | 5 +---- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/test/scala/com/codacy/parsers/CoverageParserFactoryTest.scala b/src/test/scala/com/codacy/parsers/CoverageParserFactoryTest.scala index d63bd864..044bbd9e 100644 --- a/src/test/scala/com/codacy/parsers/CoverageParserFactoryTest.scala +++ b/src/test/scala/com/codacy/parsers/CoverageParserFactoryTest.scala @@ -23,9 +23,7 @@ class CoverageParserFactoryTest extends AnyWordSpec with BeforeAndAfterAll with ) CoverageParser - .parse(new File("."), new File("src/test/resources/test_cobertura.xml")) shouldEqual Right( - expectedReport - ) + .parse(new File("."), new File("src/test/resources/test_cobertura.xml")) shouldEqual Right(expectedReport) } "get report with jacoco parser" in { @@ -40,9 +38,7 @@ class CoverageParserFactoryTest extends AnyWordSpec with BeforeAndAfterAll with ) CoverageParser - .parse(new File("."), new File("src/test/resources/test_jacoco.xml")) shouldEqual Right( - expectedReport - ) + .parse(new File("."), new File("src/test/resources/test_jacoco.xml")) shouldEqual Right(expectedReport) } "fail to get invalid report" in { diff --git a/src/test/scala/com/codacy/parsers/LCOVParserTest.scala b/src/test/scala/com/codacy/parsers/LCOVParserTest.scala index 2e2c77b0..357ff7c8 100644 --- a/src/test/scala/com/codacy/parsers/LCOVParserTest.scala +++ b/src/test/scala/com/codacy/parsers/LCOVParserTest.scala @@ -38,10 +38,7 @@ class LCOVParserTest extends AnyWordSpec with BeforeAndAfterAll with Matchers wi val testReport = CoverageReport( List( CoverageFileReport("src/test/resources/TestSourceFile2.scala", Map(1 -> 1, 2 -> 1, 3 -> 1)), - CoverageFileReport( - "src/test/resources/TestSourceFile.scala", - Map(3 -> 0, 4 -> 1, 5 -> 1, 6 -> 2) - ) + CoverageFileReport("src/test/resources/TestSourceFile.scala", Map(3 -> 0, 4 -> 1, 5 -> 1, 6 -> 2)) ) ) From a56d6379f8418caa104c08c62ff82e42d66bd88e Mon Sep 17 00:00:00 2001 From: Lorenzo Gabriele Date: Fri, 14 Jun 2024 18:12:33 +0200 Subject: [PATCH 4/4] fix: Fix tests --- src/test/resources/test-paths-with-different-paths.xml | 4 ++-- src/test/resources/windows_paths_cobertura.xml | 6 +++--- src/test/scala/com/codacy/parsers/CoberturaParserTest.scala | 6 +++--- .../com/codacy/parsers/CoverageParserFactoryTest.scala | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/test/resources/test-paths-with-different-paths.xml b/src/test/resources/test-paths-with-different-paths.xml index dc072ff7..7f683b6b 100644 --- a/src/test/resources/test-paths-with-different-paths.xml +++ b/src/test/resources/test-paths-with-different-paths.xml @@ -2,7 +2,7 @@ - + @@ -11,7 +11,7 @@ - + diff --git a/src/test/resources/windows_paths_cobertura.xml b/src/test/resources/windows_paths_cobertura.xml index fc6e3474..eef3a1d2 100644 --- a/src/test/resources/windows_paths_cobertura.xml +++ b/src/test/resources/windows_paths_cobertura.xml @@ -2,7 +2,7 @@ - + @@ -11,14 +11,14 @@ - + - + diff --git a/src/test/scala/com/codacy/parsers/CoberturaParserTest.scala b/src/test/scala/com/codacy/parsers/CoberturaParserTest.scala index d2d03a91..4b6cc6dd 100644 --- a/src/test/scala/com/codacy/parsers/CoberturaParserTest.scala +++ b/src/test/scala/com/codacy/parsers/CoberturaParserTest.scala @@ -29,11 +29,11 @@ class CoberturaParserTest extends AnyWordSpec with BeforeAndAfterAll with Matche val testReport = CoverageReport( List( + CoverageFileReport("src/test/resources/TestSourceFile2.scala", Map(1 -> 1, 2 -> 1, 3 -> 1)), CoverageFileReport( "src/test/resources/TestSourceFile.scala", Map(5 -> 1, 10 -> 1, 6 -> 2, 9 -> Int.MaxValue, 3 -> 0, 4 -> 1, 7 -> 1, 8 -> 3) - ), - CoverageFileReport("src/test/resources/TestSourceFile2.scala", Map(1 -> 1, 2 -> 1, 3 -> 1)), + ) ) ) @@ -46,11 +46,11 @@ class CoberturaParserTest extends AnyWordSpec with BeforeAndAfterAll with Matche val testReport = CoverageReport( List( + CoverageFileReport("src/test/resources/TestSourceFile2.scala", Map(1 -> 1, 2 -> 1, 3 -> 1)), CoverageFileReport( "src/test/resources/TestSourceFile.scala", Map(5 -> 1, 10 -> 1, 6 -> 2, 9 -> 1, 9 -> 0, 8 -> 1, 4 -> 1) ), - CoverageFileReport("src/test/resources/TestSourceFile2.scala", Map(1 -> 1, 2 -> 1, 3 -> 1)), ) ) diff --git a/src/test/scala/com/codacy/parsers/CoverageParserFactoryTest.scala b/src/test/scala/com/codacy/parsers/CoverageParserFactoryTest.scala index 044bbd9e..15c4021f 100644 --- a/src/test/scala/com/codacy/parsers/CoverageParserFactoryTest.scala +++ b/src/test/scala/com/codacy/parsers/CoverageParserFactoryTest.scala @@ -14,11 +14,11 @@ class CoverageParserFactoryTest extends AnyWordSpec with BeforeAndAfterAll with "get report with unspecified parser" in { val expectedReport = CoverageReport( List( + CoverageFileReport("src/test/resources/TestSourceFile2.scala", Map(1 -> 1, 2 -> 1, 3 -> 1)), CoverageFileReport( "src/test/resources/TestSourceFile.scala", Map(5 -> 1, 10 -> 1, 6 -> 2, 9 -> 1, 3 -> 0, 4 -> 1, 7 -> 1, 8 -> 3, 9 -> Int.MaxValue) - ), - CoverageFileReport("src/test/resources/TestSourceFile2.scala", Map(1 -> 1, 2 -> 1, 3 -> 1)) + ) ) )