diff --git a/README.md b/README.md index 1d76ecec..e345ce42 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,7 @@ java -Dhttps.proxyHost=https://myproxy -Dhttps.proxyPort=42 2.0.0
Standalone only
2.1.0
Standalone only
2.2.0
Standalone + Plugin
- 3.0.0
Standalone + Plugin
+ 3.0.x
Standalone + Plugin
3.7.x (LTS) diff --git a/pom.xml b/pom.xml index 12ee8903..10d644f7 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ fr.cnes.sonar cnesreport - 3.0.0 + 3.0.1 sonar-plugin SonarQube CNES Report diff --git a/src/main/java/fr/cnes/sonar/report/exporters/docx/DataAdapter.java b/src/main/java/fr/cnes/sonar/report/exporters/docx/DataAdapter.java index d2d47135..cd05a790 100644 --- a/src/main/java/fr/cnes/sonar/report/exporters/docx/DataAdapter.java +++ b/src/main/java/fr/cnes/sonar/report/exporters/docx/DataAdapter.java @@ -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 */ @@ -669,7 +669,7 @@ private static String findMeasure(List 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{ Report report; @@ -679,20 +679,34 @@ class RuleComparator implements Comparator{ } 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; } diff --git a/src/main/java/fr/cnes/sonar/report/factory/ServerFactory.java b/src/main/java/fr/cnes/sonar/report/factory/ServerFactory.java index 52371da2..0444dc22 100644 --- a/src/main/java/fr/cnes/sonar/report/factory/ServerFactory.java +++ b/src/main/java/fr/cnes/sonar/report/factory/ServerFactory.java @@ -32,7 +32,7 @@ public class ServerFactory { /** List of SonarQube versions which are supported by cnesreport. */ private static final List 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;