diff options
author | Matteo Mara <matteo.mara@sonarsource.com> | 2022-03-17 17:42:47 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-03-18 20:02:58 +0000 |
commit | a62adeea05495e24836f7857d598e46d2befd9f7 (patch) | |
tree | d91503540a53d50483943ba475a9700449eecfe9 /sonar-plugin-api | |
parent | cca0f3a1868b0b1c95d3fba0486cd8b81f696382 (diff) | |
download | sonarqube-a62adeea05495e24836f7857d598e46d2befd9f7.tar.gz sonarqube-a62adeea05495e24836f7857d598e46d2befd9f7.zip |
SONAR-16123 Update security_reports endpoint
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java | 10 | ||||
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultNewRule.java | 9 |
2 files changed, 11 insertions, 8 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java index 0e9267ce7b8..6d33f2dc0ee 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java @@ -250,17 +250,23 @@ public interface RulesDefinition { } enum OwaspTop10Version { - Y2017("2017"), Y2021("2021"); + Y2017("2017", "owaspTop10"), Y2021("2021", "owaspTop10-2021"); private final String label; + private final String prefix; - OwaspTop10Version(String label) { + OwaspTop10Version(String label, String prefix) { this.label = label; + this.prefix = prefix; } public String label() { return label; } + + public String prefix() { + return prefix; + } } enum OwaspTop10 { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultNewRule.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultNewRule.java index 7bc280e6bf6..9077055fe4c 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultNewRule.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultNewRule.java @@ -233,14 +233,11 @@ class DefaultNewRule extends RulesDefinition.NewRule { } @Override - public DefaultNewRule addOwaspTop10(OwaspTop10Version version, OwaspTop10... standards) { - Objects.requireNonNull(version, "Owasp version must not be null"); - - //backward compatibility - String versionPrefix = OwaspTop10Version.Y2017.equals(version) ? "owaspTop10:" : "owaspTop10-" + version.label() + ":"; + public DefaultNewRule addOwaspTop10(OwaspTop10Version owaspTop10Version, OwaspTop10... standards) { + Objects.requireNonNull(owaspTop10Version, "Owasp version must not be null"); for (OwaspTop10 owaspTop10 : standards) { - String standard = versionPrefix + owaspTop10.name().toLowerCase(Locale.ENGLISH); + String standard = owaspTop10Version.prefix() + ":" + owaspTop10.name().toLowerCase(Locale.ENGLISH); securityStandards.add(standard); } return this; |