-
-
Notifications
You must be signed in to change notification settings - Fork 534
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#67: Link back to the Pull Request from Sonarqube
Sonarqube provides the ability to link back to the original Pull Request or Merge Request from the Pull Request overview screen if the Pull Request URL is persisted alongside the branch details. To allow this, decorators are now required to return a `DecorationResult` that contains an optional URL for the Pull Request's overview/summary page. The Gitlab and Github decorators have been updated to provide the new details, however the Bitbucket decorator defaults to returning no URL since the details are not readily available, so Bitbucket Pull Requests will continue to show no link back the the Pull Request from Sonarqube.
- Loading branch information
Showing
14 changed files
with
207 additions
and
16 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
src/main/java/com/github/mc1arke/sonarqube/plugin/ce/pullrequest/DecorationResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright (C) 2020 Michael Clarke | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
* | ||
*/ | ||
package com.github.mc1arke.sonarqube.plugin.ce.pullrequest; | ||
|
||
import java.util.Optional; | ||
|
||
public final class DecorationResult { | ||
|
||
private final String pullRequestUrl; | ||
|
||
private DecorationResult(Builder builder) { | ||
super(); | ||
this.pullRequestUrl = builder.pullRequestUrl; | ||
} | ||
|
||
public Optional<String> getPullRequestUrl() { | ||
return Optional.ofNullable(pullRequestUrl); | ||
} | ||
|
||
public static Builder builder() { | ||
return new Builder(); | ||
} | ||
|
||
public static final class Builder { | ||
|
||
private String pullRequestUrl; | ||
|
||
private Builder() { | ||
super(); | ||
} | ||
|
||
public Builder withPullRequestUrl(String pullRequestUrl) { | ||
this.pullRequestUrl = pullRequestUrl; | ||
return this; | ||
} | ||
|
||
public DecorationResult build() { | ||
return new DecorationResult(this); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.