Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify the base build for comparing the result against. #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
public class CppcheckResult implements Serializable {

private static final long serialVersionUID = 1L;
private static final String PULL_REQUEST_TO_HASH = "PULL_REQUEST_TO_HASH";
private static final String GIT_COMMIT = "GIT_COMMIT";

/**
* The Cppcheck report
Expand Down Expand Up @@ -157,6 +159,18 @@ public CppcheckResult getPreviousResult() {
* @return the previous Cppcheck Build Action
*/
private CppcheckBuildAction getPreviousAction() {
String pull_request_to_hash = owner.getBuildVariables().get(PULL_REQUEST_TO_HASH);
if (pull_request_to_hash != null) {
AbstractBuild<?, ?> lOwner = owner.getPreviousBuild();
while (lOwner != null) {
String commit_hash = lOwner.getBuildVariables().get(GIT_COMMIT);
if (pull_request_to_hash.equals(commit_hash)) {
return lOwner.getAction(CppcheckBuildAction.class);
}
lOwner = lOwner.getPreviousBuild();
}
}

AbstractBuild<?, ?> previousBuild = owner.getPreviousBuild();
if (previousBuild != null) {
return previousBuild.getAction(CppcheckBuildAction.class);
Expand Down