Fix warnings.
Some checks failed
ci/woodpecker/push/build Pipeline was successful
CodeQL / Analyze (push) Has been cancelled
Java CI with Gradle / build (push) Has been cancelled
Deploy Jekyll site to Pages / build (push) Has been cancelled
Deploy Jekyll site to Pages / deploy (push) Has been cancelled

This commit is contained in:
Michael Lipp 2025-08-11 20:32:08 +02:00
parent 470c266157
commit c6c6358426
74 changed files with 56 additions and 215 deletions

View file

@ -32,13 +32,11 @@ import java.util.regex.Pattern;
public class Convertions {
@SuppressWarnings({ "PMD.UseConcurrentHashMap",
"PMD.FieldNamingConventions", "PMD.VariableNamingConventions" })
"PMD.FieldNamingConventions" })
private static final Map<String, BigInteger> unitMap = new HashMap<>();
@SuppressWarnings({ "PMD.FieldNamingConventions",
"PMD.VariableNamingConventions" })
@SuppressWarnings({ "PMD.FieldNamingConventions" })
private static final List<Map.Entry<String, BigInteger>> unitMappings;
@SuppressWarnings({ "PMD.FieldNamingConventions",
"PMD.VariableNamingConventions" })
@SuppressWarnings({ "PMD.FieldNamingConventions" })
private static final Pattern memorySize
= Pattern.compile("^\\s*(\\d+(\\.\\d+)?)\\s*([A-Za-z]*)\\s*");
@ -69,7 +67,6 @@ public class Convertions {
* @param amount the amount
* @return the big integer
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public static BigInteger parseMemory(Object amount) {
if (amount == null) {
return (BigInteger) amount;

View file

@ -47,8 +47,7 @@ import org.yaml.snakeyaml.constructor.SafeConstructor;
/**
* Helpers for K8s API.
*/
@SuppressWarnings({ "PMD.ShortClassName", "PMD.UseUtilityClass",
"PMD.DataflowAnomalyAnalysis" })
@SuppressWarnings({ "PMD.ShortClassName", "PMD.UseUtilityClass" })
public class K8s {
/**
@ -113,7 +112,6 @@ public class K8s {
public static JsonObject yamlToJson(ApiClient client, Reader yaml) {
// Avoid Yaml.load due to
// https://github.com/kubernetes-client/java/issues/2741
@SuppressWarnings("PMD.UseConcurrentHashMap")
Map<String, Object> yamlData
= new Yaml(new SafeConstructor(new LoaderOptions())).load(yaml);

View file

@ -48,8 +48,7 @@ import okhttp3.Response;
* A client with some additional properties.
*/
@SuppressWarnings({ "PMD.ExcessivePublicCount", "PMD.TooManyMethods",
"PMD.LinguisticNaming", "checkstyle:LineLength",
"PMD.CouplingBetweenObjects", "PMD.GodClass" })
"checkstyle:LineLength", "PMD.CouplingBetweenObjects", "PMD.GodClass" })
public class K8sClient extends ApiClient {
private ApiClient apiClient;
@ -231,7 +230,6 @@ public class K8sClient extends ApiClient {
* @return the api client
* @see ApiClient#setKeyManagers(javax.net.ssl.KeyManager[])
*/
@SuppressWarnings("PMD.UseVarargs")
@Override
public ApiClient setKeyManagers(KeyManager[] managers) {
return apiClient().setKeyManagers(managers);
@ -638,7 +636,6 @@ public class K8sClient extends ApiClient {
* @return the string
* @see ApiClient#selectHeaderAccept(java.lang.String[])
*/
@SuppressWarnings("PMD.UseVarargs")
@Override
public String selectHeaderAccept(String[] accepts) {
return apiClient().selectHeaderAccept(accepts);
@ -651,7 +648,6 @@ public class K8sClient extends ApiClient {
* @return the string
* @see ApiClient#selectHeaderContentType(java.lang.String[])
*/
@SuppressWarnings("PMD.UseVarargs")
@Override
public String selectHeaderContentType(String[] contentTypes) {
return apiClient().selectHeaderContentType(contentTypes);
@ -818,7 +814,7 @@ public class K8sClient extends ApiClient {
* @throws ApiException the api exception
* @see ApiClient#buildCall(java.lang.String, java.lang.String, java.util.List, java.util.List, java.lang.Object, java.util.Map, java.util.Map, java.util.Map, java.lang.String[], io.kubernetes.client.openapi.ApiCallback)
*/
@SuppressWarnings({ "rawtypes", "PMD.ExcessiveParameterList" })
@SuppressWarnings({ "rawtypes" })
@Override
public Call buildCall(String path, String method, List<Pair> queryParams,
List<Pair> collectionQueryParams, Object body,
@ -847,7 +843,7 @@ public class K8sClient extends ApiClient {
* @throws ApiException the api exception
* @see ApiClient#buildRequest(java.lang.String, java.lang.String, java.util.List, java.util.List, java.lang.Object, java.util.Map, java.util.Map, java.util.Map, java.lang.String[], io.kubernetes.client.openapi.ApiCallback)
*/
@SuppressWarnings({ "rawtypes", "PMD.ExcessiveParameterList" })
@SuppressWarnings({ "rawtypes" })
@Override
public Request buildRequest(String path, String method,
List<Pair> queryParams, List<Pair> collectionQueryParams,

View file

@ -45,8 +45,7 @@ import java.util.function.Function;
* @param <O> the generic type
* @param <L> the generic type
*/
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis",
"PMD.CouplingBetweenObjects" })
@SuppressWarnings({ "PMD.CouplingBetweenObjects" })
public class K8sClusterGenericStub<O extends KubernetesObject,
L extends KubernetesListObject> {
protected final K8sClient client;
@ -255,7 +254,6 @@ public class K8sClusterGenericStub<O extends KubernetesObject,
* @param name the name
* @return the result
*/
@SuppressWarnings("PMD.UseObjectForClearerAPI")
R get(Class<O> objectClass, Class<L> objectListClass, K8sClient client,
APIResource context, String name);
}
@ -284,7 +282,6 @@ public class K8sClusterGenericStub<O extends KubernetesObject,
* @return the stub if the object exists
* @throws ApiException the api exception
*/
@SuppressWarnings({ "PMD.AvoidBranchingStatementAsLastInLoop" })
public static <O extends KubernetesObject, L extends KubernetesListObject,
R extends K8sClusterGenericStub<O, L>>
R get(Class<O> objectClass, Class<L> objectListClass,
@ -315,8 +312,6 @@ public class K8sClusterGenericStub<O extends KubernetesObject,
* @return the stub if the object exists
* @throws ApiException the api exception
*/
@SuppressWarnings({ "PMD.AvoidBranchingStatementAsLastInLoop",
"PMD.UseObjectForClearerAPI" })
public static <O extends KubernetesObject, L extends KubernetesListObject,
R extends K8sClusterGenericStub<O, L>>
R get(Class<O> objectClass, Class<L> objectListClass,
@ -341,8 +336,6 @@ public class K8sClusterGenericStub<O extends KubernetesObject,
* @return the stub if the object exists
* @throws ApiException the api exception
*/
@SuppressWarnings({ "PMD.AvoidBranchingStatementAsLastInLoop",
"PMD.AvoidInstantiatingObjectsInLoops", "PMD.UseObjectForClearerAPI" })
public static <O extends KubernetesObject, L extends KubernetesListObject,
R extends K8sClusterGenericStub<O, L>>
R create(Class<O> objectClass, Class<L> objectListClass,

View file

@ -29,7 +29,6 @@ import io.kubernetes.client.openapi.models.V1ObjectMeta;
* notably the metadata, is made available through the methods
* defined by {@link KubernetesObject}.
*/
@SuppressWarnings("PMD.DataClass")
public class K8sDynamicModel implements KubernetesObject {
private final V1ObjectMeta metadata;

View file

@ -62,7 +62,7 @@ public class K8sDynamicModelsBase<T extends K8sDynamicModel>
} catch (InstantiationException | IllegalAccessException
| IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException exc) {
throw new IllegalArgumentException(exc); // NOPMD
throw new IllegalArgumentException(exc);
}
}
}

View file

@ -31,7 +31,6 @@ import java.util.Collection;
* state and can therefore be used for any kind of object, especially
* custom objects.
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public class K8sDynamicStub
extends K8sDynamicStubBase<K8sDynamicModel, K8sDynamicModels> {
@ -64,8 +63,6 @@ public class K8sDynamicStub
* @return the stub if the object exists
* @throws ApiException the api exception
*/
@SuppressWarnings({ "PMD.AvoidBranchingStatementAsLastInLoop",
"PMD.AvoidInstantiatingObjectsInLoops", "PMD.UseObjectForClearerAPI" })
public static K8sDynamicStub get(K8sClient client,
GroupVersionKind gvk, String namespace, String name)
throws ApiException {
@ -83,8 +80,6 @@ public class K8sDynamicStub
* @return the stub if the object exists
* @throws ApiException the api exception
*/
@SuppressWarnings({ "PMD.AvoidBranchingStatementAsLastInLoop",
"PMD.AvoidInstantiatingObjectsInLoops", "PMD.UseObjectForClearerAPI" })
public static K8sDynamicStub get(K8sClient client,
APIResource context, String namespace, String name) {
return new K8sDynamicStub(client, context, namespace, name);

View file

@ -26,7 +26,6 @@ import io.kubernetes.client.Discovery.APIResource;
* state and can therefore be used for any kind of object, especially
* custom objects.
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public abstract class K8sDynamicStubBase<O extends K8sDynamicModel,
L extends K8sDynamicModelsBase<O>> extends K8sGenericStub<O, L> {
@ -40,7 +39,6 @@ public abstract class K8sDynamicStubBase<O extends K8sDynamicModel,
* @param namespace the namespace
* @param name the name
*/
@SuppressWarnings("PMD.ConstructorCallsOverridableMethod")
public K8sDynamicStubBase(Class<O> objectClass,
Class<L> objectListClass, DynamicTypeAdapterFactory<O, L> taf,
K8sClient client, APIResource context, String namespace,

View file

@ -48,7 +48,7 @@ import java.util.function.Function;
* @param <O> the generic type
* @param <L> the generic type
*/
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis", "PMD.TooManyMethods" })
@SuppressWarnings({ "PMD.TooManyMethods" })
public class K8sGenericStub<O extends KubernetesObject,
L extends KubernetesListObject> {
protected final K8sClient client;
@ -200,7 +200,6 @@ public class K8sGenericStub<O extends KubernetesObject,
* @return the updated model or empty if the object was not found
* @throws ApiException the api exception
*/
@SuppressWarnings("PMD.AssignmentInOperand")
public Optional<O> updateStatus(O object, Function<O, Object> updater)
throws ApiException {
return K8s.optional(api.updateStatus(object, updater));
@ -218,7 +217,7 @@ public class K8sGenericStub<O extends KubernetesObject,
* @return the updated model or empty if the object was not found
* @throws ApiException the api exception
*/
@SuppressWarnings({ "PMD.AssignmentInOperand", "PMD.UnusedAssignment" })
@SuppressWarnings({ "PMD.AssignmentInOperand" })
public Optional<O> updateStatus(Function<O, Object> updater, O current,
int retries) throws ApiException {
while (true) {
@ -248,7 +247,6 @@ public class K8sGenericStub<O extends KubernetesObject,
* @return the updated model or empty if the object was not found
* @throws ApiException the api exception
*/
@SuppressWarnings({ "PMD.AssignmentInOperand", "PMD.UnusedAssignment" })
public Optional<O> updateStatus(Function<O, Object> updater, int retries)
throws ApiException {
return updateStatus(updater, null, retries);
@ -371,7 +369,6 @@ public class K8sGenericStub<O extends KubernetesObject,
* @param name the name
* @return the result
*/
@SuppressWarnings("PMD.UseObjectForClearerAPI")
R get(K8sClient client, String namespace, String name);
}
@ -397,8 +394,6 @@ public class K8sGenericStub<O extends KubernetesObject,
* @return the stub if the object exists
* @throws ApiException the api exception
*/
@SuppressWarnings({ "PMD.AvoidBranchingStatementAsLastInLoop",
"PMD.AvoidInstantiatingObjectsInLoops", "PMD.UseObjectForClearerAPI" })
public static <O extends KubernetesObject, L extends KubernetesListObject,
R extends K8sGenericStub<O, L>>
R create(Class<O> objectClass, Class<L> objectListClass,

View file

@ -50,7 +50,6 @@ public class K8sObserver<O extends KubernetesObject,
ADDED, MODIFIED, DELETED
}
@SuppressWarnings("PMD.FieldNamingConventions")
protected final Logger logger = Logger.getLogger(getClass().getName());
protected final K8sClient client;
@ -73,8 +72,7 @@ public class K8sObserver<O extends KubernetesObject,
* @param namespace the namespace
* @param options the options
*/
@SuppressWarnings({ "PMD.AvoidBranchingStatementAsLastInLoop",
"PMD.UseObjectForClearerAPI", "PMD.AvoidCatchingThrowable",
@SuppressWarnings({ "PMD.AvoidCatchingThrowable",
"PMD.CognitiveComplexity", "PMD.AvoidCatchingGenericException" })
public K8sObserver(Class<O> objectClass, Class<L> objectListClass,
K8sClient client, APIResource context, String namespace,
@ -100,7 +98,6 @@ public class K8sObserver<O extends KubernetesObject,
while (!Thread.currentThread().isInterrupted()) {
Instant startedAt = Instant.now();
try {
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
var changed
= api.watch(namespace, options).iterator();
while (changed.hasNext()) {
@ -233,7 +230,6 @@ public class K8sObserver<O extends KubernetesObject,
}
@Override
@SuppressWarnings("PMD.UseLocaleWithCaseConversions")
public String toString() {
return "Observer for " + K8s.toString(context) + " " + namespace;
}

View file

@ -26,7 +26,6 @@ import java.util.List;
/**
* A stub for config maps (v1).
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public class K8sV1ConfigMapStub
extends K8sGenericStub<V1ConfigMap, V1ConfigMapList> {

View file

@ -29,7 +29,6 @@ import java.util.Optional;
/**
* A stub for pods (v1).
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public class K8sV1DeploymentStub
extends K8sGenericStub<V1Deployment, V1DeploymentList> {

View file

@ -29,7 +29,6 @@ import java.util.List;
/**
* A stub for nodes (v1).
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public class K8sV1NodeStub extends K8sClusterGenericStub<V1Node, V1NodeList> {
public static final APIResource CONTEXT = new APIResource("", List.of("v1"),
@ -74,8 +73,7 @@ public class K8sV1NodeStub extends K8sClusterGenericStub<V1Node, V1NodeList> {
/**
* Provide {@link GenericSupplier}.
*/
@SuppressWarnings({ "PMD.UnusedFormalParameter",
"PMD.UnusedPrivateMethod" })
@SuppressWarnings({ "PMD.UnusedFormalParameter" })
private static K8sV1NodeStub getGeneric(Class<V1Node> objectClass,
Class<V1NodeList> objectListClass, K8sClient client,
APIResource context, String name) {

View file

@ -29,7 +29,6 @@ import java.util.List;
/**
* A stub for pods (v1).
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public class K8sV1PodStub extends K8sGenericStub<V1Pod, V1PodList> {
/** The pods' context. */

View file

@ -29,7 +29,6 @@ import java.util.List;
/**
* A stub for pods (v1).
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public class K8sV1PvcStub extends
K8sGenericStub<V1PersistentVolumeClaim, V1PersistentVolumeClaimList> {

View file

@ -29,7 +29,6 @@ import java.util.List;
/**
* A stub for secrets (v1).
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public class K8sV1SecretStub extends K8sGenericStub<V1Secret, V1SecretList> {
public static final APIResource CONTEXT = new APIResource("", List.of("v1"),

View file

@ -29,7 +29,6 @@ import java.util.List;
/**
* A stub for secrets (v1).
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public class K8sV1ServiceStub extends K8sGenericStub<V1Service, V1ServiceList> {
public static final APIResource CONTEXT = new APIResource("", List.of("v1"),

View file

@ -26,7 +26,6 @@ import java.util.List;
/**
* A stub for stateful sets (v1).
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public class K8sV1StatefulSetStub
extends K8sGenericStub<V1StatefulSet, V1StatefulSetList> {

View file

@ -46,11 +46,10 @@ import org.jdrupes.vmoperator.util.DataPath;
/**
* Represents a VM definition.
*/
@SuppressWarnings({ "PMD.DataClass", "PMD.TooManyMethods",
"PMD.CouplingBetweenObjects" })
@SuppressWarnings({ "PMD.DataClass", "PMD.TooManyMethods" })
public class VmDefinition extends K8sDynamicModel {
@SuppressWarnings({ "PMD.FieldNamingConventions", "unused" })
@SuppressWarnings({ "unused" })
private static final Logger logger
= Logger.getLogger(VmDefinition.class.getName());
@SuppressWarnings("PMD.FieldNamingConventions")

View file

@ -31,7 +31,6 @@ import java.util.Collection;
* state and can therefore be used for any kind of object, especially
* custom objects.
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public class VmDefinitionStub
extends K8sDynamicStubBase<VmDefinition, VmDefinitions> {
@ -64,8 +63,6 @@ public class VmDefinitionStub
* @return the stub if the object exists
* @throws ApiException the api exception
*/
@SuppressWarnings({ "PMD.AvoidBranchingStatementAsLastInLoop",
"PMD.AvoidInstantiatingObjectsInLoops", "PMD.UseObjectForClearerAPI" })
public static VmDefinitionStub get(K8sClient client,
GroupVersionKind gvk, String namespace, String name)
throws ApiException {
@ -83,8 +80,6 @@ public class VmDefinitionStub
* @return the stub if the object exists
* @throws ApiException the api exception
*/
@SuppressWarnings({ "PMD.AvoidBranchingStatementAsLastInLoop",
"PMD.AvoidInstantiatingObjectsInLoops", "PMD.UseObjectForClearerAPI" })
public static VmDefinitionStub get(K8sClient client,
APIResource context, String namespace, String name) {
return new VmDefinitionStub(client, context, namespace, name);

View file

@ -34,7 +34,6 @@ import java.util.logging.Logger;
*/
public class VmExtraData {
@SuppressWarnings("PMD.FieldNamingConventions")
private static final Logger logger
= Logger.getLogger(VmExtraData.class.getName());

View file

@ -35,7 +35,6 @@ import org.jdrupes.vmoperator.util.DataPath;
/**
* Represents a VM pool.
*/
@SuppressWarnings({ "PMD.DataClass" })
public class VmPool {
private final String name;

View file

@ -24,7 +24,6 @@ import org.jgrapes.core.Event;
/**
* Assign a VM from a pool to a user.
*/
@SuppressWarnings("PMD.DataClass")
public class AssignVm extends Event<VmData> {
private final String fromPool;

View file

@ -43,7 +43,6 @@ public interface ChannelDictionary<K, C extends Channel, A> {
* @param channel the channel
* @param associated the associated
*/
@SuppressWarnings("PMD.ShortClassName")
public record Value<C extends Channel, A>(C channel, A associated) {
}

View file

@ -149,8 +149,6 @@ public class ChannelManager<K, C extends Channel, A>
* @param supplier the supplier
* @return the channel
*/
@SuppressWarnings({ "PMD.AssignmentInOperand",
"PMD.DataflowAnomalyAnalysis" })
public C computeIfAbsent(K key, Function<K, C> supplier) {
return entries.computeIfAbsent(key,
k -> new Value<>(supplier.apply(k), null)).channel();

View file

@ -24,7 +24,6 @@ import org.jgrapes.core.Event;
/**
* Gets the current display secret and optionally updates it.
*/
@SuppressWarnings("PMD.DataClass")
public class GetDisplaySecret extends Event<String> {
private final VmDefinition vmDef;

View file

@ -27,7 +27,6 @@ import org.jgrapes.core.Event;
/**
* Gets the known pools' definitions.
*/
@SuppressWarnings("PMD.DataClass")
public class GetPools extends Event<List<VmPool>> {
private String name;

View file

@ -27,7 +27,6 @@ import org.jgrapes.core.Event;
/**
* Gets the known VMs' definitions and channels.
*/
@SuppressWarnings("PMD.DataClass")
public class GetVms extends Event<List<GetVms.VmData>> {
private String name;

View file

@ -24,7 +24,6 @@ import org.jgrapes.core.Event;
/**
* Modifies a VM.
*/
@SuppressWarnings("PMD.DataClass")
public class ModifyVm extends Event<Void> {
private final String name;

View file

@ -23,7 +23,6 @@ import org.jgrapes.core.Event;
/**
* Triggers a reset of the VM.
*/
@SuppressWarnings("PMD.DataClass")
public class ResetVm extends Event<String> {
private final String vmName;

View file

@ -24,7 +24,6 @@ import org.jgrapes.core.Event;
/**
* Note the assignment to a user in the VM status.
*/
@SuppressWarnings("PMD.DataClass")
public class UpdateAssignment extends Event<Boolean> {
private final VmPool fromPool;

View file

@ -28,7 +28,6 @@ import org.jgrapes.core.Subchannel.DefaultSubchannel;
/**
* A subchannel used to send the events related to a specific VM.
*/
@SuppressWarnings("PMD.DataClass")
public class VmChannel extends DefaultSubchannel {
private final EventPipeline pipeline;
@ -56,7 +55,6 @@ public class VmChannel extends DefaultSubchannel {
* @param definition the definition
* @return the watch channel
*/
@SuppressWarnings("PMD.LinguisticNaming")
public VmChannel setVmDefinition(VmDefinition definition) {
this.definition = definition;
return this;
@ -87,7 +85,6 @@ public class VmChannel extends DefaultSubchannel {
* @param generation the generation to set
* @return true if value has changed
*/
@SuppressWarnings("PMD.LinguisticNaming")
public boolean setGeneration(long generation) {
if (this.generation == generation) {
return false;

View file

@ -26,7 +26,6 @@ import org.jgrapes.core.Event;
/**
* Indicates a change in a pool configuration.
*/
@SuppressWarnings("PMD.DataClass")
public class VmPoolChanged extends Event<Void> {
private final VmPool vmPool;

View file

@ -51,7 +51,6 @@ import org.jgrapes.util.events.ConfigurationUpdate;
* @param <O> the object type for the context
* @param <L> the object list type for the context
*/
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis" })
public abstract class AbstractMonitor<O extends KubernetesObject,
L extends KubernetesListObject, C extends Channel> extends Component {
@ -181,7 +180,6 @@ public abstract class AbstractMonitor<O extends KubernetesObject,
* @param event the event
*/
@Handler(priority = 10)
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
public void onStart(Start event) {
try {
// Get namespace

View file

@ -56,7 +56,6 @@ import org.yaml.snakeyaml.constructor.SafeConstructor;
/**
* Delegee for reconciling the config map
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
/* default */ class ConfigMapReconciler {
protected final Logger logger = Logger.getLogger(getClass().getName());
@ -81,7 +80,6 @@ import org.yaml.snakeyaml.constructor.SafeConstructor;
* @throws TemplateException the template exception
* @throws ApiException the API exception
*/
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
public void reconcile(Map<String, Object> model, VmChannel channel,
boolean modelChanged)
throws IOException, TemplateException, ApiException {
@ -189,7 +187,6 @@ import org.yaml.snakeyaml.constructor.SafeConstructor;
private final TemplateMethodModelEx adjustCloudInitMetaModel
= new TemplateMethodModelEx() {
@Override
@SuppressWarnings("PMD.PreserveStackTrace")
public Object exec(@SuppressWarnings("rawtypes") List arguments)
throws TemplateModelException {
@SuppressWarnings("unchecked")

View file

@ -21,7 +21,6 @@ package org.jdrupes.vmoperator.manager;
/**
* Some constants.
*/
@SuppressWarnings("PMD.DataClass")
public class Constants extends org.jdrupes.vmoperator.common.Constants {
/** The Constant STATE_RUNNING. */

View file

@ -42,7 +42,6 @@ import org.jgrapes.core.Channel;
* of the pod running the VM in response to force an update of the files
* in the pod that reflect the information from the secret.
*/
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis", "PMD.TooManyStaticImports" })
public class DisplaySecretMonitor
extends AbstractMonitor<V1Secret, V1SecretList, VmChannel> {

View file

@ -45,7 +45,6 @@ import org.yaml.snakeyaml.constructor.SafeConstructor;
/**
* Delegee for reconciling the service
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
/* default */ class LoadBalancerReconciler {
private static final String LOAD_BALANCER_SERVICE = "loadBalancerService";
@ -86,7 +85,7 @@ import org.yaml.snakeyaml.constructor.SafeConstructor;
}
// Check if to be generated
@SuppressWarnings({ "PMD.AvoidDuplicateLiterals", "unchecked" })
@SuppressWarnings({ "unchecked" })
var lbsDef = Optional.of(model)
.map(m -> (Map<String, Object>) m.get("reconciler"))
.map(c -> c.get(LOAD_BALANCER_SERVICE)).orElse(Boolean.FALSE);

View file

@ -81,7 +81,7 @@ import org.jgrapes.webconsole.vuejs.VueJsConsoleWeblet;
/**
* The application class.
*/
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis", "PMD.ExcessiveImports" })
@SuppressWarnings({ "PMD.ExcessiveImports" })
public class Manager extends Component {
private static String version;
@ -97,8 +97,8 @@ public class Manager extends Component {
* @throws IOException Signals that an I/O exception has occurred.
* @throws URISyntaxException
*/
@SuppressWarnings({ "PMD.TooFewBranchesForASwitchStatement",
"PMD.NcssCount", "PMD.ConstructorCallsOverridableMethod" })
@SuppressWarnings({ "PMD.NcssCount",
"PMD.ConstructorCallsOverridableMethod" })
public Manager(CommandLine cmdLine) throws IOException, URISyntaxException {
super(new NamedChannel("manager"));
// Prepare component tree
@ -217,7 +217,6 @@ public class Manager extends Component {
* @param event the event
*/
@Handler
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public void onConfigurationUpdate(ConfigurationUpdate event) {
event.structured(componentPath()).ifPresent(c -> {
if (c.containsKey("clusterName")) {
@ -291,7 +290,6 @@ public class Manager extends Component {
* @param args the arguments
* @throws Exception the exception
*/
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public static void main(String[] args) {
try {
// Instance logger is not available yet.

View file

@ -43,7 +43,6 @@ import org.yaml.snakeyaml.constructor.SafeConstructor;
/**
* Delegee for reconciling the pod.
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
/* default */ class PodReconciler {
protected final Logger logger = Logger.getLogger(getClass().getName());

View file

@ -53,7 +53,6 @@ import org.jgrapes.core.events.Attached;
* {@link VmPoolChanged} events fired on a special pipeline to
* avoid concurrent change informations.
*/
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis", "PMD.ExcessiveImports" })
public class PoolMonitor extends
AbstractMonitor<K8sDynamicModel, K8sDynamicModels, Channel> {

View file

@ -49,7 +49,6 @@ import org.yaml.snakeyaml.constructor.SafeConstructor;
/**
* Delegee for reconciling the stateful set (effectively the pod).
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
/* default */ class PvcReconciler {
protected final Logger logger = Logger.getLogger(getClass().getName());
@ -75,7 +74,7 @@ import org.yaml.snakeyaml.constructor.SafeConstructor;
* @throws TemplateException the template exception
* @throws ApiException the api exception
*/
@SuppressWarnings({ "PMD.AvoidDuplicateLiterals", "unchecked" })
@SuppressWarnings({ "unchecked" })
public void reconcile(VmDefinition vmDef, Map<String, Object> model,
VmChannel channel, boolean specChanged)
throws IOException, TemplateException, ApiException {

View file

@ -137,15 +137,13 @@ import org.jgrapes.util.events.ConfigurationUpdate;
*
* @see org.jdrupes.vmoperator.manager.DisplaySecretReconciler
*/
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis",
"PMD.AvoidDuplicateLiterals" })
@SuppressWarnings({ "PMD.AvoidDuplicateLiterals" })
public class Reconciler extends Component {
/** The Constant mapper. */
@SuppressWarnings("PMD.FieldNamingConventions")
protected static final ObjectMapper mapper = new ObjectMapper();
@SuppressWarnings("PMD.SingularField")
private final Configuration fmConfig;
private final ConfigMapReconciler cmReconciler;
private final DisplaySecretReconciler dsReconciler;
@ -203,7 +201,6 @@ public class Reconciler extends Component {
* @throws IOException Signals that an I/O exception has occurred.
*/
@Handler
@SuppressWarnings("PMD.ConfusingTernary")
public void onVmResourceChanged(VmResourceChanged event, VmChannel channel)
throws ApiException, TemplateException, IOException {
// Ownership relationships takes care of deletions
@ -338,7 +335,6 @@ public class Reconciler extends Component {
private final TemplateMethodModelEx formatMemoryModel
= new TemplateMethodModelEx() {
@Override
@SuppressWarnings("PMD.PreserveStackTrace")
public Object exec(@SuppressWarnings("rawtypes") List arguments)
throws TemplateModelException {
var arg = arguments.get(0);
@ -368,8 +364,7 @@ public class Reconciler extends Component {
private final TemplateMethodModelEx imgageLocationModel
= new TemplateMethodModelEx() {
@Override
@SuppressWarnings({ "PMD.PreserveStackTrace",
"PMD.AvoidLiteralsInIfCondition" })
@SuppressWarnings({ "PMD.AvoidLiteralsInIfCondition" })
public Object exec(@SuppressWarnings("rawtypes") List arguments)
throws TemplateModelException {
var image = ((SimpleScalar) arguments.get(0)).getAsString();
@ -394,7 +389,6 @@ public class Reconciler extends Component {
private final TemplateMethodModelEx toJsonModel
= new TemplateMethodModelEx() {
@Override
@SuppressWarnings("PMD.PreserveStackTrace")
public Object exec(@SuppressWarnings("rawtypes") List arguments)
throws TemplateModelException {
try {

View file

@ -71,7 +71,6 @@ import org.jgrapes.core.annotation.Handler;
* event pipeline should be used for all events related to changes of
* a particular VM.
*/
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis", "PMD.ExcessiveImports" })
public class VmMonitor extends
AbstractMonitor<VmDefinition, VmDefinitions, VmChannel> {
@ -107,7 +106,6 @@ public class VmMonitor extends
purge();
}
@SuppressWarnings("PMD.CognitiveComplexity")
private void purge() throws ApiException {
// Get existing CRs (VMs)
var known = K8sDynamicStub.list(client(), context(), namespace())
@ -192,7 +190,6 @@ public class VmMonitor extends
}
}
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
private void addExtraData(VmDefinition vmDef, VmDefinition prevState) {
var extra = new VmExtraData(vmDef);
var prevExtra = Optional.ofNullable(prevState).map(VmDefinition::extra);
@ -241,7 +238,6 @@ public class VmMonitor extends
.ofNullable(pod.getSpec().getNodeName()).orElse("");
logger.finer(() -> "Adding node name " + nodeName
+ " to VM info for " + vmDef.name());
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
var addrs = new ArrayList<String>();
Optional.ofNullable(pod.getStatus().getPodIPs())
.orElse(Collections.emptyList()).stream()

View file

@ -36,7 +36,6 @@ import org.jgrapes.core.annotation.Handler;
/**
* The Class CdMediaController.
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public class CdMediaController extends Component {
/**
@ -55,7 +54,6 @@ public class CdMediaController extends Component {
*
* @param componentChannel the component channel
*/
@SuppressWarnings("PMD.AssignmentToNonFinalStatic")
public CdMediaController(Channel componentChannel) {
super(componentChannel);
}
@ -66,8 +64,7 @@ public class CdMediaController extends Component {
* @param event the event
*/
@Handler
@SuppressWarnings({ "PMD.AvoidLiteralsInIfCondition",
"PMD.AvoidInstantiatingObjectsInLoops" })
@SuppressWarnings({ "PMD.AvoidInstantiatingObjectsInLoops" })
public void onConfigureQemu(ConfigureQemu event) {
if (event.runState() == RunState.TERMINATING) {
return;

View file

@ -39,11 +39,9 @@ import org.jdrupes.vmoperator.util.FsdUtils;
/**
* The configuration information from the configuration file.
*/
@SuppressWarnings({ "PMD.ExcessivePublicCount", "PMD.TooManyFields" })
public class Configuration implements Dto {
private static final String CI_INSTANCE_ID = "instance-id";
@SuppressWarnings("PMD.FieldNamingConventions")
protected final Logger logger = Logger.getLogger(getClass().getName());
/** Configuration timestamp. */
@ -95,15 +93,12 @@ public class Configuration implements Dto {
public static class CloudInit implements Dto {
/** The meta data. */
@SuppressWarnings("PMD.UseConcurrentHashMap")
public Map<String, Object> metaData;
/** The user data. */
@SuppressWarnings("PMD.UseConcurrentHashMap")
public Map<String, Object> userData;
/** The network config. */
@SuppressWarnings("PMD.UseConcurrentHashMap")
public Map<String, Object> networkConfig;
}
@ -299,7 +294,6 @@ public class Configuration implements Dto {
return true;
}
@SuppressWarnings("PMD.AvoidLiteralsInIfCondition")
private void checkDrives() {
for (Drive drive : vm.drives) {
if (drive.file != null || drive.device != null
@ -319,7 +313,6 @@ public class Configuration implements Dto {
}
}
@SuppressWarnings("PMD.AvoidDeeplyNestedIfStmts")
private boolean checkRuntimeDir() {
// Runtime directory (sockets etc.)
if (runtimeDir == null) {
@ -355,7 +348,6 @@ public class Configuration implements Dto {
return true;
}
@SuppressWarnings("PMD.AvoidDeeplyNestedIfStmts")
private boolean checkDataDir() {
// Data directory
if (dataDir == null) {

View file

@ -41,7 +41,6 @@ import org.jgrapes.core.events.Start;
* A (sub)component that updates the console status in the CR status.
* Created as child of {@link StatusUpdater}.
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public class ConsoleTracker extends VmDefUpdater {
private VmDefinitionStub vmStub;
@ -53,7 +52,6 @@ public class ConsoleTracker extends VmDefUpdater {
*
* @param componentChannel the component channel
*/
@SuppressWarnings("PMD.ConstructorCallsOverridableMethod")
public ConsoleTracker(Channel componentChannel) {
super(componentChannel);
apiClient = (K8sClient) io.kubernetes.client.openapi.Configuration
@ -91,8 +89,7 @@ public class ConsoleTracker extends VmDefUpdater {
* @throws ApiException the api exception
*/
@Handler
@SuppressWarnings({ "PMD.AvoidLiteralsInIfCondition",
"PMD.AvoidDuplicateLiterals" })
@SuppressWarnings({ "PMD.AvoidLiteralsInIfCondition" })
public void onSpiceInitialized(SpiceInitializedEvent event)
throws ApiException {
if (vmStub == null) {
@ -127,7 +124,6 @@ public class ConsoleTracker extends VmDefUpdater {
* @throws ApiException the api exception
*/
@Handler
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
public void onSpiceDisconnected(SpiceDisconnectedEvent event)
throws ApiException {
if (vmStub == null) {

View file

@ -21,7 +21,6 @@ package org.jdrupes.vmoperator.runner.qemu;
/**
* Some constants.
*/
@SuppressWarnings("PMD.DataClass")
public class Constants extends org.jdrupes.vmoperator.common.Constants {
/**

View file

@ -41,7 +41,6 @@ import org.jgrapes.core.annotation.Handler;
/**
* The Class CpuController.
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public class CpuController extends Component {
private Integer currentCpus;

View file

@ -43,7 +43,6 @@ import org.jgrapes.util.events.WatchFile;
/**
* The Class DisplayController.
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public class DisplayController extends Component {
private String currentPassword;
@ -59,8 +58,7 @@ public class DisplayController extends Component {
* @param componentChannel the component channel
* @param configDir
*/
@SuppressWarnings({ "PMD.AssignmentToNonFinalStatic",
"PMD.ConstructorCallsOverridableMethod" })
@SuppressWarnings({ "PMD.ConstructorCallsOverridableMethod" })
public DisplayController(Channel componentChannel, Path configDir) {
super(componentChannel);
this.configDir = configDir;
@ -114,7 +112,6 @@ public class DisplayController extends Component {
* @param event the event
*/
@Handler
@SuppressWarnings("PMD.EmptyCatchBlock")
public void onFileChanged(FileChanged event) {
if (event.path().equals(configDir.resolve(DisplaySecret.PASSWORD))) {
logger.fine(() -> "Display password updated");

View file

@ -54,7 +54,6 @@ import org.jgrapes.util.events.ConfigurationUpdate;
* If the log level for this class is set to fine, the messages
* exchanged on the monitor socket are logged.
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public class QemuMonitor extends QemuConnector {
private int powerdownTimeout;
@ -72,8 +71,6 @@ public class QemuMonitor extends QemuConnector {
* @param configDir the config dir
* @throws IOException Signals that an I/O exception has occurred.
*/
@SuppressWarnings({ "PMD.AssignmentToNonFinalStatic",
"PMD.ConstructorCallsOverridableMethod" })
public QemuMonitor(Channel componentChannel, Path configDir)
throws IOException {
super(componentChannel);

View file

@ -39,7 +39,6 @@ public class RamController extends Component {
*
* @param componentChannel the component channel
*/
@SuppressWarnings("PMD.AssignmentToNonFinalStatic")
public RamController(Channel componentChannel) {
super(componentChannel);
}

View file

@ -201,8 +201,7 @@ import org.jgrapes.util.events.WatchFile;
*
*/
@SuppressWarnings({ "PMD.ExcessiveImports", "PMD.AvoidPrintStackTrace",
"PMD.DataflowAnomalyAnalysis", "PMD.TooManyMethods",
"PMD.CouplingBetweenObjects", "PMD.TooManyFields" })
"PMD.TooManyMethods", "PMD.CouplingBetweenObjects" })
public class Runner extends Component {
private static final String TEMPLATE_DIR
@ -218,7 +217,6 @@ public class Runner extends Component {
.builder().disable(YAMLGenerator.Feature.WRITE_DOC_START_MARKER)
.build());
private final JsonNode defaults;
@SuppressWarnings("PMD.UseConcurrentHashMap")
private final File configFile;
private final Path configDir;
private Configuration initialConfig;
@ -250,8 +248,7 @@ public class Runner extends Component {
* @param cmdLine the cmd line
* @throws IOException Signals that an I/O exception has occurred.
*/
@SuppressWarnings({ "PMD.SystemPrintln",
"PMD.ConstructorCallsOverridableMethod" })
@SuppressWarnings({ "PMD.ConstructorCallsOverridableMethod" })
public Runner(CommandLine cmdLine) throws IOException {
yamlMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,
false);
@ -387,8 +384,6 @@ public class Runner extends Component {
}
}
@SuppressWarnings({ "PMD.CognitiveComplexity",
"PMD.DataflowAnomalyAnalysis" })
private void setFirmwarePaths(Configuration config) throws IOException {
JsonNode firmware = defaults.path("firmware").path(config.vm.firmware);
// Get file for firmware ROM
@ -620,8 +615,6 @@ public class Runner extends Component {
* @throws InterruptedException the interrupted exception
*/
@Handler
@SuppressWarnings({ "PMD.SwitchStmtsShouldHaveDefault",
"PMD.TooFewBranchesForASwitchStatement" })
public void onProcessStarted(ProcessStarted event, ProcessChannel channel)
throws InterruptedException {
event.startEvent().associated(CommandDefinition.class)
@ -778,7 +771,6 @@ public class Runner extends Component {
"The VM has been shut down"));
}
@SuppressWarnings("PMD.ConfusingArgumentToVarargsMethod")
private void shutdown() {
if (!Set.of(RunState.TERMINATING, RunState.STOPPED).contains(state)) {
fire(new Stop());

View file

@ -66,8 +66,7 @@ import org.jgrapes.core.events.Start;
/**
* Updates the CR status.
*/
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis",
"PMD.CouplingBetweenObjects" })
@SuppressWarnings({ "PMD.CouplingBetweenObjects" })
public class StatusUpdater extends VmDefUpdater {
@SuppressWarnings("PMD.FieldNamingConventions")
@ -90,7 +89,6 @@ public class StatusUpdater extends VmDefUpdater {
*
* @param componentChannel the component channel
*/
@SuppressWarnings("PMD.ConstructorCallsOverridableMethod")
public StatusUpdater(Channel componentChannel) {
super(componentChannel);
attach(new ConsoleTracker(componentChannel));
@ -153,7 +151,6 @@ public class StatusUpdater extends VmDefUpdater {
* @throws ApiException
*/
@Handler
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
public void onConfigureQemu(ConfigureQemu event)
throws ApiException {
guestShutdownStops = event.configuration().guestShutdownStops;
@ -187,8 +184,7 @@ public class StatusUpdater extends VmDefUpdater {
* @throws ApiException
*/
@Handler
@SuppressWarnings({ "PMD.AvoidLiteralsInIfCondition",
"PMD.AssignmentInOperand", "PMD.AvoidDuplicateLiterals" })
@SuppressWarnings({ "PMD.AssignmentInOperand" })
public void onRunnerStateChanged(RunnerStateChange event)
throws ApiException {
VmDefinition vmDef;
@ -425,7 +421,6 @@ public class StatusUpdater extends VmDefUpdater {
* @throws ApiException
*/
@Handler
@SuppressWarnings("PMD.AssignmentInOperand")
public void onVmopAgentLoggedIn(VmopAgentLoggedIn event)
throws ApiException {
vmStub.updateStatus(from -> {
@ -442,7 +437,6 @@ public class StatusUpdater extends VmDefUpdater {
* @throws ApiException
*/
@Handler
@SuppressWarnings("PMD.AssignmentInOperand")
public void onVmopAgentLoggedOut(VmopAgentLoggedOut event)
throws ApiException {
vmStub.updateStatus(from -> {

View file

@ -43,7 +43,6 @@ import org.jgrapes.util.events.InitialConfiguration;
/**
* Updates the CR status.
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public class VmDefUpdater extends Component {
protected String namespace;

View file

@ -87,8 +87,7 @@ public class VmopAgentClient extends AgentConnector {
}
@Override
@SuppressWarnings({ "PMD.UnnecessaryReturn",
"PMD.AvoidLiteralsInIfCondition" })
@SuppressWarnings({ "PMD.AvoidLiteralsInIfCondition" })
protected void processInput(String line) throws IOException {
logger.finer(() -> "vmop agent(in): " + line);

View file

@ -25,8 +25,7 @@ import com.fasterxml.jackson.databind.JsonNode;
*/
public class QmpCapabilities extends QmpCommand {
@SuppressWarnings({ "PMD.FieldNamingConventions",
"PMD.VariableNamingConventions" })
@SuppressWarnings({ "PMD.FieldNamingConventions" })
private static final JsonNode jsonTemplate
= parseJson("{ \"execute\": \"qmp_capabilities\" }");

View file

@ -27,8 +27,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
*/
public class QmpChangeMedium extends QmpCommand {
@SuppressWarnings({ "PMD.FieldNamingConventions",
"PMD.VariableNamingConventions" })
@SuppressWarnings({ "PMD.FieldNamingConventions" })
private static final JsonNode jsonTemplate
= parseJson("{ \"execute\": \"blockdev-change-medium\",\"arguments\": {"
+ "\"id\": \"\",\"filename\": \"\",\"format\": \"raw\","

View file

@ -30,8 +30,7 @@ import java.util.logging.Logger;
*/
public abstract class QmpCommand {
@SuppressWarnings({ "PMD.FieldNamingConventions",
"PMD.VariableNamingConventions" })
@SuppressWarnings({ "PMD.FieldNamingConventions" })
protected static final ObjectMapper mapper = new ObjectMapper();
/**

View file

@ -25,8 +25,7 @@ import com.fasterxml.jackson.databind.JsonNode;
*/
public class QmpCont extends QmpCommand {
@SuppressWarnings({ "PMD.FieldNamingConventions",
"PMD.VariableNamingConventions" })
@SuppressWarnings({ "PMD.FieldNamingConventions" })
private static final JsonNode jsonTemplate
= parseJson("{ \"execute\": \"cont\" }");

View file

@ -27,8 +27,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
*/
public class QmpDelCpu extends QmpCommand {
@SuppressWarnings({ "PMD.FieldNamingConventions",
"PMD.VariableNamingConventions" })
@SuppressWarnings({ "PMD.FieldNamingConventions" })
private static final JsonNode jsonTemplate
= parseJson("{ \"execute\": \"device_del\", "
+ "\"arguments\": " + "{ \"id\": 0 } }");

View file

@ -27,8 +27,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
*/
public class QmpOpenTray extends QmpCommand {
@SuppressWarnings({ "PMD.FieldNamingConventions",
"PMD.VariableNamingConventions" })
@SuppressWarnings({ "PMD.FieldNamingConventions" })
private static final JsonNode jsonTemplate
= parseJson("{ \"execute\": \"blockdev-open-tray\",\"arguments\": {"
+ "\"id\": \"\" } }");

View file

@ -25,8 +25,7 @@ import com.fasterxml.jackson.databind.JsonNode;
*/
public class QmpPowerdown extends QmpCommand {
@SuppressWarnings({ "PMD.FieldNamingConventions",
"PMD.VariableNamingConventions" })
@SuppressWarnings({ "PMD.FieldNamingConventions" })
private static final JsonNode jsonTemplate
= parseJson("{ \"execute\": \"system_powerdown\" }");

View file

@ -25,8 +25,7 @@ import com.fasterxml.jackson.databind.JsonNode;
*/
public class QmpQueryHotpluggableCpus extends QmpCommand {
@SuppressWarnings({ "PMD.FieldNamingConventions",
"PMD.VariableNamingConventions" })
@SuppressWarnings({ "PMD.FieldNamingConventions" })
private static final JsonNode jsonTemplate = parseJson(
"{\"execute\":\"query-hotpluggable-cpus\",\"arguments\":{}}");

View file

@ -27,8 +27,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
*/
public class QmpRemoveMedium extends QmpCommand {
@SuppressWarnings({ "PMD.FieldNamingConventions",
"PMD.VariableNamingConventions" })
@SuppressWarnings({ "PMD.FieldNamingConventions" })
private static final JsonNode jsonTemplate
= parseJson("{ \"execute\": \"blockdev-remove-medium\",\"arguments\": {"
+ "\"id\": \"\" } }");

View file

@ -25,8 +25,7 @@ import com.fasterxml.jackson.databind.JsonNode;
*/
public class QmpReset extends QmpCommand {
@SuppressWarnings({ "PMD.FieldNamingConventions",
"PMD.VariableNamingConventions" })
@SuppressWarnings({ "PMD.FieldNamingConventions" })
private static final JsonNode jsonTemplate
= parseJson("{ \"execute\": \"system_reset\" }");

View file

@ -28,8 +28,7 @@ import java.math.BigInteger;
*/
public class QmpSetBalloon extends QmpCommand {
@SuppressWarnings({ "PMD.FieldNamingConventions",
"PMD.VariableNamingConventions" })
@SuppressWarnings({ "PMD.FieldNamingConventions" })
private static final JsonNode jsonTemplate
= parseJson("{ \"execute\": \"balloon\", "
+ "\"arguments\": " + "{ \"value\": 0 } }");

View file

@ -49,7 +49,6 @@ public class MonitorEvent extends Event<Void> {
* @param response the response
* @return the optional
*/
@SuppressWarnings("PMD.TooFewBranchesForASwitchStatement")
public static Optional<MonitorEvent> from(JsonNode response) {
try {
var kind = Kind.valueOf(response.get("event").asText());

View file

@ -26,7 +26,6 @@ import org.jgrapes.core.Event;
/**
* The Class RunnerStateChange.
*/
@SuppressWarnings("PMD.DataClass")
public class RunnerStateChange extends Event<Void> {
/**

View file

@ -32,7 +32,6 @@ import java.util.logging.Logger;
*/
public final class DataPath {
@SuppressWarnings("PMD.FieldNamingConventions")
private static final Logger logger
= Logger.getLogger(DataPath.class.getName());
@ -56,7 +55,6 @@ public final class DataPath {
* @param selectors the selectors
* @return the result
*/
@SuppressWarnings("PMD.UseLocaleWithCaseConversions")
public static <T> Optional<T> get(Object from, Object... selectors) {
Object cur = from;
for (var selector : selectors) {
@ -132,7 +130,6 @@ public final class DataPath {
@SuppressWarnings({ "PMD.CognitiveComplexity", "unchecked" })
public static <T> T deepCopy(T object) {
if (object instanceof Map map) {
@SuppressWarnings("PMD.UseConcurrentHashMap")
Map<Object, Object> copy;
try {
copy = (Map<Object, Object>) object.getClass().getConstructor()

View file

@ -32,8 +32,7 @@ import java.util.function.Supplier;
/**
* Utility class for pointing to elements on a Gson (Json) tree.
*/
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis",
"PMD.ClassWithOnlyPrivateConstructorsShouldBeFinal", "PMD.GodClass" })
@SuppressWarnings({ "PMD.ClassWithOnlyPrivateConstructorsShouldBeFinal" })
public class GsonPtr {
private final JsonElement position;
@ -102,7 +101,7 @@ public class GsonPtr {
* @param selectors the selectors
* @return the Gson pointer
*/
@SuppressWarnings({ "PMD.ShortMethodName", "PMD.PreserveStackTrace" })
@SuppressWarnings({ "PMD.PreserveStackTrace" })
public Optional<GsonPtr> get(Object... selectors) {
JsonElement element = position;
for (Object sel : selectors) {
@ -146,7 +145,6 @@ public class GsonPtr {
* @param cls the cls
* @return the result
*/
@SuppressWarnings({ "PMD.AvoidBranchingStatementAsLastInLoop" })
public <T extends JsonElement> T getAs(Class<T> cls) {
if (cls.isAssignableFrom(position.getClass())) {
return cls.cast(position);

View file

@ -111,9 +111,8 @@ import org.jgrapes.webconsole.base.freemarker.FreeMarkerConlet;
* users and roles.
*
*/
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis", "PMD.ExcessiveImports",
"PMD.CouplingBetweenObjects", "PMD.GodClass", "PMD.TooManyMethods",
"PMD.CyclomaticComplexity" })
@SuppressWarnings({ "PMD.ExcessiveImports", "PMD.CouplingBetweenObjects",
"PMD.GodClass", "PMD.TooManyMethods", "PMD.CyclomaticComplexity" })
public class VmAccess extends FreeMarkerConlet<VmAccess.ResourceModel> {
private static final String VM_NAME_PROPERTY = "vmName";
@ -167,7 +166,7 @@ public class VmAccess extends FreeMarkerConlet<VmAccess.ResourceModel> {
*
* @param event the event
*/
@SuppressWarnings({ "unchecked", "PMD.AvoidDuplicateLiterals" })
@SuppressWarnings({ "unchecked" })
@Handler
public void onConfigurationUpdate(ConfigurationUpdate event) {
event.structured(componentPath())
@ -267,7 +266,7 @@ public class VmAccess extends FreeMarkerConlet<VmAccess.ResourceModel> {
public void onConsoleConfigured(ConsoleConfigured event,
ConsoleConnection connection) throws InterruptedException,
IOException {
@SuppressWarnings({ "unchecked", "PMD.PrematureDeclaration" })
@SuppressWarnings({ "unchecked" })
final var rendered
= (Set<ResourceModel>) connection.session().get(RENDERED);
connection.session().remove(RENDERED);
@ -277,8 +276,7 @@ public class VmAccess extends FreeMarkerConlet<VmAccess.ResourceModel> {
addMissingConlets(event, connection, rendered);
}
@SuppressWarnings({ "PMD.AvoidInstantiatingObjectsInLoops",
"PMD.AvoidDuplicateLiterals" })
@SuppressWarnings({ "PMD.AvoidInstantiatingObjectsInLoops" })
private void addMissingConlets(ConsoleConfigured event,
ConsoleConnection connection, final Set<ResourceModel> rendered)
throws InterruptedException {
@ -406,7 +404,6 @@ public class VmAccess extends FreeMarkerConlet<VmAccess.ResourceModel> {
}
@Override
@SuppressWarnings({ "PMD.AvoidInstantiatingObjectsInLoops" })
protected Set<RenderMode> doRenderConlet(RenderConletRequestBase<?> event,
ConsoleConnection channel, String conletId, ResourceModel model)
throws Exception {
@ -655,9 +652,8 @@ public class VmAccess extends FreeMarkerConlet<VmAccess.ResourceModel> {
* @throws InterruptedException
*/
@Handler(namedChannels = "manager")
@SuppressWarnings({ "PMD.ConfusingTernary", "PMD.CognitiveComplexity",
"PMD.AvoidInstantiatingObjectsInLoops", "PMD.AvoidDuplicateLiterals",
"PMD.ConfusingArgumentToVarargsMethod" })
@SuppressWarnings({ "PMD.CognitiveComplexity",
"PMD.AvoidInstantiatingObjectsInLoops" })
public void onVmResourceChanged(VmResourceChanged event, VmChannel channel)
throws IOException, InterruptedException {
var vmDef = event.vmDefinition();
@ -853,8 +849,7 @@ public class VmAccess extends FreeMarkerConlet<VmAccess.ResourceModel> {
model.getConletId(), "openConsole", cf)));
}
@SuppressWarnings({ "PMD.AvoidLiteralsInIfCondition",
"PMD.UseLocaleWithCaseConversions" })
@SuppressWarnings({ "PMD.UseLocaleWithCaseConversions" })
private void selectResource(NotifyConletModel event,
ConsoleConnection channel, ResourceModel model)
throws JsonProcessingException, InterruptedException {
@ -881,7 +876,6 @@ public class VmAccess extends FreeMarkerConlet<VmAccess.ResourceModel> {
/**
* The Class AccessModel.
*/
@SuppressWarnings("PMD.DataClass")
public static class ResourceModel extends ConletBaseModel {
/**

View file

@ -28,7 +28,6 @@ import java.util.List;
/**
* The Class TimeSeries.
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public class TimeSeries {
@SuppressWarnings("PMD.LooseCoupling")

View file

@ -75,8 +75,7 @@ import org.jgrapes.webconsole.base.freemarker.FreeMarkerConlet;
/**
* The Class {@link VmMgmt}.
*/
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis", "PMD.CouplingBetweenObjects",
"PMD.ExcessiveImports" })
@SuppressWarnings({ "PMD.CouplingBetweenObjects", "PMD.ExcessiveImports" })
public class VmMgmt extends FreeMarkerConlet<VmMgmt.VmsModel> {
private Class<?> preferredIpVersion = Inet4Address.class;
@ -112,7 +111,7 @@ public class VmMgmt extends FreeMarkerConlet<VmMgmt.VmsModel> {
*
* @param event the event
*/
@SuppressWarnings({ "unchecked", "PMD.AvoidDuplicateLiterals" })
@SuppressWarnings({ "unchecked" })
@Handler
public void onConfigurationUpdate(ConfigurationUpdate event) {
event.structured("/Manager/GuiHttpServer"
@ -177,7 +176,6 @@ public class VmMgmt extends FreeMarkerConlet<VmMgmt.VmsModel> {
}
@Override
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
protected Set<RenderMode> doRenderConlet(RenderConletRequestBase<?> event,
ConsoleConnection channel, String conletId, VmsModel conletState)
throws Exception {
@ -230,7 +228,6 @@ public class VmMgmt extends FreeMarkerConlet<VmMgmt.VmsModel> {
simplifiedVmDefinition(vmDef, user, roles)));
}
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
private Map<String, Object> simplifiedVmDefinition(VmDefinition vmDef,
String user, List<String> roles) {
// Convert RAM sizes to unitless numbers
@ -270,9 +267,8 @@ public class VmMgmt extends FreeMarkerConlet<VmMgmt.VmsModel> {
* @throws IOException
*/
@Handler(namedChannels = "manager")
@SuppressWarnings({ "PMD.ConfusingTernary", "PMD.CognitiveComplexity",
"PMD.AvoidInstantiatingObjectsInLoops", "PMD.AvoidDuplicateLiterals",
"PMD.ConfusingArgumentToVarargsMethod" })
@SuppressWarnings({ "PMD.CognitiveComplexity",
"PMD.AvoidInstantiatingObjectsInLoops" })
public void onVmResourceChanged(VmResourceChanged event, VmChannel channel)
throws IOException {
var vmName = event.vmDefinition().name();
@ -378,8 +374,6 @@ public class VmMgmt extends FreeMarkerConlet<VmMgmt.VmsModel> {
}
@SuppressWarnings({ "PMD.AvoidLiteralsInIfCondition",
"PMD.LambdaCanBeMethodReference" })
private Summary evaluateSummary(boolean force) {
if (!force && cachedSummary != null) {
return cachedSummary;
@ -402,8 +396,7 @@ public class VmMgmt extends FreeMarkerConlet<VmMgmt.VmsModel> {
}
@Override
@SuppressWarnings({ "PMD.AvoidDecimalLiteralsInBigDecimalConstructor",
"PMD.NcssCount" })
@SuppressWarnings({ "PMD.NcssCount" })
protected void doUpdateConletState(NotifyConletModel event,
ConsoleConnection channel, VmsModel model) throws Exception {
event.stop();