mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
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:
@@ -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<>();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user