Skip to content

Commit

Permalink
Merge pull request #548 from jozic/properly-handle-multiple-exclude-e…
Browse files Browse the repository at this point in the history
…ntries-for-scala3

Properly handle multiple exclude entries for Scala 3
  • Loading branch information
rolandtritsch authored Aug 21, 2024
2 parents 9a0b190 + c3211b8 commit 162ef11
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/scala/scoverage/ScoverageSbtPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,15 @@ object ScoverageSbtPlugin extends AutoPlugin {
if isScala3SupportingFilePackageExclusion(
scalaVersion.value
) =>
s"-coverage-exclude-classlikes:$v"
s"-coverage-exclude-classlikes:${v.replace(';', ',')}"
},
excludedFiles
.collect {
case v
if isScala3SupportingFilePackageExclusion(
scalaVersion.value
) =>
s"-coverage-exclude-files:$v"
s"-coverage-exclude-files:${v.replace(';', ',')}"
}
).flatten
} else if (coverageEnabled.value && !isScala2(scalaVersion.value)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ scalaVersion := "3.4.2"

libraryDependencies += "org.scalameta" %% "munit" % "0.7.29" % Test

coverageExcludedFiles := ".*/two/GoodCoverage"
coverageExcludedFiles := ".*/two/GoodCoverage;.*/three/GoodCoverage"

resolvers ++= {
if (sys.props.get("plugin.version").exists(_.endsWith("-SNAPSHOT")))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package three

object GoodCoverage {

def sum(num1: Int, num2: Int) = {
if (0 == num1) num2 else if (0 == num2) num1 else num1 + num2
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ scalaVersion := "3.4.2"

libraryDependencies += "org.scalameta" %% "munit" % "0.7.29" % Test

coverageExcludedPackages := "two\\..*"
coverageExcludedPackages := "two\\..*;three\\..*"

resolvers ++= {
if (sys.props.get("plugin.version").exists(_.endsWith("-SNAPSHOT")))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package three

object GoodCoverage {

def sum(num1: Int, num2: Int) = {
if (0 == num1) num2 else if (0 == num2) num1 else num1 + num2
}

}

0 comments on commit 162ef11

Please sign in to comment.