File tree 1 file changed +8
-7
lines changed
1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -210,15 +210,16 @@ object ScoverageSbtPlugin extends AutoPlugin {
210
210
crossTarget : File ,
211
211
log : Logger ) {
212
212
213
- // Teamcity only have a definition of line/method and class coverage
214
213
215
- // Log branch coverage as line coverage
216
- log.info(s " ##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value=' ${coverage.invokedStatementCount}'] " )
217
- log.info(s " ##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value=' ${coverage.statementCount}'] " )
214
+ def statsKeyValue (key : String , value : Int ): String =
215
+ s " ##teamcity[buildStatisticValue key=' ${key}' value=' ${value}'] "
218
216
219
- // Log statement coverage as method coverage
220
- log.info(s " ##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value=' ${coverage.invokedBranchesCount}'] " )
221
- log.info(s " ##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value=' ${coverage.branchCount}'] " )
217
+ // Log statement coverage as per: https://devnet.jetbrains.com/message/5467985
218
+ log.info(statsKeyValue(" CodeCoverageAbsSCovered" , coverage.invokedStatementCount))
219
+ log.info(statsKeyValue(" CodeCoverageAbsSTotal" , coverage.statementCount))
220
+
221
+ // Log branch coverage as a custom metrics (in percent)
222
+ log.info(statsKeyValue(" CodeCoverageBranch" , " %.0f" .format(coverage.branchCoveragePercent).toInt))
222
223
223
224
// Create the coverage report for teamcity (HTML files)
224
225
if (createCoverageZip)
You can’t perform that action at this time.
0 commit comments