]> source.dussan.org Git - sonarqube.git/commitdiff
fix quality flaws
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Tue, 7 Jan 2020 10:46:09 +0000 (11:46 +0100)
committerSonarTech <sonartech@sonarsource.com>
Mon, 13 Jan 2020 19:46:36 +0000 (20:46 +0100)
server/sonar-server-common/src/main/java/org/sonar/server/rule/index/RuleIndexer.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/ChangeStatusAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/SearchAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/ShowAction.java

index 4a4dac17eca3cf17560672167a78b3fb14deb497..839890d3e68555eeb936fe1ec84b7d0254a8af32 100644 (file)
@@ -197,7 +197,7 @@ public class RuleIndexer implements ResilientIndexer {
     return Optional.of(bulkIndexer.stop());
   }
 
-  private RuleDoc ruleDocOf(RuleForIndexingDto dto) {
+  private static RuleDoc ruleDocOf(RuleForIndexingDto dto) {
     SecurityStandards securityStandards = SecurityStandards.fromSecurityStandards(dto.getSecurityStandards());
     if (!securityStandards.getIgnoredSQCategories().isEmpty()) {
       LOG.warn(
index 8e0ca3a2e1430e1a5dcf76e35f22684d6a603456..bd02c0d5f6996790b41182abeba89dc311f16c29 100644 (file)
@@ -20,6 +20,7 @@
 package org.sonar.server.hotspot.ws;
 
 import java.util.Objects;
+import javax.annotation.CheckForNull;
 import javax.annotation.Nullable;
 import org.sonar.api.issue.DefaultTransitions;
 import org.sonar.api.server.ws.Request;
@@ -111,6 +112,7 @@ public class ChangeStatusAction implements HotspotsWsAction {
     }
   }
 
+  @CheckForNull
   private static String resolutionParam(Request request, String newStatus) {
     String resolution = request.param(PARAM_RESOLUTION);
     checkArgument(STATUS_REVIEWED.equals(newStatus) || resolution == null,
@@ -122,7 +124,7 @@ public class ChangeStatusAction implements HotspotsWsAction {
     return resolution;
   }
 
-  private static boolean needStatusUpdate(IssueDto hotspot, String newStatus, String newResolution) {
+  private static boolean needStatusUpdate(IssueDto hotspot, String newStatus, @Nullable String newResolution) {
     return !(hotspot.getStatus().equals(newStatus) && Objects.equals(hotspot.getResolution(), newResolution));
   }
 
index f4c2793d2287b7642baa4ffcad09c584cb4c7cdd..3676f4abfa46fe53d7b6e7fa0ef68fd3abbf0814 100644 (file)
@@ -346,7 +346,7 @@ public class SearchAction implements HotspotsWsAction {
     return responseBuilder.build();
   }
 
-  private void formatPaging(SearchResponseData searchResponseData, SearchWsResponse.Builder responseBuilder) {
+  private static void formatPaging(SearchResponseData searchResponseData, SearchWsResponse.Builder responseBuilder) {
     Paging paging = searchResponseData.getPaging();
     Common.Paging.Builder pagingBuilder = Common.Paging.newBuilder()
       .setPageIndex(paging.pageIndex())
@@ -356,7 +356,7 @@ public class SearchAction implements HotspotsWsAction {
     responseBuilder.setPaging(pagingBuilder.build());
   }
 
-  private void formatHotspots(SearchResponseData searchResponseData, SearchWsResponse.Builder responseBuilder) {
+  private static void formatHotspots(SearchResponseData searchResponseData, SearchWsResponse.Builder responseBuilder) {
     List<IssueDto> orderedHotspots = searchResponseData.getOrderedHotspots();
     if (orderedHotspots.isEmpty()) {
       return;
index faaa13a0ac5a0e7b96841aaf014fb571901b28ed..9d7d48c573761863e8c6d95bf6c55f6775679a6a 100644 (file)
@@ -135,7 +135,7 @@ public class ShowAction implements HotspotsWsAction {
     return new Users(assignee, author);
   }
 
-  private void formatHotspot(ShowWsResponse.Builder builder, IssueDto hotspot, Users users) {
+  private static void formatHotspot(ShowWsResponse.Builder builder, IssueDto hotspot, Users users) {
     builder.setKey(hotspot.getKey());
     ofNullable(hotspot.getStatus()).ifPresent(builder::setStatus);
     ofNullable(hotspot.getResolution()).ifPresent(builder::setResolution);
@@ -154,7 +154,7 @@ public class ShowAction implements HotspotsWsAction {
     responseBuilder.setCanChangeStatus(hotspotWsSupport.canChangeStatus(components.getProject()));
   }
 
-  private void formatRule(ShowWsResponse.Builder responseBuilder, RuleDefinitionDto ruleDefinitionDto) {
+  private static void formatRule(ShowWsResponse.Builder responseBuilder, RuleDefinitionDto ruleDefinitionDto) {
     SecurityStandards securityStandards = SecurityStandards.fromSecurityStandards(ruleDefinitionDto.getSecurityStandards());
     SecurityStandards.SQCategory sqCategory = securityStandards.getSqCategory();
     HotspotRuleDescription hotspotRuleDescription = HotspotRuleDescription.from(ruleDefinitionDto);