1+ /** Provides classes and predicates for working with Clover reports. */
2+
13import java
24
35/**
@@ -18,6 +20,7 @@ class CloverCoverage extends XMLElement {
1820 this .getName ( ) = "coverage"
1921 }
2022
23+ /** Gets a project for this `coverage` element. */
2124 CloverProject getAProject ( ) { result = this .getAChild ( ) }
2225}
2326
@@ -27,6 +30,7 @@ class CloverCoverage extends XMLElement {
2730 * all subclasses of this class, to share code.
2831 */
2932abstract class CloverMetricsContainer extends XMLElement {
33+ /** Gets the Clover `metrics` child element for this element. */
3034 CloverMetrics getMetrics ( ) { result = this .getAChild ( ) }
3135}
3236
@@ -44,42 +48,61 @@ class CloverMetrics extends XMLElement {
4448
4549 private float ratio ( string name ) { result = attr ( "covered" + name ) / attr ( name ) .( float ) }
4650
51+ /** Gets the value of the `conditionals` attribute. */
4752 int getNumConditionals ( ) { result = attr ( "conditionals" ) }
4853
54+ /** Gets the value of the `coveredconditionals` attribute. */
4955 int getNumCoveredConditionals ( ) { result = attr ( "coveredconditionals" ) }
5056
57+ /** Gets the value of the `statements` attribute. */
5158 int getNumStatements ( ) { result = attr ( "statements" ) }
5259
60+ /** Gets the value of the `coveredstatements` attribute. */
5361 int getNumCoveredStatements ( ) { result = attr ( "coveredstatements" ) }
5462
63+ /** Gets the value of the `elements` attribute. */
5564 int getNumElements ( ) { result = attr ( "elements" ) }
5665
66+ /** Gets the value of the `coveredelements` attribute. */
5767 int getNumCoveredElements ( ) { result = attr ( "coveredelements" ) }
5868
69+ /** Gets the value of the `methods` attribute. */
5970 int getNumMethods ( ) { result = attr ( "methods" ) }
6071
72+ /** Gets the value of the `coveredmethods` attribute. */
6173 int getNumCoveredMethods ( ) { result = attr ( "coveredmethods" ) }
6274
75+ /** Gets the value of the `loc` attribute. */
6376 int getNumLoC ( ) { result = attr ( "loc" ) }
6477
78+ /** Gets the value of the `ncloc` attribute. */
6579 int getNumNonCommentedLoC ( ) { result = attr ( "ncloc" ) }
6680
81+ /** Gets the value of the `packages` attribute. */
6782 int getNumPackages ( ) { result = attr ( "packages" ) }
6883
84+ /** Gets the value of the `files` attribute. */
6985 int getNumFiles ( ) { result = attr ( "files" ) }
7086
87+ /** Gets the value of the `classes` attribute. */
7188 int getNumClasses ( ) { result = attr ( "classes" ) }
7289
90+ /** Gets the value of the `complexity` attribute. */
7391 int getCloverComplexity ( ) { result = attr ( "complexity" ) }
7492
93+ /** Gets the ratio of the `coveredconditionals` attribute over the `conditionals` attribute. */
7594 float getConditionalCoverage ( ) { result = ratio ( "conditionals" ) }
7695
96+ /** Gets the ratio of the `coveredstatements` attribute over the `statements` attribute. */
7797 float getStatementCoverage ( ) { result = ratio ( "statements" ) }
7898
99+ /** Gets the ratio of the `coveredelements` attribute over the `elements` attribute. */
79100 float getElementCoverage ( ) { result = ratio ( "elements" ) }
80101
102+ /** Gets the ratio of the `coveredmethods` attribute over the `methods` attribute. */
81103 float getMethodCoverage ( ) { result = ratio ( "methods" ) }
82104
105+ /** Gets the ratio of the `ncloc` attribute over the `loc` attribute. */
83106 float getNonCommentedLoCRatio ( ) { result = attr ( "ncloc" ) / attr ( "loc" ) }
84107}
85108
@@ -100,6 +123,7 @@ class CloverPackage extends CloverMetricsContainer {
100123 this .getName ( ) = "package"
101124 }
102125
126+ /** Gets the Java package for this Clover package. */
103127 Package getRealPackage ( ) { result .hasName ( getAttribute ( "name" ) .getValue ( ) ) }
104128}
105129
@@ -122,8 +146,10 @@ class CloverClass extends CloverMetricsContainer {
122146 this .getName ( ) = "class"
123147 }
124148
149+ /** Gets the Clover package for this Clover class. */
125150 CloverPackage getPackage ( ) { result = getParent ( ) .( CloverFile ) .getParent ( ) }
126151
152+ /** Gets the Java type for this Clover class. */
127153 RefType getRealClass ( ) {
128154 result
129155 .hasQualifiedName ( getPackage ( ) .getAttribute ( "name" ) .getValue ( ) ,
0 commit comments