File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,10 @@ class Coverage
1818 def add (stmt : MeasuredStatement ): Unit = statements.append(stmt)
1919
2020 def avgClassesPerPackage = classCount / packageCount.toDouble
21+ def avgClassesPerPackageFormatted : String = " %.2f" .format(avgClassesPerPackage * 100 )
22+
2123 def avgMethodsPerClass = methodCount / classCount.toDouble
24+ def avgMethodsPerClassFormatted : String = " %.2f" .format(avgMethodsPerClass * 100 )
2225
2326 // returns the classes by least coverage
2427 def risks (limit : Int ) = classes.toSeq.sortBy(_.statementCount).reverse.sortBy(_.statementCoverage).take(limit)
@@ -29,10 +32,10 @@ class Coverage
2932
3033trait MethodBuilders {
3134 val statements : Iterable [MeasuredStatement ]
32- def methodCount = methods.size
3335 def methods : Seq [MeasuredMethod ] = {
3436 statements.groupBy(_.location.method).map(arg => MeasuredMethod (arg._1, arg._2)).toSeq
3537 }
38+ def methodCount = methods.size
3639}
3740
3841trait PackageBuilders {
Original file line number Diff line number Diff line change @@ -122,12 +122,14 @@ class ScalesComponent(val global: Global)
122122
123123 case EmptyTree => super .transform(tree)
124124
125- // This AST node corresponds to the following Scala code: fun(args)
125+ // This AST node corresponds to the following Scala code: fun(args)
126126 case apply : Apply =>
127127 instrument(treeCopy.Apply (apply, apply.fun, transformStatements(apply.args)))
128128
129129 // just carry on as normal with a block, we'll process the children
130- case _ : Block => super .transform(tree)
130+ case b : Block =>
131+ treeCopy.Block (b, transformStatements(b.stats), transform(b.expr))
132+
131133 case _ : Import => super .transform(tree)
132134 case p : PackageDef => super .transform(tree)
133135
@@ -183,9 +185,9 @@ class ScalesComponent(val global: Global)
183185 case i : If =>
184186 treeCopy.If (i, i.cond, transformIf(i.thenp), transformIf(i.elsep))
185187
186- // handle function bodies. This AST node corresponds to the following Scala code: vparams => body
188+ // handle function bodies. This AST node corresponds to the following Scala code: vparams => body
187189 case f : Function =>
188- treeCopy.Function (tree, f.vparams, transform (f.body))
190+ treeCopy.Function (tree, f.vparams, process (f.body))
189191
190192 // labeldefs are never written natively in scala
191193 case l : LabelDef =>
You can’t perform that action at this time.
0 commit comments