]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-16316 Minor fixes to regulatory report
authorJacek <jacek.poreda@sonarsource.com>
Wed, 1 Jun 2022 11:18:19 +0000 (13:18 +0200)
committersonartech <sonartech@sonarsource.com>
Thu, 2 Jun 2022 20:03:17 +0000 (20:03 +0000)
- Rename files from 'issues' to 'findings'
- Fix label on files included in zip file in regulatory template
- Exclude CODE_SMELLS from findings CSVs

server/sonar-db-dao/src/main/resources/org/sonar/db/report/RegulatoryReportMapper.xml
server/sonar-db-dao/src/test/java/org/sonar/db/report/RegulatoryReportDaoTest.java

index dc8be684288cff5e316f66c13a9b6a302945e2e7..dc9cb020b2e383c3f155c27f7b7258f7286b438f 100644 (file)
@@ -61,6 +61,8 @@
     left join new_code_reference_issues n on i.kee = n.issue_key
     where i.project_uuid=#{branchUuid,jdbcType=VARCHAR}
     and i.status !='CLOSED'
+    <!--BUG, VULNERABILITY, SECURITY_HOTSPOT    -->
+    and i.issue_type in (2, 3, 4)
     order by i.kee, ic.issue_change_creation_date
   </select>
 </mapper>
index ca2d6391b50b5a57335cbb234edc4a8493078b70..30b3152793f22851cb52bf8627618a7f3b987b4a 100644 (file)
@@ -24,6 +24,7 @@ import java.util.List;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
+import org.sonar.api.rules.RuleType;
 import org.sonar.api.utils.System2;
 import org.sonar.db.DbTester;
 import org.sonar.db.component.ComponentDto;
@@ -48,20 +49,23 @@ public class RegulatoryReportDaoTest {
   private final RegulatoryReportDao underTest = db.getDbClient().regulatoryReportDao();
   private ComponentDto project;
   private RuleDto rule;
+  private RuleDto hotspotRule;
   private ComponentDto file;
 
   @Before
   public void prepare() {
     rule = db.rules().insertRule();
+    hotspotRule = db.rules().insertHotspotRule();
     project = db.components().insertPrivateProject(t -> t.setProjectUuid(PROJECT_UUID).setUuid(PROJECT_UUID).setDbKey(PROJECT_KEY));
     file = db.components().insertComponent(newFileDto(project).setUuid(FILE_UUID).setDbKey(FILE_KEY));
   }
 
   @Test
   public void scrollIssues_returns_all_non_closed_issues_for_project() {
-    IssueDto issue1 = db.issues().insertIssue(rule, project, file, i -> i.setStatus("OPEN").setResolution(null));
-    IssueDto issue2 = db.issues().insertIssue(rule, project, file, i -> i.setStatus("CONFIRMED").setResolution(null));
-    IssueDto issue3 = db.issues().insertIssue(rule, project, file, i -> i.setStatus("RESOLVED").setResolution(RESOLUTION_WONT_FIX));
+    IssueDto issue1 = db.issues().insertIssue(rule, project, file, i -> i.setType(RuleType.BUG).setStatus("OPEN").setResolution(null));
+    IssueDto issue2 = db.issues().insertIssue(rule, project, file, i -> i.setType(RuleType.VULNERABILITY).setStatus("CONFIRMED").setResolution(null));
+    IssueDto issue3 = db.issues().insertHotspot(hotspotRule, project, file, i -> i.setStatus("RESOLVED").setResolution(RESOLUTION_WONT_FIX));
+    IssueDto issueCodeSmell = db.issues().insertIssue(rule, project, file, i -> i.setType(RuleType.CODE_SMELL).setStatus("RESOLVED").setResolution(RESOLUTION_WONT_FIX));
 
     // comments
     db.issues().insertChange(issue1, ic -> ic.setChangeData("c1").setIssueChangeCreationDate(1000L).setChangeType("comment"));