]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-19850 Fix code smells
authorBenjamin Campomenosi <benjamin.campomenosi@sonarsource.com>
Wed, 19 Jul 2023 14:36:48 +0000 (16:36 +0200)
committersonartech <sonartech@sonarsource.com>
Wed, 19 Jul 2023 20:03:06 +0000 (20:03 +0000)
server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/azure/ImportAzureProjectAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/newcodeperiod/NewCodeDefinitionResolver.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/project/ws/BulkDeleteAction.java

index ffd00262e30dc8aa0afdc78f41b6ad4465e1d416..4f7b971c215d61046184dea36c171fb0da041ca3 100644 (file)
@@ -91,8 +91,8 @@ public class ImportAzureProjectAction implements AlmIntegrationsWsAction {
   public void define(WebService.NewController context) {
     WebService.NewAction action = context.createAction("import_azure_project")
       .setDescription("Create a SonarQube project with the information from the provided Azure DevOps project.<br/>" +
-                      "Autoconfigure pull request decoration mechanism.<br/>" +
-                      "Requires the 'Create Projects' permission")
+        "Autoconfigure pull request decoration mechanism.<br/>" +
+        "Requires the 'Create Projects' permission")
       .setPost(true)
       .setInternal(true)
       .setSince("8.6")
@@ -175,11 +175,11 @@ public class ImportAzureProjectAction implements AlmIntegrationsWsAction {
     boolean visibility = projectDefaultVisibility.get(dbSession).isPrivate();
     String uniqueProjectKey = projectKeyGenerator.generateUniqueProjectKey(repo.getProject().getName(), repo.getName());
     return componentUpdater.createWithoutCommit(dbSession, newComponentBuilder()
-        .setKey(uniqueProjectKey)
-        .setName(repo.getName())
-        .setPrivate(visibility)
-        .setQualifier(PROJECT)
-        .build(),
+      .setKey(uniqueProjectKey)
+      .setName(repo.getName())
+      .setPrivate(visibility)
+      .setQualifier(PROJECT)
+      .build(),
       userSession.isLoggedIn() ? userSession.getUuid() : null,
       userSession.isLoggedIn() ? userSession.getLogin() : null,
       repo.getDefaultBranchName());
index a91268891c2ee36bb2fdcbe9cea983d1dbb63fc5..cbe969d59f768e60ac100db017fc33bc2dd20e26 100644 (file)
@@ -71,7 +71,7 @@ public class NewCodeDefinitionResolver {
   }
 
   public void createNewCodeDefinition(DbSession dbSession, String projectUuid, String mainBranchUuid,
-    String defaultBranchName, String newCodeDefinitionType, String newCodeDefinitionValue) {
+    String defaultBranchName, String newCodeDefinitionType, @Nullable String newCodeDefinitionValue) {
 
     boolean isCommunityEdition = editionProvider.get().filter(EditionProvider.Edition.COMMUNITY::equals).isPresent();
     NewCodePeriodType newCodePeriodType = parseNewCodeDefinitionType(newCodeDefinitionType);
index 9f1d77e665801029414d5b6b5a3bb88b39c7acc6..1e2e947e031861b6867088eb3ac249c94055e729 100644 (file)
@@ -51,7 +51,6 @@ import org.sonar.server.project.Visibility;
 import org.sonar.server.user.UserSession;
 
 import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.collect.ImmutableSet.toImmutableSet;
 import static java.lang.Math.min;
 import static java.lang.String.format;
 import static java.util.stream.Collectors.toSet;
@@ -160,13 +159,13 @@ public class BulkDeleteAction implements ProjectsWsAction {
       try {
         entities.forEach(p -> componentCleanerService.deleteEntity(dbSession, p));
       } finally {
-        callDeleteListeners(dbSession, mainBranchUuidByEntityUuid, entities);
+        callDeleteListeners(mainBranchUuidByEntityUuid, entities);
       }
     }
     response.noContent();
   }
 
-  private void callDeleteListeners(DbSession dbSession, Map<String, String> mainBranchUuidByEntityUuid , List<EntityDto> entities) {
+  private void callDeleteListeners(Map<String, String> mainBranchUuidByEntityUuid , List<EntityDto> entities) {
     Set<DeletedProject> deletedProjects = entities.stream().map(entity -> new DeletedProject(Project.from(entity),
         mainBranchUuidByEntityUuid.get(entity.getUuid()))).collect(toSet());
     projectLifeCycleListeners.onProjectsDeleted(deletedProjects);