|
19 | 19 | */ |
20 | 20 | package com.buransky.plugins.scoverage.sensor |
21 | 21 |
|
22 | | -import java.io |
23 | | - |
24 | 22 | import com.buransky.plugins.scoverage.language.Scala |
25 | 23 | import com.buransky.plugins.scoverage.measure.ScalaMetrics |
| 24 | +import com.buransky.plugins.scoverage.pathcleaner.{BruteForceSequenceMatcher, PathSanitizer} |
26 | 25 | import com.buransky.plugins.scoverage.util.LogUtil |
27 | 26 | import com.buransky.plugins.scoverage.xml.XmlScoverageReportParser |
28 | | -import com.buransky.plugins.scoverage.{ CoveredStatement, DirectoryStatementCoverage, FileStatementCoverage, _ } |
29 | | -import org.sonar.api.batch.fs.{ FileSystem, InputFile, InputDir, InputPath } |
30 | | -import org.sonar.api.batch.{ CoverageExtension, Sensor, SensorContext } |
| 27 | +import com.buransky.plugins.scoverage.{CoveredStatement, DirectoryStatementCoverage, FileStatementCoverage, _} |
| 28 | +import org.sonar.api.batch.fs.{FileSystem, InputFile, InputPath} |
| 29 | +import org.sonar.api.batch.{CoverageExtension, Sensor, SensorContext} |
31 | 30 | import org.sonar.api.config.Settings |
32 | | -import org.sonar.api.measures.{ CoreMetrics, CoverageMeasuresBuilder, Measure } |
33 | | -import org.sonar.api.resources.{ File, Project, Directory, Resource } |
| 31 | +import org.sonar.api.measures.{CoverageMeasuresBuilder, Measure} |
| 32 | +import org.sonar.api.resources.{Project, Resource} |
34 | 33 | import org.sonar.api.scan.filesystem.PathResolver |
35 | 34 | import org.sonar.api.utils.log.Loggers |
36 | 35 |
|
37 | 36 | import scala.collection.JavaConversions._ |
38 | | -import com.buransky.plugins.scoverage.pathcleaner.BruteForceSequenceMatcher |
39 | | -import com.buransky.plugins.scoverage.pathcleaner.PathSanitizer |
40 | 37 |
|
41 | 38 | /** |
42 | 39 | * Main sensor for importing Scoverage report to Sonar. |
43 | 40 | * |
44 | 41 | * @author Rado Buransky |
45 | 42 | */ |
46 | | -class ScoverageSensor(settings: Settings, pathResolver: PathResolver, fileSystem: FileSystem, scala: Scala) |
| 43 | +class ScoverageSensor(settings: Settings, pathResolver: PathResolver, fileSystem: FileSystem) |
47 | 44 | extends Sensor with CoverageExtension { |
48 | 45 | private val log = Loggers.get(classOf[ScoverageSensor]) |
49 | 46 | protected val SCOVERAGE_REPORT_PATH_PROPERTY = "sonar.scoverage.reportPath" |
50 | 47 | protected lazy val scoverageReportParser: ScoverageReportParser = XmlScoverageReportParser() |
51 | 48 |
|
52 | | - override def shouldExecuteOnProject(project: Project): Boolean = fileSystem.languages().contains(scala.getKey) |
| 49 | + override def shouldExecuteOnProject(project: Project): Boolean = fileSystem.languages().contains(Scala.key) |
53 | 50 |
|
54 | 51 | override def analyse(project: Project, context: SensorContext) { |
55 | 52 | scoverageReportPath match { |
@@ -188,7 +185,7 @@ class ScoverageSensor(settings: Settings, pathResolver: PathResolver, fileSystem |
188 | 185 | val p = fileSystem.predicates() |
189 | 186 | Option(fileSystem.inputFile(p.and( |
190 | 187 | p.hasRelativePath(path), |
191 | | - p.hasLanguage(scala.getKey), |
| 188 | + p.hasLanguage(Scala.key), |
192 | 189 | p.hasType(InputFile.Type.MAIN)))) |
193 | 190 | } else { |
194 | 191 | Option(fileSystem.inputDir(pathResolver.relativeFile(fileSystem.baseDir(), path))) |
|
0 commit comments