ste*_*222 5 android 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
Run Code Online (Sandbox Code Playgroud)
Android Lint也可以创建XML文件,但我担心没有Jenkins插件可以解析文件.或者我错过了什么?
帕沃尔,非常感谢你的灵感!不幸的是,您的正则表达式/脚本对我不起作用,但这是进一步调查的一个非常好的起点。以下是适用于我的配置的内容:
姓名:Android Lint Parser
正则表达式:([^\s]*: )?([^ ]*):\s+(.*)\[(.*)\]$
常规脚本:
import hudson.plugins.warnings.parser.Warning;
import hudson.plugins.analysis.util.model.Priority;
String fileName = matcher.group(1);
String lineNumber = "";
String priority = matcher.group(2);
String message = matcher.group(3);
String category = matcher.group(4);
if (fileName == null) {
fileName = "(no file)";
} else {
int idx = fileName.indexOf(':');
if (idx > -1) {
lineNumber = fileName.substring(idx + 1, fileName.size());
fileName = fileName.substring(0, idx);
int idx2 = lineNumber.indexOf(':');
if (idx2 > -1) {
lineNumber = lineNumber.substring(0, idx2);
}
idx2 = lineNumber.indexOf(' ');
if (idx2 > -1) {
lineNumber = lineNumber.substring(0, idx2);
}
}
}
return new Warning(fileName, lineNumber.size() > 0 ? Integer.parseInt(lineNumber) : 0, "Android Lint Parser", category, message, priority.equals("Error") ? Priority.HIGH : Priority.NORMAL);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4026 次 |
| 最近记录: |