aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api-impl/src
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2024-04-04 14:12:14 +0200
committersonartech <sonartech@sonarsource.com>2024-04-05 20:02:38 +0000
commit34d71f5c14a0dec4679334adb054db2fc5d3fbbb (patch)
tree54f3bf8c7009e5ea883c502c24991c1bafb04369 /sonar-plugin-api-impl/src
parent57ae7aabd549c7d4fd05ea095fc1c2f7a7c0ca5d (diff)
downloadsonarqube-34d71f5c14a0dec4679334adb054db2fc5d3fbbb.tar.gz
sonarqube-34d71f5c14a0dec4679334adb054db2fc5d3fbbb.zip
Remove dead code
Diffstat (limited to 'sonar-plugin-api-impl/src')
-rw-r--r--sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/rule/internal/DefaultRule.java105
-rw-r--r--sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/rule/internal/DefaultRuleParam.java47
-rw-r--r--sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/rule/internal/NewRule.java86
-rw-r--r--sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/rule/internal/NewRuleParam.java36
4 files changed, 0 insertions, 274 deletions
diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/rule/internal/DefaultRule.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/rule/internal/DefaultRule.java
deleted file mode 100644
index 02cf152a0d4..00000000000
--- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/rule/internal/DefaultRule.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 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.
- */
-package org.sonar.api.batch.rule.internal;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import javax.annotation.CheckForNull;
-import javax.annotation.concurrent.Immutable;
-import org.sonar.api.batch.rule.Rule;
-import org.sonar.api.batch.rule.RuleParam;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.api.rule.RuleStatus;
-
-@Immutable
-public class DefaultRule implements Rule {
-
- private final RuleKey key;
- private final String name;
- private final String severity;
- private final String type;
- private final String description;
- private final String internalKey;
- private final RuleStatus status;
- private final Map<String, RuleParam> params;
-
- public DefaultRule(NewRule newRule) {
- this.key = newRule.key;
- this.name = newRule.name;
- this.severity = newRule.severity;
- this.type = newRule.type;
- this.description = newRule.description;
- this.internalKey = newRule.internalKey;
- this.status = newRule.status;
-
- Map<String, RuleParam> builder = new HashMap<>();
- for (NewRuleParam newRuleParam : newRule.params.values()) {
- builder.put(newRuleParam.key, new DefaultRuleParam(newRuleParam));
- }
- params = Collections.unmodifiableMap(builder);
- }
-
- @Override
- public RuleKey key() {
- return key;
- }
-
- @Override
- public String name() {
- return name;
- }
-
- @Override
- public String severity() {
- return severity;
- }
-
- @CheckForNull
- public String type() {
- return type;
- }
-
- @Override
- public String description() {
- return description;
- }
-
- @Override
- public String internalKey() {
- return internalKey;
- }
-
- @Override
- public RuleStatus status() {
- return status;
- }
-
- @Override
- public RuleParam param(String paramKey) {
- return params.get(paramKey);
- }
-
- @Override
- public Collection<RuleParam> params() {
- return params.values();
- }
-}
diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/rule/internal/DefaultRuleParam.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/rule/internal/DefaultRuleParam.java
deleted file mode 100644
index 50cd5db2f3e..00000000000
--- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/rule/internal/DefaultRuleParam.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 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.
- */
-package org.sonar.api.batch.rule.internal;
-
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-import org.sonar.api.batch.rule.RuleParam;
-
-@Immutable
-class DefaultRuleParam implements RuleParam {
-
- private final String key;
- private final String description;
-
- DefaultRuleParam(NewRuleParam p) {
- this.key = p.key;
- this.description = p.description;
- }
-
- @Override
- public String key() {
- return key;
- }
-
- @Override
- @Nullable
- public String description() {
- return description;
- }
-}
diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/rule/internal/NewRule.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/rule/internal/NewRule.java
deleted file mode 100644
index 660b31fa69b..00000000000
--- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/rule/internal/NewRule.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 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.
- */
-package org.sonar.api.batch.rule.internal;
-
-import java.util.HashMap;
-import java.util.Map;
-import javax.annotation.Nullable;
-import org.apache.commons.lang3.ObjectUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.api.rule.RuleStatus;
-import org.sonar.api.rule.Severity;
-
-public class NewRule {
-
- private static final String DEFAULT_SEVERITY = Severity.defaultSeverity();
-
- final RuleKey key;
- String name;
- String description;
- String severity = DEFAULT_SEVERITY;
- String type;
- String internalKey;
- RuleStatus status = RuleStatus.defaultStatus();
- Map<String, NewRuleParam> params = new HashMap<>();
-
- public NewRule(RuleKey key) {
- this.key = key;
- }
-
- public NewRule setDescription(@Nullable String description) {
- this.description = description;
- return this;
- }
-
- public NewRule setName(@Nullable String s) {
- this.name = s;
- return this;
- }
-
- public NewRule setSeverity(@Nullable String severity) {
- this.severity = StringUtils.defaultIfBlank(severity, DEFAULT_SEVERITY);
- return this;
- }
-
- public NewRule setType(@Nullable String type) {
- this.type = type;
- return this;
- }
-
- public NewRule setStatus(@Nullable RuleStatus s) {
- this.status = ObjectUtils.defaultIfNull(s, RuleStatus.defaultStatus());
- return this;
- }
-
- public NewRule setInternalKey(@Nullable String s) {
- this.internalKey = s;
- return this;
- }
-
- public NewRuleParam addParam(String paramKey) {
- if (params.containsKey(paramKey)) {
- throw new IllegalStateException(String.format("Parameter '%s' already exists on rule '%s'", paramKey, key));
- }
- NewRuleParam param = new NewRuleParam(paramKey);
- params.put(paramKey, param);
- return param;
- }
-}
diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/rule/internal/NewRuleParam.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/rule/internal/NewRuleParam.java
deleted file mode 100644
index 81ce13e593e..00000000000
--- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/rule/internal/NewRuleParam.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 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.
- */
-package org.sonar.api.batch.rule.internal;
-
-import javax.annotation.Nullable;
-
-public class NewRuleParam {
- final String key;
- String description;
-
- NewRuleParam(String key) {
- this.key = key;
- }
-
- public NewRuleParam setDescription(@Nullable String s) {
- description = s;
- return this;
- }
-}