-
Notifications
You must be signed in to change notification settings - Fork 127
#27 use fully-qualified class names to avoid ambiguity in reports #133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ class CoberturaXmlWriter(sourceDirectories: Seq[File], outputDir: File) extends | |
} | ||
|
||
def klass(klass: MeasuredClass): Node = { | ||
<class name={klass.name} | ||
<class name={klass.fullClassName} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what the Cobertura XML format requires here. Do you have access to a Cobertura formatted XML report to check? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've just checked it (
<class name="a.b.c.Foo$Boo$Moo" filename="a/b/c/Foo.java" line-rate="1.0" branch-rate="1.0" complexity="1.0">
<methods>
<method name="hello" signature="()Ljava/lang/String;" line-rate="1.0" branch-rate="1.0" complexity="0">
...
</method>
...
</class> Maven Scala project with scalac-scoverage-plugin 1.1.1 <class name="Moo" filename="a/b/c/Foo.scala" line-rate="1.00" branch-rate="1.00" complexity="0">
<methods>
<method name="a.b.c/Moo/hello" signature="()V" line-rate="1.00" branch-rate="1.00">
...
</method>
...
</class> Maven Scala project with scalac-scoverage-plugin 1.2.0 with your PR applied (current master): <class name="a.b.c.Foo.Boo" filename="a/b/c/Foo.scala" line-rate="0.00" branch-rate="0.00" complexity="0">
<methods>
<method name="a.b.c/Moo/hello" signature="()V" line-rate="1.00" branch-rate="1.00">
...
</method>
...
</class> So now is better, but not ideal. There should be dollar signs in class name. You did not change method name, but it could be fixed with class name fix. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tested on Java class: package a.b.c;
public class Foo
{
public String hello()
{
return "Hello Foo";
}
static class Boo
{
public String hello()
{
return "Hello Foo.Boo";
}
static class Moo
{
public String hello()
{
return "Hello Foo.Boo.Moo";
}
}
}
} and Scala class: package a.b.c
object Foo
{
def hello: String = "Hello Foo"
object Boo
{
def hello: String = "Hello Foo.Boo"
object Moo
{
def hello: String = "Hello Foo.Boo.Moo"
}
}
} |
||
filename={relativeSource(klass.source).replace(File.separator, "/")} | ||
line-rate={format(klass.statementCoverage)} | ||
branch-rate={format(klass.branchCoverage)} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ import scala.xml.{Node, PrettyPrinter} | |
class ScoverageXmlWriter(sourceDirectories: Seq[File], outputDir: File, debug: Boolean) extends BaseReportWriter(sourceDirectories, outputDir) { | ||
|
||
def this (sourceDir: File, outputDir: File, debug: Boolean) { | ||
this(Seq(sourceDir), outputDir, debug); | ||
this(Seq(sourceDir), outputDir, debug) | ||
} | ||
|
||
def write(coverage: Coverage): Unit = { | ||
|
@@ -37,7 +37,7 @@ class ScoverageXmlWriter(sourceDirectories: Seq[File], outputDir: File, debug: B | |
<statement package={stmt.location.packageName} | ||
class={stmt.location.className} | ||
class-type={stmt.location.classType.toString} | ||
top-level-class={stmt.location.topLevelClass} | ||
full-class-name={stmt.location.fullClassName} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe that the XML format used here is internal to |
||
source={stmt.source} | ||
method={stmt.location.method} | ||
start={stmt.start.toString} | ||
|
@@ -54,7 +54,7 @@ class ScoverageXmlWriter(sourceDirectories: Seq[File], outputDir: File, debug: B | |
<statement package={stmt.location.packageName} | ||
class={stmt.location.className} | ||
class-type={stmt.location.classType.toString} | ||
top-level-class={stmt.location.topLevelClass} | ||
full-class-name={stmt.location.fullClassName} | ||
source={stmt.source} | ||
method={stmt.location.method} | ||
start={stmt.start.toString} | ||
|
@@ -79,7 +79,7 @@ class ScoverageXmlWriter(sourceDirectories: Seq[File], outputDir: File, debug: B | |
} | ||
|
||
private def klass(klass: MeasuredClass): Node = { | ||
<class name={klass.name} | ||
<class name={klass.fullClassName} | ||
filename={relativeSource(klass.source)} | ||
statement-count={klass.statementCount.toString} | ||
statements-invoked={klass.invokedStatementCount.toString} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that the XML format used here is internal to
scoverage
, so can be changed without BC concerns