]> source.dussan.org Git - sonarqube.git/commitdiff
Fix quality gates
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 5 Feb 2016 09:15:06 +0000 (10:15 +0100)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 5 Feb 2016 09:15:18 +0000 (10:15 +0100)
server/sonar-server/src/main/java/org/sonar/server/issue/IssueBulkChangeQuery.java
server/sonar-server/src/main/java/org/sonar/server/issue/actionplan/ActionPlanService.java
sonar-colorizer/src/main/java/org/sonar/colorizer/JavaConstantTokenizer.java
sonar-db/src/main/java/org/sonar/db/dashboard/DashboardDao.java
sonar-db/src/main/java/org/sonar/db/user/GroupDao.java
sonar-db/src/main/java/org/sonar/db/version/v52/MoveProjectProfileAssociation.java
sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Checks.java
sonar-plugin-api/src/main/java/org/sonar/api/checks/AnnotationCheckFactory.java

index 56c9f6016890018f888483954b7566412f2cd6e4..3df31d3a8ac47a76441f29c203b5c21a58f1bdf6 100644 (file)
@@ -80,7 +80,7 @@ public class IssueBulkChangeQuery {
     }
   }
 
-  private List<String> sanitizeList(@Nullable List<String> list) {
+  private static List<String> sanitizeList(@Nullable List<String> list) {
     if (list == null || list.isEmpty()) {
       return Collections.emptyList();
     }
index da1203291a6bf724e12c8530c01cab6ca50d7735..4ee93f6ded3ed32360f790a3b819f294f2da4bb2 100644 (file)
@@ -167,7 +167,7 @@ public class ActionPlanService {
     return !actionPlanDao.selectByNameAndProjectId(name, findProject(projectKey).getId()).isEmpty();
   }
 
-  private List<ActionPlan> toActionPlans(List<ActionPlanDto> actionPlanDtos) {
+  private static List<ActionPlan> toActionPlans(List<ActionPlanDto> actionPlanDtos) {
     return newArrayList(Iterables.transform(actionPlanDtos, ToActionPlan.INSTANCE));
   }
 
index cb10364604bc0f98c33871ab183b04f72ab8cb76..03222f0c67c5353b18d4b7bce9786c5ce581b0a6 100644 (file)
@@ -70,11 +70,11 @@ public class JavaConstantTokenizer extends Tokenizer {
     }
   }
 
-  private boolean isJavaConstantStart(int character) {
+  private static boolean isJavaConstantStart(int character) {
     return Character.isUpperCase(character);
   }
 
-  private boolean isJavaConstantPart(int character) {
+  private static boolean isJavaConstantPart(int character) {
     return Character.isUpperCase(character) || character == '_' || character == '-' || Character.isDigit(character);
   }
 
index fd283b3d18192a5516738a34b1ba4acc7aba524e..7dc94a8ecdf2079199cdfee7ca32eb692617d6e9 100644 (file)
@@ -48,15 +48,15 @@ public class DashboardDao implements Dao {
     DashboardMapper dashboardMapper = session.getMapper(DashboardMapper.class);
     WidgetMapper widgetMapper = session.getMapper(WidgetMapper.class);
     WidgetPropertyMapper widgetPropertyMapper = session.getMapper(WidgetPropertyMapper.class);
-      dashboardMapper.insert(dashboardDto);
-      for (WidgetDto widgetDto : dashboardDto.getWidgets()) {
-        widgetDto.setDashboardId(dashboardDto.getId());
-        widgetMapper.insert(widgetDto);
-        for (WidgetPropertyDto widgetPropertyDto : widgetDto.getWidgetProperties()) {
-          widgetPropertyDto.setWidgetId(widgetDto.getId());
-          widgetPropertyMapper.insert(widgetPropertyDto);
-        }
+    dashboardMapper.insert(dashboardDto);
+    for (WidgetDto widgetDto : dashboardDto.getWidgets()) {
+      widgetDto.setDashboardId(dashboardDto.getId());
+      widgetMapper.insert(widgetDto);
+      for (WidgetPropertyDto widgetPropertyDto : widgetDto.getWidgetProperties()) {
+        widgetPropertyDto.setWidgetId(widgetDto.getId());
+        widgetPropertyMapper.insert(widgetPropertyDto);
       }
+    }
   }
 
   public void insert(DashboardDto dashboardDto) {
index a10ffd71f271cae36f375d282ecb39f2d779cb74..db5e428cc1404f8ae0ff03b7c47f47e5ed9539be 100644 (file)
@@ -35,7 +35,6 @@ import org.sonar.db.WildcardPosition;
 
 public class GroupDao implements Dao {
 
-  private static final String SQL_WILDCARD = "%";
   private System2 system;
 
   public GroupDao(System2 system) {
index 21451eb8fb89ea95cfbc430fdb6663216a4bda8b..bbfdd267962a34d62623c9c4a6b3ffb362f4600c 100644 (file)
@@ -79,6 +79,11 @@ public class MoveProjectProfileAssociation extends BaseDataChange {
       update.setLong(1, id);
       return true;
     }
+
+    private static String extractLanguage(String propertyKey) {
+      return propertyKey.substring("sonar.profile.".length());
+    }
+
   }
 
   private static final Logger LOGGER = Loggers.get(MoveProjectProfileAssociation.class);
@@ -111,10 +116,6 @@ public class MoveProjectProfileAssociation extends BaseDataChange {
     }
   }
 
-  private static String extractLanguage(String propertyKey) {
-    return propertyKey.substring("sonar.profile.".length());
-  }
-
   private Table<String, String, String> getProfileKeysByLanguageThenName(final Context context) throws SQLException {
     final Table<String, String, String> profilesByLanguageAndName = HashBasedTable.create();
 
index 3566f57db81bb67b0f8271610e9dcb3b77b3acba..09bb71d7f66cd6a589efdedd105e407b2b23b0c7 100644 (file)
@@ -162,9 +162,7 @@ public class Checks<C> {
       }
       configureFields(activeRule, check);
       return check;
-    } catch (InstantiationException e) {
-      throw failToInstantiateCheck(activeRule, checkClassOrInstance, e);
-    } catch (IllegalAccessException e) {
+    } catch (InstantiationException | IllegalAccessException e) {
       throw failToInstantiateCheck(activeRule, checkClassOrInstance, e);
     }
   }
index a677bf45b9cdc71a0f14dda95d6e3fb88ac4251c..c5303b05c863e8bda9fdc54f8f545434f9a11b32 100644 (file)
@@ -83,11 +83,9 @@ public final class AnnotationCheckFactory extends CheckFactory {
       configureFields(activeRule, check);
       return check;
 
-    } catch (InstantiationException e) {
+    } catch (InstantiationException | IllegalAccessException e) {
       throw new SonarException(CAN_NOT_INSTANTIATE_THE_CHECK_RELATED_TO_THE_RULE + activeRule, e);
 
-    } catch (IllegalAccessException e) {
-      throw new SonarException(CAN_NOT_INSTANTIATE_THE_CHECK_RELATED_TO_THE_RULE + activeRule, e);
     }
   }