From 20afbdaec8a746a8d07624f5927f8ee14b32cf7f Mon Sep 17 00:00:00 2001 From: Klaudio Sinani Date: Thu, 27 Jan 2022 18:28:45 +0100 Subject: [PATCH] [NO-JIRA] Fix reported code smells --- .../period/NewCodePeriodResolver.java | 2 +- .../sonar/db/ce/CeTaskCharacteristicDto.java | 4 ---- .../sonar/server/monitoring/package-info.java | 23 +++++++++++++++++++ .../sensor/internal/SensorContextTester.java | 1 - .../scanner/sensor/DefaultSensorStorage.java | 2 -- 5 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 server/sonar-webserver-webapi/src/main/java/org/sonar/server/monitoring/package-info.java diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/period/NewCodePeriodResolver.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/period/NewCodePeriodResolver.java index 257c3fd02f2..4e83d5e6310 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/period/NewCodePeriodResolver.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/period/NewCodePeriodResolver.java @@ -84,7 +84,7 @@ public class NewCodePeriodResolver { } } - private Period resolveByReferenceBranch(String value) { + private static Period resolveByReferenceBranch(String value) { return newPeriod(NewCodePeriodType.REFERENCE_BRANCH, value, null); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/ce/CeTaskCharacteristicDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/ce/CeTaskCharacteristicDto.java index 75928668ec8..c67ddfa69b5 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/ce/CeTaskCharacteristicDto.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/ce/CeTaskCharacteristicDto.java @@ -19,12 +19,8 @@ */ package org.sonar.db.ce; -import java.util.HashSet; import java.util.Set; -import static java.util.Arrays.asList; -import static java.util.Collections.unmodifiableSet; - public class CeTaskCharacteristicDto { public static final String BRANCH_KEY = "branch"; diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/monitoring/package-info.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/monitoring/package-info.java new file mode 100644 index 00000000000..88f058e64bf --- /dev/null +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/monitoring/package-info.java @@ -0,0 +1,23 @@ +/* + * SonarQube + * Copyright (C) 2009-2021 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +@ParametersAreNonnullByDefault +package org.sonar.server.monitoring; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/internal/SensorContextTester.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/internal/SensorContextTester.java index 81f0cf06059..b2daf362d9f 100644 --- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/internal/SensorContextTester.java +++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/internal/SensorContextTester.java @@ -30,7 +30,6 @@ import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; -import java.util.stream.Stream; import javax.annotation.CheckForNull; import javax.annotation.Nullable; import org.sonar.api.SonarQubeSide; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorStorage.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorStorage.java index e2cb11a7194..d46634f87ce 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorStorage.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorStorage.java @@ -75,8 +75,6 @@ import org.sonar.scanner.repository.ContextPropertiesCache; import org.sonar.scanner.scan.branch.BranchConfiguration; import static java.lang.Math.max; -import static java.util.Arrays.asList; -import static java.util.Collections.unmodifiableSet; import static java.util.stream.Collectors.toList; import static org.sonar.api.measures.CoreMetrics.COMMENT_LINES_DATA_KEY; import static org.sonar.api.measures.CoreMetrics.LINES_KEY; -- 2.39.5