Disable frivolous PMD warnings and enable PMD in ntcore (#3419)

Some valid warnings like throwing NullPointerException or using a for
loop instead of System.arraycopy() were fixed.

Abstract classes marked with PMD.AbstractClassWithoutAbstractMethod were
made concrete because they already had protected constructors.

Fixes #1697.
This commit is contained in:
Tyler Veness
2021-06-09 07:01:00 -07:00
committed by GitHub
parent 8284075ee4
commit c1e128bd5a
93 changed files with 154 additions and 326 deletions

View File

@@ -27,7 +27,6 @@ import java.util.concurrent.locks.ReentrantLock;
* @deprecated All APIs which use this have been deprecated.
*/
@Deprecated(since = "2020", forRemoval = true)
@SuppressWarnings("PMD.TooManyFields")
public class PIDBase implements PIDInterface, PIDOutput, Sendable, AutoCloseable {
public static final double kDefaultPeriod = 0.05;
private static int instances;
@@ -81,9 +80,6 @@ public class PIDBase implements PIDInterface, PIDOutput, Sendable, AutoCloseable
private double m_setpoint;
private double m_prevSetpoint;
@SuppressWarnings("PMD.UnusedPrivateField")
private double m_error;
private double m_result;
private LinearFilter m_filter;
@@ -199,7 +195,7 @@ public class PIDBase implements PIDInterface, PIDOutput, Sendable, AutoCloseable
* Read the input, calculate the output accordingly, and write to the output. This should only be
* called by the PIDTask and is created during initialization.
*/
@SuppressWarnings({"LocalVariableName", "PMD.ExcessiveMethodLength", "PMD.NPathComplexity"})
@SuppressWarnings("LocalVariableName")
protected void calculate() {
if (m_pidInput == null || m_pidOutput == null) {
return;
@@ -291,7 +287,6 @@ public class PIDBase implements PIDInterface, PIDOutput, Sendable, AutoCloseable
m_thisMutex.lock();
try {
m_prevError = error;
m_error = error;
m_totalError = totalError;
m_result = result;
} finally {