sbt findbugs
v2.0.0
此SBT插件使您可以在Great Findbugs工具的帮助下分析(Java)代码。它为此目的定义了findbugs SBT操作。
通过将以下内容添加到project/plugins.sbt :安装插件:
addSbtPlugin( " com.github.sbt " % " sbt-findbugs " % " <version> " )然后使用sbt findbugs运行插件。这将在target/scala-xx/findugs/report.xml中生成findbugs报告。
只需将Scala内联XML用于设置,例如:
findbugsIncludeFilters := Some (< FindBugsFilter >
< Match >
< Class name = " de.johoop.Meep " />
</ Match >
</ FindBugsFilter >)您还可以以更常规的方式从文件中读取过滤器设置:
findbugsIncludeFilters := Some (baseDirectory.value / " findbugs-include-filters.xml " )或者,当您的配置被拉开并以前发布到本地存储库时:
findbugsIncludeFilters := {
val configFiles = update.value.select(module = moduleFilter(name = " velvetant-sonar " ))
val configFile = configFiles.headOption flatMap { zippedFile =>
IO .unzip(zippedFile, target.value / " rules " ) find (_.name contains " velvetant-sonar-findbugs.xml " )
}
configFile map scala.xml. XML .loadFile orElse sys.error( " unable to find config file in update report " )
}(另请参见Findbugs文档)
findbugsReportTypeSome(FindbugsReportType.{Xml, Html, PlainHtml, FancyHtml, FancyHistHtml, Emacs, Xdoc})Some(FindbugsReportType.Xml)findbugsReportPathSome(crossTarget.value / "findbugs" / "report.xml")findbugsPriorityFindbugsPriority.{Relaxed, Low, Medium, High}FindbugsPriority.MediumfindbugsEffortFindbugsEffort.{Minimum, Default, Maximum}FindbugsEffort.DefaultfindbugsOnlyAnalyzeList[String]的选项。None (含义:分析所有内容)。findbugsMaxMemory1024findbugsAnalyzeNestedArchivestrue和falsetruefindbugsSortReportByClassNamestrue和falsefalsefindbugsIncludeFiltersNone和Option[Node]None (没有包含过滤器)。findbugsExcludeFiltersNone和Some[Node]None (没有排除过滤器)。findbugsAnalyzedPathsbt.PathSeq(classDirectory in Compile value) 感谢@asflierl和@anishathalye的贡献!
版权(C)Joachim Hofer和贡献者
版权所有。
该程序和随附的材料可根据Eclipse公共许可证v1.0的条款提供,该条款随附该分发,可在http://www.eclipse.org/legal/legal/epl-v10.html上找到。