-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #302 from cnescatlab/dev
Version 4.1.0
- Loading branch information
Showing
53 changed files
with
3,075 additions
and
1,671 deletions.
There are no files selected for viewing
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
42 changes: 42 additions & 0 deletions
42
src/main/java/fr/cnes/sonar/plugin/tools/DefaultBranch.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,42 @@ | ||
package fr.cnes.sonar.plugin.tools; | ||
|
||
import java.util.List; | ||
|
||
import org.sonarqube.ws.ProjectBranches.Branch; | ||
import org.sonarqube.ws.client.WsClient; | ||
import org.sonarqube.ws.client.projectbranches.ListRequest; | ||
|
||
/** | ||
* utility class used to determine the MAIN branch of a project | ||
*/ | ||
public class DefaultBranch { | ||
|
||
private DefaultBranch(){} | ||
|
||
/** | ||
* Method used to retrieve the MAIN branch from a specified project | ||
* @param wsClient Class needed to interact with SonarQube classes | ||
* @param project Project from which we want the MAIN branch | ||
* @return The MAIN branch of the given project | ||
*/ | ||
public static String getDefaultBranchFromProject(WsClient wsClient, String project) { | ||
|
||
ListRequest request = new ListRequest().setProject(project); | ||
List<Branch> branchesList = wsClient.projectBranches().list(request).getBranchesList(); | ||
|
||
String defaultBranch = ""; | ||
|
||
/** In theory, no need to check if the following condition is matched at least once | ||
* because SonarQube always defines a MAIN branch inside a project | ||
* even if the project is empty | ||
*/ | ||
for(Branch branch: branchesList) { | ||
if(branch.getIsMain()) { | ||
defaultBranch = branch.getName(); | ||
} | ||
} | ||
|
||
return defaultBranch; | ||
} | ||
|
||
} |
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
234 changes: 0 additions & 234 deletions
234
src/main/java/fr/cnes/sonar/report/exporters/MarkdownExporter.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.