Configuring method context filters

このページの内容

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

You can filter-out less important code sections using context filters for: methods (groovy+java), statements (java) and code blocks (java). See Using Coverage Contexts for more details.

A report can use custom set of columns - see <clover-report> / <columns> tag documentation.

 

例:

setuptask = { ant, binding, plugin ->
    ant.'clover-setup'(initstring: "target/clover/db/clover.db") {
      ant.fileset(dir: "grails-app") { }
      ant.fileset(dir: "src/groovy") { }
      ant.fileset(dir: "src/java") { }
      ant.fileset(dir: "test") { }

      // Ignore private constructors in Groovy - using normalized constructor signature
      ant.methodContext(name: 'private-constructors', regexp: 'private void <init>\\(\\)') { }

      // Ignore logging statements. Note that statement context is currently supported only for Java.
      ant.statementContext(name: 'log',   regexp: '^log\\..*')
      ant.statementContext(name: 'if-log', regexp: '^if.*\\(log\\..*')
    }
}

reporttask = { ant, binding, plugin ->
    ant.'clover-report'(initstring: "target/clover/db/clover.db") {
      ant.current(outfile: "target/clover/html-report", title: "API Report") {
        // NOTE: you have to add the 'filter' attribute with a list of filters from clover-setup task
        ant.format(type: "html", filter: "private-constructors,log,if-log") { }
        ant.fileset(dir: "grails-app") { }
        ant.fileset(dir: "src/groovy") { }
        ant.fileset(dir: "src/java") { }
        ant.fileset(dir: "test") { }
        ant.columns {
          lineCount()
          filteredElements()
          uncoveredElements()
          totalPercentageCovered()
        }
      }
    }
}
最終更新日 2014 年 8 月 11 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.