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上找到。