在 Jenkins 中显示 Android Lint 结果
如何在 Jenkins 中显示 Android Lint 的结果,例如作为警告?我想从 Jenkins GUI 浏览警告,就像编译器警告和 PMD / Checkstyle 警告一样。
Jenkins 作业的输出是这样的:
[exec]
[exec] Scanning org.digitalcure.ccnf.app: ..........Incorrect detector reported disabled issue TooManyViews
[exec] Incorrect detector reported disabled issue TooManyViews
[exec] ...
[exec]
[exec] Scanning org.digitalcure.android.common: ...
[exec] res/values/strings.xml: Warning: The resource R.string.display_unit_abc appears to be unused [UnusedResources]
[exec] res/values/strings.xml: Warning: The resource R.string.edit_error_abc appears to be unused [UnusedResources]
[exec] Warning: Missing density variation folders in res: drawable-xhdpi [IconMissingDensityFolder]
[exec]
[exec] 0 errors, 3 warnings
Android Lint 也可以创建 XML 文件,但恐怕没有 Jenkins 插件能够解析该文件。或者我错过了什么?
How can I display the results from Android Lint in Jenkins, e.g. as warnings? I want to browse the warnings from the Jenkins GUI, just like compiler warnings and PMD / Checkstyle warnings.
The output from the Jenkins job is something like this:
[exec]
[exec] Scanning org.digitalcure.ccnf.app: ..........Incorrect detector reported disabled issue TooManyViews
[exec] Incorrect detector reported disabled issue TooManyViews
[exec] ...
[exec]
[exec] Scanning org.digitalcure.android.common: ...
[exec] res/values/strings.xml: Warning: The resource R.string.display_unit_abc appears to be unused [UnusedResources]
[exec] res/values/strings.xml: Warning: The resource R.string.edit_error_abc appears to be unused [UnusedResources]
[exec] Warning: Missing density variation folders in res: drawable-xhdpi [IconMissingDensityFolder]
[exec]
[exec] 0 errors, 3 warnings
Android Lint can create a XML file too, but I'm afraid that there is no Jenkins plugin able to parse the file. Or am I missing something?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用 Jenkins 的警告 NG 插件(取代了 Android Lint 插件)来执行此操作, 2012 年发布)。
这将解析 Lint XML 并以与 Jenkins 的其他静态分析插件相同的方式显示结果。
You can do this with the Warnings NG Plugin for Jenkins (which superseded the Android Lint Plugin, released in 2012).
This will parse Lint XML and display results in the same style as other static analysis plugins for Jenkins.
帕沃尔,非常感谢你的灵感!不幸的是,您的正则表达式/脚本对我不起作用,但这是进一步调查的一个非常好的起点。以下是适合我的配置的内容:
名称:
Android Lint Parser
正则表达式:
([^\s]*: )?([^ ]*):\s+(.*)\[ (.*)\]$
Groovy 脚本:
Pavol, thank you very much for your inspiration! Unfortunately your regexp/script doesn't work for me, but it was a very good starting point for further investigations. Here is what works for my configuration:
Name:
Android Lint Parser
Regexp:
([^\s]*: )?([^ ]*):\s+(.*)\[(.*)\]$
Groovy script:
在某些版本的编译警告插件中,您可以使用 regexp 和 groovy 脚本从 jenkins 的配置站点创建解析器。我为作为 shell 脚本运行的 lint 创建了一个,并输出到某个文件。
正则表达式:
^\s*([^ ]*): ([^ ]*):\s*(.*)\[(.*)\]$
Groovy 脚本:
In compile warnings plugin from some version you can create parser from the configuration site of jenkins using regexp and groovy script. I created one for the lint I run as shell script with output to some file.
Regexp:
^\s*([^ ]*): ([^ ]*):\s*(.*)\[(.*)\]$
Groovy script: