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

@@ -11,7 +11,6 @@ import java.util.HashSet;
import java.util.Set;
/** A {@link Sendable} base class for {@link Command}s. */
@SuppressWarnings("PMD.AbstractClassWithoutAbstractMethod")
public abstract class CommandBase implements Sendable, Command {
protected Set<Subsystem> m_requirements = new HashSet<>();

View File

@@ -34,7 +34,6 @@ import java.util.function.Consumer;
* CommandScheduler#registerSubsystem(Subsystem...)} in order for their {@link Subsystem#periodic()}
* methods to be called and for their default commands to be scheduled.
*/
@SuppressWarnings({"PMD.GodClass", "PMD.TooManyFields"})
public final class CommandScheduler implements Sendable, AutoCloseable {
/** The Singleton Instance. */
private static CommandScheduler instance;
@@ -157,7 +156,6 @@ public final class CommandScheduler implements Sendable, AutoCloseable {
* @param interruptible whether this command can be interrupted
* @param command the command to schedule
*/
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.NPathComplexity"})
private void schedule(boolean interruptible, Command command) {
if (m_inRunLoop) {
m_toSchedule.put(command, interruptible);
@@ -239,7 +237,6 @@ public final class CommandScheduler implements Sendable, AutoCloseable {
*
* <p>Any subsystems not being used as requirements have their default methods started.
*/
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.NPathComplexity"})
public void run() {
if (m_disabled) {
return;

View File

@@ -36,7 +36,7 @@ import java.util.function.Supplier;
* <p>The robot angle controller does not follow the angle given by the trajectory but rather goes
* to the angle given in the final state of the trajectory.
*/
@SuppressWarnings({"PMD.TooManyFields", "MemberName"})
@SuppressWarnings("MemberName")
public class MecanumControllerCommand extends CommandBase {
private final Timer m_timer = new Timer();
private final boolean m_usePID;
@@ -85,7 +85,7 @@ public class MecanumControllerCommand extends CommandBase {
* voltages.
* @param requirements The subsystems to require.
*/
@SuppressWarnings({"PMD.ExcessiveParameterList", "ParameterName"})
@SuppressWarnings("ParameterName")
public MecanumControllerCommand(
Trajectory trajectory,
Supplier<Pose2d> pose,
@@ -177,7 +177,7 @@ public class MecanumControllerCommand extends CommandBase {
* voltages.
* @param requirements The subsystems to require.
*/
@SuppressWarnings({"PMD.ExcessiveParameterList", "ParameterName"})
@SuppressWarnings("ParameterName")
public MecanumControllerCommand(
Trajectory trajectory,
Supplier<Pose2d> pose,
@@ -235,7 +235,7 @@ public class MecanumControllerCommand extends CommandBase {
* @param outputWheelSpeeds A MecanumDriveWheelSpeeds object containing the output wheel speeds.
* @param requirements The subsystems to require.
*/
@SuppressWarnings({"PMD.ExcessiveParameterList", "ParameterName"})
@SuppressWarnings("ParameterName")
public MecanumControllerCommand(
Trajectory trajectory,
Supplier<Pose2d> pose,
@@ -307,7 +307,7 @@ public class MecanumControllerCommand extends CommandBase {
* @param outputWheelSpeeds A MecanumDriveWheelSpeeds object containing the output wheel speeds.
* @param requirements The subsystems to require.
*/
@SuppressWarnings({"PMD.ExcessiveParameterList", "ParameterName"})
@SuppressWarnings("ParameterName")
public MecanumControllerCommand(
Trajectory trajectory,
Supplier<Pose2d> pose,

View File

@@ -30,7 +30,6 @@ import java.util.function.Supplier;
* functionality of a "smart" motor controller) may use the secondary constructor that omits the PID
* and feedforward functionality, returning only the raw wheel speeds from the RAMSETE controller.
*/
@SuppressWarnings("PMD.TooManyFields")
public class RamseteCommand extends CommandBase {
private final Timer m_timer = new Timer();
private final boolean m_usePID;
@@ -68,7 +67,6 @@ public class RamseteCommand extends CommandBase {
* the robot drive.
* @param requirements The subsystems to require.
*/
@SuppressWarnings("PMD.ExcessiveParameterList")
public RamseteCommand(
Trajectory trajectory,
Supplier<Pose2d> pose,