Skip to content

Commit

Permalink
Added additional workaround for play framework app structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmarich committed Oct 29, 2013
1 parent d1be494 commit 24def85
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<artifactId>sonar-scala-plugin</artifactId>
<packaging>sonar-plugin</packaging>
<version>0.2-SNAPSHOT</version>
<version>0.3-SNAPSHOT</version>

<name>Sonar Scala Plugin</name>
<description>Enables analysis of Scala projects into Sonar.</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ public class ScalaCoberturaParser extends AbstractCoberturaParser {
@Override
protected Resource<?> getResource(String fileName) {
// TODO update the sbt scct plugin to provide the correct fully qualified class name.
fileName = fileName.replace("src.main.scala.", "");
if (fileName.startsWith("src.main.scala."))
fileName = fileName.replace("src.main.scala.", "");
else if (fileName.startsWith("app."))
fileName = fileName.replace("app.", "");

int packageTerminator = fileName.lastIndexOf('.');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,18 @@ public void should_create_ScalaFile_resource_when_scct_bug() {
assertEquals("com.mock.scalapackage", scalaPackage.getName());
}

@Test
public void should_create_ScalaFile_resource_when_scct_bug_for_play_app() {
Resource resource = underTest.getResource("app.com.mock.scalapackage.MockScalaClass");
assertNotNull(resource);
assertTrue(resource instanceof ScalaFile);

ScalaFile file = (ScalaFile)resource;
assertEquals("MockScalaClass", file.getName());

ScalaPackage scalaPackage = file.getParent();
assertNotNull(scalaPackage);
assertEquals("com.mock.scalapackage", scalaPackage.getName());
}

}

0 comments on commit 24def85

Please sign in to comment.