diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2024-09-05 17:29:35 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-09-12 20:02:54 +0000 |
commit | 55dfebf3ece23eb11e9d2ea9b862b6fad3dbbfbc (patch) | |
tree | 1dd5101d80aad8a0ad309aac649f9fa3a52ef8ab /sonar-scanner-engine/src/main/java/org/sonar/scanner | |
parent | 574637dc96a0655344a0623fa1aae861fe073a86 (diff) | |
download | sonarqube-55dfebf3ece23eb11e9d2ea9b862b6fad3dbbfbc.tar.gz sonarqube-55dfebf3ece23eb11e9d2ea9b862b6fad3dbbfbc.zip |
SONAR-22914 Add a Sensor to import FOSSA results
Diffstat (limited to 'sonar-scanner-engine/src/main/java/org/sonar/scanner')
-rw-r--r-- | sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/IssuePublisher.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/IssuePublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/IssuePublisher.java index 66329f4e6ac..d09209bb2c7 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/IssuePublisher.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/IssuePublisher.java @@ -37,6 +37,7 @@ import org.sonar.api.batch.sensor.issue.Issue; import org.sonar.api.batch.sensor.issue.Issue.Flow; import org.sonar.api.batch.sensor.issue.MessageFormatting; import org.sonar.api.batch.sensor.issue.NewIssue.FlowType; +import org.sonar.api.batch.sensor.issue.internal.DefaultExternalIssue; import org.sonar.api.batch.sensor.issue.internal.DefaultIssueFlow; import org.sonar.api.issue.impact.SoftwareQuality; import org.sonar.api.rules.CleanCodeAttribute; @@ -88,9 +89,9 @@ public class IssuePublisher { private static boolean noSonar(DefaultInputComponent inputComponent, Issue issue) { TextRange textRange = issue.primaryLocation().textRange(); return inputComponent.isFile() - && textRange != null - && ((DefaultInputFile) inputComponent).hasNoSonarAt(textRange.start().line()) - && !StringUtils.containsIgnoreCase(issue.ruleKey().rule(), "nosonar"); + && textRange != null + && ((DefaultInputFile) inputComponent).hasNoSonarAt(textRange.start().line()) + && !StringUtils.containsIgnoreCase(issue.ruleKey().rule(), "nosonar"); } public void initAndAddExternalIssue(ExternalIssue issue) { @@ -176,7 +177,11 @@ public class IssuePublisher { locationBuilder.setComponentRef(componentRef); TextRange primaryTextRange = issue.primaryLocation().textRange(); - //nullable fields + // nullable fields + var cveId = ((DefaultExternalIssue) issue).cveId(); + if (cveId != null) { + builder.setCveId(cveId); + } CleanCodeAttribute cleanCodeAttribute = issue.cleanCodeAttribute(); if (cleanCodeAttribute != null) { builder.setCleanCodeAttribute(cleanCodeAttribute.name()); |