diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2024-12-18 11:00:05 +0100 |
---|---|---|
committer | Steve Marion <steve.marion@sonarsource.com> | 2024-12-18 11:13:25 +0100 |
commit | fb42f37f9e0f25420d67211690aa9bd4273faa08 (patch) | |
tree | 7a3a614cb7fb22f9f2f2dd77987b461ce09bd462 /sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ImpactMapper.java | |
parent | d3bba946fe854e126d713fce6dcfbcaa61b6eedd (diff) | |
download | sonarqube-fb42f37f9e0f25420d67211690aa9bd4273faa08.tar.gz sonarqube-fb42f37f9e0f25420d67211690aa9bd4273faa08.zip |
SONAR-23974 Optimize the scanner report
Diffstat (limited to 'sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ImpactMapper.java')
-rw-r--r-- | sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ImpactMapper.java | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ImpactMapper.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ImpactMapper.java new file mode 100644 index 00000000000..76111b56055 --- /dev/null +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ImpactMapper.java @@ -0,0 +1,38 @@ +/* + * SonarQube + * Copyright (C) 2009-2024 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.scanner.issue; + +import org.sonar.api.issue.impact.Severity; +import org.sonar.scanner.protocol.output.ScannerReport; + +public class ImpactMapper { + private ImpactMapper() { + } + + public static ScannerReport.ImpactSeverity mapImpactSeverity(Severity severity) { + return switch (severity) { + case BLOCKER -> ScannerReport.ImpactSeverity.ImpactSeverity_BLOCKER; + case HIGH -> ScannerReport.ImpactSeverity.ImpactSeverity_HIGH; + case MEDIUM -> ScannerReport.ImpactSeverity.ImpactSeverity_MEDIUM; + case LOW -> ScannerReport.ImpactSeverity.ImpactSeverity_LOW; + case INFO -> ScannerReport.ImpactSeverity.ImpactSeverity_INFO; + }; + } +} |