diff options
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; + }; + } +} |