├── project ├── build.properties └── plugins.sbt ├── src ├── sbt-test │ └── sbt-sonar │ │ ├── sbt-1.0 │ │ ├── project │ │ │ ├── build.properties │ │ │ └── plugins.sbt │ │ ├── src │ │ │ ├── main │ │ │ │ └── scala │ │ │ │ │ └── Example.scala │ │ │ └── test │ │ │ │ └── scala │ │ │ │ └── ExampleTest.scala │ │ ├── build.sbt │ │ └── test │ │ ├── multi-module │ │ ├── project │ │ │ ├── build.properties │ │ │ └── plugins.sbt │ │ ├── src │ │ │ ├── main │ │ │ │ └── scala │ │ │ │ │ └── Example.scala │ │ │ └── test │ │ │ │ └── scala │ │ │ │ └── ExampleTest.scala │ │ ├── module1 │ │ │ └── src │ │ │ │ ├── main │ │ │ │ └── scala │ │ │ │ │ └── Example1.scala │ │ │ │ └── test │ │ │ │ └── scala │ │ │ │ └── Example1Test.scala │ │ ├── module2 │ │ │ └── src │ │ │ │ ├── main │ │ │ │ └── scala │ │ │ │ │ └── Example2.scala │ │ │ │ └── test │ │ │ │ └── scala │ │ │ │ └── Example2Test.scala │ │ ├── test │ │ └── build.sbt │ │ ├── sbt-0.13 │ │ ├── project │ │ │ ├── build.properties │ │ │ └── plugins.sbt │ │ ├── src │ │ │ ├── main │ │ │ │ └── scala │ │ │ │ │ └── Example.scala │ │ │ └── test │ │ │ │ └── scala │ │ │ │ └── ExampleTest.scala │ │ ├── build.sbt │ │ └── test │ │ ├── scala-2.11 │ │ ├── project │ │ │ ├── build.properties │ │ │ └── plugins.sbt │ │ ├── src │ │ │ ├── main │ │ │ │ └── scala │ │ │ │ │ └── Example.scala │ │ │ └── test │ │ │ │ └── scala │ │ │ │ └── ExampleTest.scala │ │ ├── build.sbt │ │ └── test │ │ ├── external-config │ │ ├── project │ │ │ ├── build.properties │ │ │ └── plugins.sbt │ │ ├── src │ │ │ ├── main │ │ │ │ └── scala │ │ │ │ │ └── Example.scala │ │ │ └── test │ │ │ │ └── scala │ │ │ │ └── ExampleTest.scala │ │ ├── test │ │ ├── build.sbt │ │ └── sonar-project.properties │ │ ├── independent-projects │ │ ├── project │ │ │ ├── build.properties │ │ │ └── plugins.sbt │ │ ├── src │ │ │ ├── main │ │ │ │ └── scala │ │ │ │ │ └── Example.scala │ │ │ └── test │ │ │ │ └── scala │ │ │ │ └── ExampleTest.scala │ │ ├── test-1 │ │ │ └── module1 │ │ │ │ └── src │ │ │ │ ├── main │ │ │ │ └── scala │ │ │ │ │ └── Example1.scala │ │ │ │ └── test │ │ │ │ └── scala │ │ │ │ └── Example1Test.scala │ │ ├── test-2 │ │ │ └── module2 │ │ │ │ └── src │ │ │ │ ├── main │ │ │ │ └── scala │ │ │ │ │ └── Example2.scala │ │ │ │ └── test │ │ │ │ └── scala │ │ │ │ └── Example2Test.scala │ │ ├── test │ │ └── build.sbt │ │ ├── multi-module-not-on-root │ │ ├── project │ │ │ ├── build.properties │ │ │ └── plugins.sbt │ │ ├── src │ │ │ ├── main │ │ │ │ └── scala │ │ │ │ │ └── Example.scala │ │ │ └── test │ │ │ │ └── scala │ │ │ │ └── ExampleTest.scala │ │ ├── test-1 │ │ │ └── module1 │ │ │ │ └── src │ │ │ │ ├── main │ │ │ │ └── scala │ │ │ │ │ └── Example1.scala │ │ │ │ └── test │ │ │ │ └── scala │ │ │ │ └── Example1Test.scala │ │ ├── test-2 │ │ │ └── module2 │ │ │ │ └── src │ │ │ │ ├── main │ │ │ │ └── scala │ │ │ │ │ └── Example2.scala │ │ │ │ └── test │ │ │ │ └── scala │ │ │ │ └── Example2Test.scala │ │ ├── test │ │ └── build.sbt │ │ └── multi-module-not-on-root-with-correct-config │ │ ├── project │ │ ├── build.properties │ │ └── plugins.sbt │ │ ├── src │ │ ├── main │ │ │ └── scala │ │ │ │ └── Example.scala │ │ └── test │ │ │ └── scala │ │ │ └── ExampleTest.scala │ │ ├── test-1 │ │ └── module1 │ │ │ └── src │ │ │ ├── main │ │ │ └── scala │ │ │ │ └── Example1.scala │ │ │ └── test │ │ │ └── scala │ │ │ └── Example1Test.scala │ │ ├── test-2 │ │ └── module2 │ │ │ └── src │ │ │ ├── main │ │ │ └── scala │ │ │ │ └── Example2.scala │ │ │ └── test │ │ │ └── scala │ │ │ └── Example2Test.scala │ │ ├── test │ │ └── build.sbt ├── main │ ├── scala-sbt-0.13 │ │ └── sbtsonar │ │ │ └── SbtCompat.scala │ ├── scala-sbt-1.0 │ │ └── sbtsonar │ │ │ └── SbtCompat.scala │ └── scala │ │ └── sbtsonar │ │ ├── SonarSbtLogOutput.scala │ │ └── SonarPlugin.scala └── test │ └── scala │ └── sbtsonar │ ├── WithFile.scala │ └── SonarPluginTest.scala ├── .gitignore ├── .scalafix.conf ├── .github └── workflows │ ├── test.yml │ └── release.yml ├── .scalafmt.conf ├── README.md ├── .circleci └── config.yml └── LICENSE /project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=1.5.2 2 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/sbt-1.0/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=1.5.0 2 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=1.5.0 2 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/sbt-0.13/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=0.13.16 2 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/scala-2.11/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=0.13.16 2 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/external-config/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=1.5.0 2 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/independent-projects/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=1.5.0 2 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module-not-on-root/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=1.5.0 2 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module-not-on-root-with-correct-config/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=1.5.0 2 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/sbt-0.13/src/main/scala/Example.scala: -------------------------------------------------------------------------------- 1 | object Example { 2 | def sum(a: Int, b: Int) = a + b 3 | } 4 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/sbt-1.0/src/main/scala/Example.scala: -------------------------------------------------------------------------------- 1 | object Example { 2 | def sum(a: Int, b: Int) = a + b 3 | } 4 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/scala-2.11/src/main/scala/Example.scala: -------------------------------------------------------------------------------- 1 | object Example { 2 | def sum(a: Int, b: Int) = a + b 3 | } 4 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/external-config/src/main/scala/Example.scala: -------------------------------------------------------------------------------- 1 | object Example { 2 | def sum(a: Int, b: Int) = a + b 3 | } 4 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module/src/main/scala/Example.scala: -------------------------------------------------------------------------------- 1 | object Example { 2 | def sum(a: Int, b: Int) = a + b 3 | } 4 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/independent-projects/src/main/scala/Example.scala: -------------------------------------------------------------------------------- 1 | object Example { 2 | def sum(a: Int, b: Int) = a + b 3 | } 4 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module-not-on-root/src/main/scala/Example.scala: -------------------------------------------------------------------------------- 1 | object Example { 2 | def sum(a: Int, b: Int) = a + b 3 | } 4 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module/module1/src/main/scala/Example1.scala: -------------------------------------------------------------------------------- 1 | object Example1 { 2 | def sum(a: Int, b: Int) = a + b 3 | } 4 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module/module2/src/main/scala/Example2.scala: -------------------------------------------------------------------------------- 1 | object Example2 { 2 | def sum(a: Int, b: Int) = a + b 3 | } 4 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/independent-projects/test-1/module1/src/main/scala/Example1.scala: -------------------------------------------------------------------------------- 1 | object Example1 { 2 | def sum(a: Int, b: Int) = a + b 3 | } 4 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/independent-projects/test-2/module2/src/main/scala/Example2.scala: -------------------------------------------------------------------------------- 1 | object Example2 { 2 | def sum(a: Int, b: Int) = a + b 3 | } 4 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module-not-on-root/test-1/module1/src/main/scala/Example1.scala: -------------------------------------------------------------------------------- 1 | object Example1 { 2 | def sum(a: Int, b: Int) = a + b 3 | } 4 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module-not-on-root/test-2/module2/src/main/scala/Example2.scala: -------------------------------------------------------------------------------- 1 | object Example2 { 2 | def sum(a: Int, b: Int) = a + b 3 | } 4 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module-not-on-root-with-correct-config/src/main/scala/Example.scala: -------------------------------------------------------------------------------- 1 | object Example { 2 | def sum(a: Int, b: Int) = a + b 3 | } 4 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module-not-on-root-with-correct-config/test-1/module1/src/main/scala/Example1.scala: -------------------------------------------------------------------------------- 1 | object Example1 { 2 | def sum(a: Int, b: Int) = a + b 3 | } 4 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module-not-on-root-with-correct-config/test-2/module2/src/main/scala/Example2.scala: -------------------------------------------------------------------------------- 1 | object Example2 { 2 | def sum(a: Int, b: Int) = a + b 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # sbt 2 | .cache 3 | dist 4 | target 5 | 6 | # IDE 7 | .idea 8 | .vscode 9 | 10 | # metals 11 | .bloop 12 | .bsp 13 | .metals 14 | metals.sbt 15 | 16 | # Other 17 | *.log 18 | *.orig 19 | .scannerwork 20 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/sbt-0.13/src/test/scala/ExampleTest.scala: -------------------------------------------------------------------------------- 1 | import org.scalatest._ 2 | 3 | class ExampleTest extends FlatSpec with Matchers { 4 | "Example" should "sum two numbers" in { 5 | Example.sum(1, 5) shouldBe 6 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/sbt-1.0/src/test/scala/ExampleTest.scala: -------------------------------------------------------------------------------- 1 | import org.scalatest._ 2 | 3 | class ExampleTest extends FlatSpec with Matchers { 4 | "Example" should "sum two numbers" in { 5 | Example.sum(1, 5) shouldBe 6 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module/module2/src/test/scala/Example2Test.scala: -------------------------------------------------------------------------------- 1 | import org.scalatest._ 2 | 3 | class Example2Test extends FlatSpec with Matchers { 4 | "Example2" should "sum two numbers" in { 5 | // No coverage! 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module/src/test/scala/ExampleTest.scala: -------------------------------------------------------------------------------- 1 | import org.scalatest._ 2 | 3 | class ExampleTest extends FlatSpec with Matchers { 4 | "Example" should "sum two numbers" in { 5 | Example.sum(1, 5) shouldBe 6 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/sbt-0.13/build.sbt: -------------------------------------------------------------------------------- 1 | name := "sbt-0.13" 2 | 3 | version := "0.1" 4 | 5 | scalaVersion := "2.12.4" 6 | 7 | scapegoatVersion := "1.3.3" 8 | 9 | libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.4" % "test" 10 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/sbt-1.0/build.sbt: -------------------------------------------------------------------------------- 1 | name := "sbt-1.0" 2 | 3 | version := "0.1" 4 | 5 | scalaVersion := "2.12.4" 6 | 7 | scapegoatVersion in ThisBuild := "1.3.3" 8 | 9 | libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.4" % "test" -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/scala-2.11/src/test/scala/ExampleTest.scala: -------------------------------------------------------------------------------- 1 | import org.scalatest._ 2 | 3 | class ExampleTest extends FlatSpec with Matchers { 4 | "Example" should "sum two numbers" in { 5 | Example.sum(1, 5) shouldBe 6 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/external-config/src/test/scala/ExampleTest.scala: -------------------------------------------------------------------------------- 1 | import org.scalatest._ 2 | 3 | class ExampleTest extends FlatSpec with Matchers { 4 | "Example" should "sum two numbers" in { 5 | Example.sum(1, 5) shouldBe 6 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module-not-on-root/test: -------------------------------------------------------------------------------- 1 | # Test against sbt 1.0 & scala 2.12. 2 | # Runs scoverage, scapegoat & sonarScan. 3 | 4 | > clean 5 | > coverage 6 | > test 7 | > coverageReport 8 | > coverageOff 9 | > scapegoat 10 | -> sonarScan -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/scala-2.11/build.sbt: -------------------------------------------------------------------------------- 1 | name := "scala-2.11" 2 | 3 | version := "0.1" 4 | 5 | scalaVersion := "2.11.11" 6 | 7 | scapegoatVersion := "1.3.3" 8 | 9 | libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.4" % "test" 10 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/independent-projects/src/test/scala/ExampleTest.scala: -------------------------------------------------------------------------------- 1 | import org.scalatest._ 2 | 3 | class ExampleTest extends FlatSpec with Matchers { 4 | "Example" should "sum two numbers" in { 5 | Example.sum(1, 5) shouldBe 6 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/independent-projects/test-2/module2/src/test/scala/Example2Test.scala: -------------------------------------------------------------------------------- 1 | import org.scalatest._ 2 | 3 | class Example2Test extends FlatSpec with Matchers { 4 | "Example2" should "sum two numbers" in { 5 | // No coverage! 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module-not-on-root/src/test/scala/ExampleTest.scala: -------------------------------------------------------------------------------- 1 | import org.scalatest._ 2 | 3 | class ExampleTest extends FlatSpec with Matchers { 4 | "Example" should "sum two numbers" in { 5 | Example.sum(1, 5) shouldBe 6 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module/module1/src/test/scala/Example1Test.scala: -------------------------------------------------------------------------------- 1 | import org.scalatest._ 2 | 3 | class Example1Test extends FlatSpec with Matchers { 4 | "Example1" should "sum two numbers" in { 5 | Example1.sum(1, 5) shouldBe 6 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module-not-on-root/test-2/module2/src/test/scala/Example2Test.scala: -------------------------------------------------------------------------------- 1 | import org.scalatest._ 2 | 3 | class Example2Test extends FlatSpec with Matchers { 4 | "Example2" should "sum two numbers" in { 5 | // No coverage! 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/independent-projects/test-1/module1/src/test/scala/Example1Test.scala: -------------------------------------------------------------------------------- 1 | import org.scalatest._ 2 | 3 | class Example1Test extends FlatSpec with Matchers { 4 | "Example1" should "sum two numbers" in { 5 | Example1.sum(1, 5) shouldBe 6 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module-not-on-root/test-1/module1/src/test/scala/Example1Test.scala: -------------------------------------------------------------------------------- 1 | import org.scalatest._ 2 | 3 | class Example1Test extends FlatSpec with Matchers { 4 | "Example1" should "sum two numbers" in { 5 | Example1.sum(1, 5) shouldBe 6 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /project/plugins.sbt: -------------------------------------------------------------------------------- 1 | addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7") 2 | addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") 3 | addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2") 4 | addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.7") 5 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module-not-on-root-with-correct-config/src/test/scala/ExampleTest.scala: -------------------------------------------------------------------------------- 1 | import org.scalatest._ 2 | 3 | class ExampleTest extends FlatSpec with Matchers { 4 | "Example" should "sum two numbers" in { 5 | Example.sum(1, 5) shouldBe 6 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module-not-on-root-with-correct-config/test-2/module2/src/test/scala/Example2Test.scala: -------------------------------------------------------------------------------- 1 | import org.scalatest._ 2 | 3 | class Example2Test extends FlatSpec with Matchers { 4 | "Example2" should "sum two numbers" in { 5 | // No coverage! 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/sbt-0.13/test: -------------------------------------------------------------------------------- 1 | # Test against sbt 0.13 & scala 2.12. 2 | # Runs scoverage, scapegoat & sonarScan. 3 | 4 | > clean 5 | > coverage 6 | > test 7 | > coverageReport 8 | > coverageOff 9 | > scapegoat 10 | > sonarScan 11 | $ exists .scannerwork/report-task.txt 12 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/sbt-1.0/test: -------------------------------------------------------------------------------- 1 | # Test against sbt 1.0 & scala 2.12. 2 | # Runs scoverage, scapegoat & sonarScan. 3 | 4 | > clean 5 | > coverage 6 | > test 7 | > coverageReport 8 | > coverageOff 9 | > scapegoat 10 | > sonarScan 11 | $ exists .scannerwork/report-task.txt 12 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/scala-2.11/test: -------------------------------------------------------------------------------- 1 | # Test against sbt 0.13 & scala 2.11. 2 | # Runs scoverage, scapegoat & sonarScan. 3 | 4 | > clean 5 | > coverage 6 | > test 7 | > coverageReport 8 | > coverageOff 9 | > scapegoat 10 | > sonarScan 11 | $ exists .scannerwork/report-task.txt 12 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/external-config/test: -------------------------------------------------------------------------------- 1 | # Test against sbt 1.0 & scala 2.12. 2 | # Runs scoverage, scapegoat & sonarScan. 3 | 4 | > clean 5 | > coverage 6 | > test 7 | > coverageReport 8 | > coverageOff 9 | > scapegoat 10 | > sonarScan 11 | $ exists .scannerwork/report-task.txt 12 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module/test: -------------------------------------------------------------------------------- 1 | # Test against sbt 1.0 & scala 2.12. 2 | # Runs scoverage, scapegoat & sonarScan. 3 | 4 | > clean 5 | > coverage 6 | > test 7 | > coverageReport 8 | > coverageOff 9 | > scapegoat 10 | > sonarScan 11 | $ exists .scannerwork/report-task.txt 12 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/independent-projects/test: -------------------------------------------------------------------------------- 1 | # Test against sbt 1.0 & scala 2.12. 2 | # Runs scoverage, scapegoat & sonarScan. 3 | 4 | > clean 5 | > coverage 6 | > test 7 | > coverageReport 8 | > coverageOff 9 | > scapegoat 10 | > sonarScan 11 | $ exists .scannerwork/report-task.txt 12 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module-not-on-root-with-correct-config/test-1/module1/src/test/scala/Example1Test.scala: -------------------------------------------------------------------------------- 1 | import org.scalatest._ 2 | 3 | class Example1Test extends FlatSpec with Matchers { 4 | "Example1" should "sum two numbers" in { 5 | Example1.sum(1, 5) shouldBe 6 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module-not-on-root-with-correct-config/test: -------------------------------------------------------------------------------- 1 | # Test against sbt 1.0 & scala 2.12. 2 | # Runs scoverage, scapegoat & sonarScan. 3 | 4 | > clean 5 | > coverage 6 | > test 7 | > coverageReport 8 | > coverageOff 9 | > scapegoat 10 | > sonarScan 11 | $ exists .scannerwork/report-task.txt -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/external-config/build.sbt: -------------------------------------------------------------------------------- 1 | import sbtsonar.SonarPlugin.autoImport.sonarUseExternalConfig 2 | 3 | name := "external-config" 4 | 5 | version := "0.1" 6 | 7 | scalaVersion := "2.12.4" 8 | 9 | scapegoatVersion in ThisBuild := "1.3.3" 10 | 11 | sonarUseExternalConfig := true 12 | 13 | libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.4" % "test" 14 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/external-config/sonar-project.properties: -------------------------------------------------------------------------------- 1 | sonar.projectName=external-config 2 | sonar.projectKey=external-config 3 | sonar.projectVersion=0 4 | sonar.sources=src/main/scala 5 | sonar.tests=src/test/scala 6 | sonar.sourceEncoding=UTF-8 7 | sonar.scala.version=2.12 8 | sonar.scala.scoverage.reportPath=target/scala-2.12/scoverage-report/scoverage.xml 9 | sonar.scala.scapegoat.reportPath=target/scala-2.12/scapegoat-report/scapegoat.xml 10 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/sbt-0.13/project/plugins.sbt: -------------------------------------------------------------------------------- 1 | val pluginVersion = sys.props.getOrElse( 2 | "plugin.version", 3 | throw new RuntimeException( 4 | """|The system property 'plugin.version' is not defined. 5 | |Specify this property using the scriptedLaunchOpts -D.""".stripMargin)) 6 | 7 | addSbtPlugin("com.sksamuel.scapegoat" %% "sbt-scapegoat" % "1.0.4") 8 | addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1") 9 | addSbtPlugin("com.github.mwz" % "sbt-sonar" % pluginVersion) 10 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/sbt-1.0/project/plugins.sbt: -------------------------------------------------------------------------------- 1 | val pluginVersion = sys.props.getOrElse( 2 | "plugin.version", 3 | throw new RuntimeException( 4 | """|The system property 'plugin.version' is not defined. 5 | |Specify this property using the scriptedLaunchOpts -D.""".stripMargin)) 6 | 7 | addSbtPlugin("com.sksamuel.scapegoat" %% "sbt-scapegoat" % "1.0.7") 8 | addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1") 9 | addSbtPlugin("com.sonar-scala" % "sbt-sonar" % pluginVersion) 10 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module/project/plugins.sbt: -------------------------------------------------------------------------------- 1 | val pluginVersion = sys.props.getOrElse( 2 | "plugin.version", 3 | throw new RuntimeException( 4 | """|The system property 'plugin.version' is not defined. 5 | |Specify this property using the scriptedLaunchOpts -D.""".stripMargin)) 6 | 7 | addSbtPlugin("com.sksamuel.scapegoat" %% "sbt-scapegoat" % "1.0.7") 8 | addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1") 9 | addSbtPlugin("com.sonar-scala" % "sbt-sonar" % pluginVersion) 10 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/scala-2.11/project/plugins.sbt: -------------------------------------------------------------------------------- 1 | val pluginVersion = sys.props.getOrElse( 2 | "plugin.version", 3 | throw new RuntimeException( 4 | """|The system property 'plugin.version' is not defined. 5 | |Specify this property using the scriptedLaunchOpts -D.""".stripMargin)) 6 | 7 | addSbtPlugin("com.sksamuel.scapegoat" %% "sbt-scapegoat" % "1.0.4") 8 | addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1") 9 | addSbtPlugin("com.github.mwz" % "sbt-sonar" % pluginVersion) 10 | -------------------------------------------------------------------------------- /.scalafix.conf: -------------------------------------------------------------------------------- 1 | rules = [ 2 | DisableSyntax, 3 | LeakingImplicitClassVal, 4 | NoAutoTupling, 5 | NoValInForComprehension, 6 | ProcedureSyntax, 7 | RemoveUnused, 8 | SortImports 9 | ] 10 | 11 | DisableSyntax.noVars = true 12 | DisableSyntax.noThrows = true 13 | DisableSyntax.noNulls = true 14 | DisableSyntax.noReturns = true 15 | DisableSyntax.noWhileLoops = true 16 | DisableSyntax.noFinalize = true 17 | DisableSyntax.noValPatterns = true 18 | SortImports.blocks = [ 19 | "java.", 20 | "scala.", 21 | "*" 22 | ] 23 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/external-config/project/plugins.sbt: -------------------------------------------------------------------------------- 1 | val pluginVersion = sys.props.getOrElse( 2 | "plugin.version", 3 | throw new RuntimeException( 4 | """|The system property 'plugin.version' is not defined. 5 | |Specify this property using the scriptedLaunchOpts -D.""".stripMargin)) 6 | 7 | addSbtPlugin("com.sksamuel.scapegoat" %% "sbt-scapegoat" % "1.0.7") 8 | addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1") 9 | addSbtPlugin("com.sonar-scala" % "sbt-sonar" % pluginVersion) 10 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/independent-projects/project/plugins.sbt: -------------------------------------------------------------------------------- 1 | val pluginVersion = sys.props.getOrElse( 2 | "plugin.version", 3 | throw new RuntimeException( 4 | """|The system property 'plugin.version' is not defined. 5 | |Specify this property using the scriptedLaunchOpts -D.""".stripMargin)) 6 | 7 | addSbtPlugin("com.sksamuel.scapegoat" %% "sbt-scapegoat" % "1.0.7") 8 | addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1") 9 | addSbtPlugin("com.sonar-scala" % "sbt-sonar" % pluginVersion) 10 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module-not-on-root/project/plugins.sbt: -------------------------------------------------------------------------------- 1 | val pluginVersion = sys.props.getOrElse( 2 | "plugin.version", 3 | throw new RuntimeException( 4 | """|The system property 'plugin.version' is not defined. 5 | |Specify this property using the scriptedLaunchOpts -D.""".stripMargin)) 6 | 7 | addSbtPlugin("com.sksamuel.scapegoat" %% "sbt-scapegoat" % "1.0.7") 8 | addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1") 9 | addSbtPlugin("com.sonar-scala" % "sbt-sonar" % pluginVersion) 10 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module-not-on-root-with-correct-config/project/plugins.sbt: -------------------------------------------------------------------------------- 1 | val pluginVersion = sys.props.getOrElse( 2 | "plugin.version", 3 | throw new RuntimeException( 4 | """|The system property 'plugin.version' is not defined. 5 | |Specify this property using the scriptedLaunchOpts -D.""".stripMargin)) 6 | 7 | addSbtPlugin("com.sksamuel.scapegoat" %% "sbt-scapegoat" % "1.0.7") 8 | addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1") 9 | addSbtPlugin("com.sonar-scala" % "sbt-sonar" % pluginVersion) 10 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | on: 3 | pull_request: 4 | jobs: 5 | test: 6 | name: Test 7 | runs-on: ubuntu-20.04 8 | steps: 9 | - uses: actions/checkout@v2 10 | - uses: olafurpg/setup-scala@v10 11 | with: 12 | java-version: adopt@1.8 13 | - uses: actions/cache@v1 14 | with: 15 | path: ~/.ivy2/cache 16 | key: ivy-${{hashFiles('**/*.sbt')}} 17 | restore-keys: | 18 | ivy- 19 | - uses: actions/cache@v1 20 | with: 21 | path: ~/.sbt 22 | key: sbt-${{hashFiles('**/*.sbt')}}-${{hashFiles('project/build.properties')}} 23 | restore-keys: | 24 | sbt- 25 | - run: sbt ^test 26 | -------------------------------------------------------------------------------- /.scalafmt.conf: -------------------------------------------------------------------------------- 1 | version = "2.7.5" 2 | align = some 3 | align { 4 | arrowEnumeratorGenerator = false 5 | ifWhileOpenParen = false 6 | openParenCallSite = false 7 | openParenDefnSite = false 8 | tokens.add = [ 9 | "%", 10 | "%%", 11 | "<-", 12 | {code = "=", owner = "Param"}, 13 | {code = "=>", owner = "Case"} 14 | ] 15 | } 16 | assumeStandardLibraryStripMargin = true 17 | continuationIndent.defnSite = 2 18 | continuationIndent.callSite = 2 19 | danglingParentheses = true 20 | docstrings = JavaDoc 21 | indentOperator = spray 22 | maxColumn = 110 23 | project { 24 | git = true 25 | excludeFilters = ["target"] 26 | } 27 | rewrite { 28 | rules = [PreferCurlyFors, RedundantBraces, SortImports] 29 | redundantBraces.maxLines = 1 30 | } 31 | spaces.inImportCurlyBraces = false 32 | unindentTopLevelOperators = true 33 | -------------------------------------------------------------------------------- /src/main/scala-sbt-0.13/sbtsonar/SbtCompat.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2021 All sbt-sonar contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package sbtsonar 18 | 19 | import scala.sys.process.ProcessBuilder 20 | 21 | object SbtCompat { 22 | val Logger = sbt.Logger 23 | val Using = sbt.Using 24 | 25 | def process(process: ProcessBuilder): Stream[String] = 26 | process.lines 27 | } 28 | -------------------------------------------------------------------------------- /src/main/scala-sbt-1.0/sbtsonar/SbtCompat.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2021 All sbt-sonar contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package sbtsonar 18 | 19 | import scala.sys.process.ProcessBuilder 20 | 21 | object SbtCompat { 22 | val Logger = sbt.util.Logger 23 | val Using = sbt.io.Using 24 | 25 | def process(process: ProcessBuilder): Stream[String] = 26 | process.lineStream 27 | } 28 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/independent-projects/build.sbt: -------------------------------------------------------------------------------- 1 | import sbtsonar.SonarPlugin.autoImport.sonarProperties 2 | import sbtsonar.SonarPlugin.autoImport.sonarScan 3 | 4 | lazy val baseSettings = Seq( 5 | version := "0.1", 6 | scalaVersion := "2.12.4", 7 | scapegoatVersion in ThisBuild := "1.3.3", 8 | libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.4" % "test" 9 | ) 10 | lazy val sonarSettings = Seq( 11 | sonarProperties ++= Map( 12 | "sonar.projectName" -> "Independent projects" 13 | ) 14 | ) 15 | 16 | lazy val module1 = (project in file("test-1/module1")) 17 | .settings(baseSettings) 18 | .settings(name := "module2indep") 19 | 20 | lazy val module2 = (project in file("test-2/module2")) 21 | .settings(baseSettings) 22 | .settings(name := "module1indep") 23 | 24 | lazy val independantProjects = (project in file(".")) 25 | .aggregate(module1, module2) 26 | .settings(name := "independent-projects") 27 | .settings(baseSettings) 28 | .settings(sonarSettings) 29 | -------------------------------------------------------------------------------- /src/test/scala/sbtsonar/WithFile.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2021 All sbt-sonar contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package sbtsonar 18 | 19 | import java.io.File 20 | import java.nio.file.Files 21 | 22 | import sbt.IO 23 | 24 | trait WithFile { 25 | def withFile(test: File => Any): Unit = { 26 | val file = Files.createTempFile("sonar-project", ".properties").toFile 27 | try test(file) 28 | finally IO.delete(file) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | on: 3 | push: 4 | branches: [master] 5 | tags: ["*"] 6 | env: 7 | CI_SNAPSHOT_RELEASE: "^publish" 8 | CI_RELEASE: "^publishSigned" 9 | jobs: 10 | release: 11 | runs-on: ubuntu-20.04 12 | steps: 13 | - uses: actions/checkout@v2 14 | - run: git fetch --prune --unshallow 15 | - uses: olafurpg/setup-scala@v10 16 | with: 17 | java-version: adopt@1.8 18 | - uses: actions/cache@v1 19 | with: 20 | path: ~/.ivy2/cache 21 | key: ivy-${{hashFiles('**/*.sbt')}} 22 | restore-keys: ivy- 23 | - uses: actions/cache@v1 24 | with: 25 | path: ~/.sbt 26 | key: sbt-${{hashFiles('**/*.sbt')}}-${{hashFiles('project/build.properties')}} 27 | restore-keys: sbt- 28 | - run: sbt ci-release 29 | env: 30 | PGP_PASSPHRASE: ${{secrets.PGP_PASSPHRASE}} 31 | PGP_SECRET: ${{secrets.PGP_SECRET}} 32 | SONATYPE_PASSWORD: ${{secrets.SONATYPE_PASSWORD}} 33 | SONATYPE_USERNAME: ${{secrets.SONATYPE_USERNAME}} 34 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module/build.sbt: -------------------------------------------------------------------------------- 1 | import sbtsonar.SonarPlugin.autoImport.sonarProperties 2 | import sbtsonar.SonarPlugin.autoImport.sonarScan 3 | 4 | lazy val baseSettings = Seq( 5 | version := "0.1", 6 | scalaVersion := "2.12.4", 7 | scapegoatVersion in ThisBuild := "1.3.3", 8 | libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.4" % "test" 9 | ) 10 | lazy val sonarSettings = Seq( 11 | sonarProperties ++= Map( 12 | "sonar.projectName" -> "Multi Module", 13 | "sonar.modules" -> "module1,module2", 14 | "module1.sonar.projectName" -> "Module 1", 15 | "module2.sonar.projectName" -> "Module 2" 16 | ) 17 | ) 18 | 19 | lazy val module1 = (project in file("module1")) 20 | .settings(baseSettings) 21 | .settings(name := "module2") 22 | 23 | lazy val module2 = (project in file("module2")) 24 | .settings(baseSettings) 25 | .settings(name := "module1") 26 | 27 | lazy val multiModule = (project in file(".")) 28 | .aggregate(module1, module2) 29 | .settings(name := "multi-module") 30 | .settings(baseSettings) 31 | .settings(sonarSettings) 32 | .settings(aggregate in sonarScan := false) 33 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module-not-on-root/build.sbt: -------------------------------------------------------------------------------- 1 | import sbtsonar.SonarPlugin.autoImport.sonarProperties 2 | import sbtsonar.SonarPlugin.autoImport.sonarScan 3 | 4 | lazy val baseSettings = Seq( 5 | version := "0.1", 6 | scalaVersion := "2.12.4", 7 | scapegoatVersion in ThisBuild := "1.3.3", 8 | libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.4" % "test" 9 | ) 10 | lazy val sonarSettings = Seq( 11 | sonarProperties ++= Map( 12 | "sonar.projectName" -> "Multi Module not in root", 13 | "sonar.modules" -> "module1nir,module2nir", 14 | "module1.sonar.projectName" -> "Module 1 not in root", 15 | "module2.sonar.projectName" -> "Module 2 not in root" 16 | ) 17 | ) 18 | 19 | lazy val module1 = (project in file("test-1/module1")) 20 | .settings(baseSettings) 21 | .settings(name := "module1nir") 22 | 23 | lazy val module2 = (project in file("test-2/module2")) 24 | .settings(baseSettings) 25 | .settings(name := "module2nir") 26 | 27 | lazy val multiModule = (project in file(".")) 28 | .aggregate(module1, module2) 29 | .settings(name := "multi-module-not-in-root") 30 | .settings(baseSettings) 31 | .settings(sonarSettings) 32 | -------------------------------------------------------------------------------- /src/sbt-test/sbt-sonar/multi-module-not-on-root-with-correct-config/build.sbt: -------------------------------------------------------------------------------- 1 | import sbtsonar.SonarPlugin.autoImport.sonarProperties 2 | import sbtsonar.SonarPlugin.autoImport.sonarScan 3 | 4 | lazy val baseSettings = Seq( 5 | version := "0.1", 6 | scalaVersion := "2.12.4", 7 | scapegoatVersion in ThisBuild := "1.3.3", 8 | libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.4" % "test" 9 | ) 10 | lazy val sonarSettings = Seq( 11 | sonarProperties ++= Map( 12 | "sonar.projectName" -> "Multi Module not in root with correct config", 13 | "sonar.modules" -> "module1nirwcc,module2nirwcc", 14 | "module1nirwcc.sonar.projectName" -> "Module 1 not in root with correct config", 15 | "module2nirwcc.sonar.projectName" -> "Module 2 not in root with correct config", 16 | "module2nirwcc.sonar.projectBaseDir" -> "test-2/module2", 17 | "module1nirwcc.sonar.projectBaseDir" -> "test-1/module1" 18 | ) 19 | ) 20 | 21 | lazy val module1 = (project in file("test-1/module1")) 22 | .settings(baseSettings) 23 | .settings(name := "module2nirwcc") 24 | 25 | lazy val module2 = (project in file("test-2/module2")) 26 | .settings(baseSettings) 27 | .settings(name := "module1nirwcc") 28 | 29 | lazy val multiModule = (project in file(".")) 30 | .aggregate(module1, module2) 31 | .settings(name := "multi-module-not-in-root-with-correct-config") 32 | .settings(baseSettings) 33 | .settings(sonarSettings) 34 | .settings(aggregate in sonarScan := false) 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |