use of com.uber.jenkins.phabricator.lint.LintResults in project phabricator-jenkins-plugin by uber.
the class BuildResultProcessor method processLintResults.
/**
* Fetch remote lint violations from the build workspace and process
*
* @param lintFile the path pattern of the file
* @param lintFileSize maximum number of bytes to read from the remote file
*/
public void processLintResults(String lintFile, String lintFileSize) {
RemoteFileFetcher lintFetcher = new RemoteFileFetcher(workspace, logger, lintFile, lintFileSize);
try {
String input = lintFetcher.getRemoteFile();
if (input != null && input.length() > 0) {
lintResults = new LintResults();
BufferedReader reader = new BufferedReader(new StringReader(input));
String lint = "";
String line;
while ((line = reader.readLine()) != null) {
lint += line;
try {
JSONObject json = JSONObject.fromObject(lint);
lintResults.add(LintResult.fromJsonObject(json));
lint = "";
} catch (JSONException e) {
e.printStackTrace(logger.getStream());
}
}
}
} catch (InterruptedException e) {
e.printStackTrace(logger.getStream());
} catch (IOException e) {
e.printStackTrace(logger.getStream());
}
}
use of com.uber.jenkins.phabricator.lint.LintResults in project phabricator-jenkins-plugin by uber.
the class PhabricatorNotifierTest method testPostToHarbormasterValidLint.
@Test
public void testPostToHarbormasterValidLint() throws Exception {
JSONObject json = new JSONObject();
LintResults result = new LintResults();
result.add(new LintResult("test", "testcode", "error", "to/path", 10, 3, "test description"));
json.element("lint", result);
FreeStyleBuild build = buildWithConduit(getFetchDiffResponse(), null, json);
assertEquals(Result.SUCCESS, build.getResult());
}
Aggregations