scala代码覆盖率使用scct,如何通过正则表达式排除文件

时间:2021-02-28 22:00:41

using scct in my project there are some files I would like to be excluded

在我的项目中使用scct,我想要排除一些文件

my build file :

我的构建文件:

object myBuild extends Build {

  lazy val americanNinja1 = Project(id = "American-Ninja", base = file("americanNinja")).settings(ScctPlugin.instrumentSettings: _*)

 //more code .....
}

how can i add setting to the scct to exclude all .html files (for example)

如何添加scct设置以排除所有.html文件(例如)

looking at the github project of scct i see that there is a filter option

看看scct的github项目我发现有一个过滤选项

https://github.com/sqality/scct/blob/master/src/main/scala/com/sqality/scct/CoverageFilter.scala

and there was an issue that was solved for this matter :

并且有一个问题已经解决了这个问题:

https://github.com/mtkopone/scct/issues/60

any idea how to do this ?

任何想法如何做到这一点?

Thanks!

2 个解决方案

#1


1  

I have fixed similar problem two days ago, but I had to fork SCCT and SBT-SCCT as well and fix some things. First problem was that SBT-SCCT wasn't passing the "scctExcludePackages" setting to SCCT correctly. Also I have modified SCCT so that it excludes based on package name instead of file name. I know this doesn't solve your issue, but use this as an inspiration and feel free to contribute:

我两天前修复了类似的问题,但我不得不分叉SCCT和SBT-SCCT并修复一些问题。第一个问题是SBT-SCCT没有正确地将“scctExcludePackages”设置传递给SCCT。此外,我已修改SCCT,以便它基于包名而不是文件名排除。我知道这不能解决您的问题,但请将此作为灵感,随时为此做出贡献:

https://github.com/RadoBuransky/sbt-scct/commit/b301a9cb21447c3a531707437b95e5f39e9ce336 https://github.com/RadoBuransky/scct/commit/d6244d54ef00f01f6019d7cf1bd0fd927ce75e08

#2


0  

You could take a look at https://github.com/scoverage/sbt-scoverage which is a fork of SCCT and supports exclusions, but it does not support multi project builds at the moment.

您可以查看https://github.com/scoverage/sbt-scoverage,它是SCCT的一个分支并支持排除,但它目前不支持多项目构建。

#1


1  

I have fixed similar problem two days ago, but I had to fork SCCT and SBT-SCCT as well and fix some things. First problem was that SBT-SCCT wasn't passing the "scctExcludePackages" setting to SCCT correctly. Also I have modified SCCT so that it excludes based on package name instead of file name. I know this doesn't solve your issue, but use this as an inspiration and feel free to contribute:

我两天前修复了类似的问题,但我不得不分叉SCCT和SBT-SCCT并修复一些问题。第一个问题是SBT-SCCT没有正确地将“scctExcludePackages”设置传递给SCCT。此外,我已修改SCCT,以便它基于包名而不是文件名排除。我知道这不能解决您的问题,但请将此作为灵感,随时为此做出贡献:

https://github.com/RadoBuransky/sbt-scct/commit/b301a9cb21447c3a531707437b95e5f39e9ce336 https://github.com/RadoBuransky/scct/commit/d6244d54ef00f01f6019d7cf1bd0fd927ce75e08

#2


0  

You could take a look at https://github.com/scoverage/sbt-scoverage which is a fork of SCCT and supports exclusions, but it does not support multi project builds at the moment.

您可以查看https://github.com/scoverage/sbt-scoverage,它是SCCT的一个分支并支持排除,但它目前不支持多项目构建。