How to ignore some statements in Javascript code coverage when using lcov and istanbul ?

1,402 views
Skip to first unread message

anthony....@gmail.com

unread,
Jul 31, 2015, 3:51:11 AM7/31/15
to SonarQube
How is it possible to make sonarqube take into account directives found in code comments ? There is a page on istanbul describing how to ignore some branches using comments like this

/* istanbul ignore if  */
if (hardToReproduceError)) {
    return callback(hardToReproduceError);
}


(see https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md)

It works well into HTML reports generated by istanbul but it does not work with Sonarqube.

G. Ann Campbell

unread,
Jul 31, 2015, 12:36:08 PM7/31/15
to SonarQube, anthony....@gmail.com
Hi Anthony,

The only thing that's available regarding comments is //NOSONAR, which will suppress issues but not affect other metrics. And it's really an antipattern.


Ann
Reply all
Reply to author
Forward
0 new messages