Skip to content

Commit

Permalink
Merge pull request #78 from lequal/dev
Browse files Browse the repository at this point in the history
sonar-cnes-report 3.0.1
  • Loading branch information
louisjdmartin authored Aug 23, 2019
2 parents c81c134 + a7f1e10 commit 86ef340
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ java -Dhttps.proxyHost=https://myproxy -Dhttps.proxyPort=42
<td><b>2.0.0<br/>Standalone only</b></td>
<td><b>2.1.0<br/>Standalone only</b></b></td>
<td><b>2.2.0<br/>Standalone + Plugin</b></td>
<td><b>3.0.0<br/>Standalone + Plugin</b></b></td>
<td><b>3.0.x<br/>Standalone + Plugin</b></b></td>
</tr>
<tr>
<td><b>3.7.x (LTS)</b></td>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>fr.cnes.sonar</groupId>
<artifactId>cnesreport</artifactId>
<version>3.0.0</version>
<version>3.0.1</version>
<packaging>sonar-plugin</packaging>

<name>SonarQube CNES Report</name>
Expand Down
46 changes: 30 additions & 16 deletions src/main/java/fr/cnes/sonar/report/exporters/docx/DataAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public final class DataAdapter {
/**
* List of possible issue types
*/
private static final String[] ISSUE_TYPES = {"VULNERABILITY", "BUG", "CODE_SMELL"};
private static final String[] ISSUE_TYPES = {"VULNERABILITY", "BUG", "CODE_SMELL", "SECURITY_HOTSPOT"};
/**
* List of possible issue severities
*/
Expand Down Expand Up @@ -669,7 +669,7 @@ private static String findMeasure(List<Measure> measures, String metric) {
}

/**
* RuleComparator is used to compare 2 issues to sort them by severityq
* RuleComparator is used to compare 2 issues to sort them by type & severity
*/
class RuleComparator implements Comparator<String>{
Report report;
Expand All @@ -679,20 +679,34 @@ class RuleComparator implements Comparator<String>{
}

public int compare(String o1, String o2) {
if(o1.isEmpty() || o2.isEmpty())return 0;

int compare = report
.getRule(o1)
.getType()
.compareTo(
report.getRule(o2).getType()
);
if (compare == 0) compare = report.getRule(o1).getSeverity().compareTo(
report.getRule(o2).getSeverity()
);
if (compare == 0) compare = report.getRule(o1).getKey().compareTo(
report.getRule(o2).getKey()
);
int compare = 0;

if(o1.isEmpty() || o2.isEmpty())compare = 1;

//If rule is removed in quality gate, the issue is send to the end of list
if(report.getRule(o1) == null){compare = 1;}
else if(report.getRule(o2) == null){compare = -1;}

if (compare == 0){
compare = report
.getRule(o1)
.getType()
.compareTo(
report.getRule(o2).getType()
);
}

if (compare == 0) {
compare = report.getRule(o1).getSeverity().compareTo(
report.getRule(o2).getSeverity()
);
}

if (compare == 0){
compare = report.getRule(o1).getKey().compareTo(
report.getRule(o2).getKey()
);
}

return compare;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class ServerFactory {

/** List of SonarQube versions which are supported by cnesreport. */
private static final List<String> SUPPORTED_VERSIONS = Arrays.asList(
"5.6.*", "6.*", "7.*");
"6.6", "6.6.*", "6.7", "6.7.*", "7.*", "8.*");

/** Url of the SonarQube server. */
private String url;
Expand Down

0 comments on commit 86ef340

Please sign in to comment.