From b6b153c18115ebae35f0feb0c2243eae0a62c05b Mon Sep 17 00:00:00 2001 From: =?utf8?q?L=C3=A9o=20Geoffroy?= Date: Tue, 23 Jul 2024 13:31:31 +0200 Subject: [PATCH] SONAR-22542 Fix SonarQube issue --- .../sonar/server/hotspot/ws/SearchAction.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/SearchAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/SearchAction.java index c9e4a331c28..09b0cefe680 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/SearchAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/SearchAction.java @@ -272,6 +272,16 @@ public class SearchAction implements HotspotsWsAction { .setBooleanPossibleValues() .setDefaultValue("false") .setSince("9.5"); + createSecurityStandardParams(action); + action.createParam(PARAM_FILES) + .setDescription("Comma-separated list of files. Returns only hotspots found in those files") + .setExampleValue("src/main/java/org/sonar/server/Test.java") + .setSince("9.0"); + + action.setResponseExample(getClass().getResource("search-example.json")); + } + + private static void createSecurityStandardParams(WebService.NewAction action) { action.createParam(PARAM_OWASP_ASVS_LEVEL) .setDescription("Filters hotspots with lower or equal OWASP ASVS level to the parameter value. Should be used in combination with the 'owaspAsvs-4.0' parameter.") .setSince("9.7") @@ -319,12 +329,6 @@ public class SearchAction implements HotspotsWsAction { .setDescription("Comma-separated list of CWE numbers") .setExampleValue("89,434,352") .setSince("8.8"); - action.createParam(PARAM_FILES) - .setDescription("Comma-separated list of files. Returns only hotspots found in those files") - .setExampleValue("src/main/java/org/sonar/server/Test.java") - .setSince("9.0"); - - action.setResponseExample(getClass().getResource("search-example.json")); } private Optional getAndValidateProjectOrApplication(DbSession dbSession, WsRequest wsRequest) { -- 2.39.5