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

@@ -8,7 +8,7 @@ import edu.wpi.first.wpilibj.DutyCycleEncoder;
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
@SuppressWarnings({"PMD.SingularField"})
@SuppressWarnings("PMD.SingularField")
public class Robot extends TimedRobot {
private DutyCycleEncoder m_dutyCycleEncoder;

View File

@@ -9,7 +9,7 @@ import edu.wpi.first.wpilibj.DutyCycle;
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
@SuppressWarnings({"PMD.SingularField"})
@SuppressWarnings("PMD.SingularField")
public class Robot extends TimedRobot {
private DigitalInput m_input;
private DutyCycle m_dutyCycle;

View File

@@ -17,7 +17,6 @@ import edu.wpi.first.wpilibj.motorcontrol.MotorController;
import edu.wpi.first.wpilibj.motorcontrol.PWMSparkMax;
/** Represents a mecanum drive style drivetrain. */
@SuppressWarnings("PMD.TooManyFields")
public class Drivetrain {
public static final double kMaxSpeed = 3.0; // 3 meters per second
public static final double kMaxAngularSpeed = Math.PI; // 1/2 rotation per second

View File

@@ -31,7 +31,6 @@ import java.util.List;
* periodic methods (other than the scheduler calls). Instead, the structure of the robot
* (including subsystems, commands, and button mappings) should be declared here.
*/
@SuppressWarnings("PMD.ExcessiveImports")
public class RobotContainer {
// The robot's subsystems
private final DriveSubsystem m_robotDrive = new DriveSubsystem();

View File

@@ -21,7 +21,6 @@ import edu.wpi.first.wpilibj.motorcontrol.MotorController;
import edu.wpi.first.wpilibj.motorcontrol.PWMSparkMax;
/** Represents a mecanum drive style drivetrain. */
@SuppressWarnings("PMD.TooManyFields")
public class Drivetrain {
public static final double kMaxSpeed = 3.0; // 3 meters per second
public static final double kMaxAngularSpeed = Math.PI; // 1/2 rotation per second

View File

@@ -26,7 +26,6 @@ import edu.wpi.first.wpilibj.simulation.EncoderSim;
import edu.wpi.first.wpilibj.smartdashboard.Field2d;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
@SuppressWarnings("PMD.TooManyFields")
public class Drivetrain {
// 3 meters per second.
public static final double kMaxSpeed = 3.0;

View File

@@ -14,7 +14,6 @@ import edu.wpi.first.wpilibj.examples.swervecontrollercommand.Constants.DriveCon
import edu.wpi.first.wpilibj.interfaces.Gyro;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
@SuppressWarnings("PMD.ExcessiveImports")
public class DriveSubsystem extends SubsystemBase {
// Robot swerve modules
private final SwerveModule m_frontLeft =

View File

@@ -29,7 +29,6 @@ public class EducationalRobot extends RobotBase {
private volatile boolean m_exit;
@SuppressWarnings("PMD.CyclomaticComplexity")
@Override
public void startCompetition() {
robotInit();

View File

@@ -26,7 +26,6 @@ public class Robot extends RobotBase {
private volatile boolean m_exit;
@SuppressWarnings("PMD.CyclomaticComplexity")
@Override
public void startCompetition() {
robotInit();