[build] Globally Exclude PMD.TooManyMethods (#2793)

This was not a useful check, as every time we hit it, we simply excluded it.
This commit is contained in:
Austin Shalit
2020-10-22 23:53:48 -04:00
committed by GitHub
parent fb7b41793b
commit 6e7c7374fd
48 changed files with 28 additions and 61 deletions

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -37,7 +37,6 @@ import edu.wpi.first.networktables.NetworkTableInstance;
* Singleton class for creating and keeping camera servers.
* Also publishes camera information to NetworkTables.
*/
@SuppressWarnings("PMD.TooManyMethods")
public final class CameraServer {
public static final int kBasePort = 1181;

View File

@@ -12,7 +12,7 @@ import java.nio.ByteBuffer;
/**
* JNI Wrapper for HAL<br>.
*/
@SuppressWarnings({"AbbreviationAsWordInName", "MethodName", "PMD.TooManyMethods"})
@SuppressWarnings({"AbbreviationAsWordInName", "MethodName"})
public final class HAL extends JNIWrapper {
public static native void waitForDSData();

View File

@@ -39,6 +39,7 @@
<exclude name="NcssConstructorCount" />
<exclude name="NcssCount" />
<exclude name="NcssMethodCount" />
<exclude name="TooManyMethods" />
</rule>
<rule ref="category/java/errorprone.xml">

View File

@@ -18,7 +18,6 @@ import java.util.function.BooleanSupplier;
* <p>Commands are run synchronously from the main robot loop; no multithreading is used, unless
* specified explicitly from the command implementation.
*/
@SuppressWarnings("PMD.TooManyMethods")
public interface Command {
/**

View File

@@ -38,7 +38,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
* {@link 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.TooManyMethods", "PMD.TooManyFields"})
@SuppressWarnings({"PMD.GodClass", "PMD.TooManyFields"})
public final class CommandScheduler implements Sendable, AutoCloseable {
/**
* The Singleton Instance.

View File

@@ -22,7 +22,6 @@ import edu.wpi.first.wpilibj2.command.Subsystem;
* operator interface as a common use case of the more generalized Trigger objects. This is a simple
* wrapper around Trigger with the method names renamed to fit the Button object use.
*/
@SuppressWarnings("PMD.TooManyMethods")
public class Button extends Trigger {
/**
* Default constructor; creates a button that is never pressed (unless {@link Button#get()} is

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2008-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2008-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -27,7 +27,6 @@ import static edu.wpi.first.wpilibj.util.ErrorMessages.requireNonNullParam;
* reading a certain sensor input). For this, they only have to write the {@link Trigger#get()}
* method to get the full functionality of the Trigger class.
*/
@SuppressWarnings("PMD.TooManyMethods")
public class Trigger {
private final BooleanSupplier m_isActive;

View File

@@ -14,7 +14,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.verify;
@SuppressWarnings("PMD.TooManyMethods")
class CommandRequirementsTest extends CommandTestBase {
@Test
void requirementInterruptTest() {

View File

@@ -40,7 +40,6 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
* @see CommandGroup
* @see IllegalUseOfCommandException
*/
@SuppressWarnings("PMD.TooManyMethods")
public abstract class Command implements Sendable, AutoCloseable {
/**
* The time since this command was initialized.

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2008-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2008-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -31,7 +31,6 @@ import static java.util.Objects.requireNonNull;
* @see Subsystem
* @see IllegalUseOfCommandException
*/
@SuppressWarnings("PMD.TooManyMethods")
public class CommandGroup extends Command {
/**
* The commands in this group (stored in entries).

View File

@@ -33,7 +33,6 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
*
* @see Command
*/
@SuppressWarnings("PMD.TooManyMethods")
public final class Scheduler implements Sendable, AutoCloseable {
/**
* The Singleton Instance.

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2018-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -25,7 +25,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
@SuppressWarnings({"PMD.TooManyMethods"})
public class ShuffleboardTabTest {
private NetworkTableInstance m_ntInstance;
private ShuffleboardTab m_tab;

View File

@@ -25,7 +25,6 @@ import edu.wpi.first.hal.HAL;
* read methods and the byte[] passed into the write methods need to not
* be modified for the duration of their respective calls.
*/
@SuppressWarnings("PMD.TooManyMethods")
public class CAN implements Closeable {
public static final int kTeamManufacturer = 8;
public static final int kTeamDeviceType = 10;

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -39,7 +39,6 @@ import edu.wpi.first.networktables.NetworkTableInstance;
*
* @deprecated Replaced with edu.wpi.first.cameraserver.CameraServer
*/
@SuppressWarnings("PMD.TooManyMethods")
@Deprecated
public final class CameraServer {
public static final int kBasePort = 1181;

View File

@@ -25,8 +25,7 @@ import edu.wpi.first.networktables.NetworkTableInstance;
* Provide access to the network communication data to / from the Driver Station.
*/
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.ExcessiveClassLength",
"PMD.ExcessivePublicCount", "PMD.GodClass", "PMD.TooManyFields",
"PMD.TooManyMethods"})
"PMD.ExcessivePublicCount", "PMD.GodClass", "PMD.TooManyFields"})
public class DriverStation {
/**
* Number of Joystick Ports.

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2008-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2008-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -22,7 +22,7 @@ import static edu.wpi.first.wpilibj.util.ErrorMessages.requireNonNullParam;
* <p>This class is intended to be used by sensor (and other I2C device) drivers. It probably should
* not be used directly.
*/
@SuppressWarnings({"PMD.GodClass", "PMD.TooManyMethods"})
@SuppressWarnings("PMD.GodClass")
public class I2C implements AutoCloseable {
public enum Port {
kOnboard(0), kMXP(1);

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2008-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2008-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -16,7 +16,6 @@ import edu.wpi.first.hal.util.AllocationException;
/**
* Base for sensors to be used with interrupts.
*/
@SuppressWarnings("PMD.TooManyMethods")
public abstract class InterruptableSensorBase implements AutoCloseable {
@SuppressWarnings("JavadocMethod")
public enum WaitResult {

View File

@@ -42,7 +42,6 @@ import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
* - teleopPeriodic()
* - testPeriodic()
*/
@SuppressWarnings("PMD.TooManyMethods")
public abstract class IterativeRobotBase extends RobotBase {
protected double m_period;

View File

@@ -31,7 +31,6 @@ import static edu.wpi.first.wpilibj.util.ErrorMessages.requireNonNullParam;
* <p> This will also interact with {@link NetworkTable} by creating a table called "Preferences"
* with all the key-value pairs. </p>
*/
@SuppressWarnings("PMD.TooManyMethods")
public final class Preferences {
/**
* The Preferences table name.

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2008-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2008-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -25,7 +25,7 @@ import static edu.wpi.first.wpilibj.util.ErrorMessages.requireNonNullParam;
* or {@link edu.wpi.first.wpilibj.drive.MecanumDrive} classes instead.
*/
@Deprecated
@SuppressWarnings({"PMD.GodClass", "PMD.TooManyMethods"})
@SuppressWarnings("PMD.GodClass")
public class RobotDrive extends MotorSafety implements AutoCloseable {
/**
* The location of a motor on the robot for the purpose of driving.

View File

@@ -19,7 +19,7 @@ import edu.wpi.first.hal.SPIJNI;
/**
* Represents a SPI bus port.
*/
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.TooManyMethods"})
@SuppressWarnings("PMD.CyclomaticComplexity")
public class SPI implements AutoCloseable {
public enum Port {
kOnboardCS0(0), kOnboardCS1(1), kOnboardCS2(2), kOnboardCS3(3), kMXP(4);

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2008-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2008-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -16,7 +16,6 @@ import edu.wpi.first.hal.SerialPortJNI;
/**
* Driver for the serial ports (USB, MXP, Onboard) on the roboRIO.
*/
@SuppressWarnings("PMD.TooManyMethods")
public class SerialPort implements AutoCloseable {
private int m_portHandle;

View File

@@ -21,7 +21,6 @@ import edu.wpi.first.hal.NotifierJNI;
*
* <p>The watchdog is initialized disabled, so the user needs to call enable() before use.
*/
@SuppressWarnings("PMD.TooManyMethods")
public class Watchdog implements Closeable, Comparable<Watchdog> {
// Used for timeout print rate-limiting
private static final long kMinPrintPeriod = 1000000; // microseconds

View File

@@ -18,7 +18,6 @@ import edu.wpi.first.wpilibj.trajectory.TrapezoidProfile;
* profile. Users should call reset() when they first start running the controller
* to avoid unwanted behavior.
*/
@SuppressWarnings("PMD.TooManyMethods")
public class ProfiledPIDController implements Sendable {
private static int instances;

View File

@@ -27,7 +27,6 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
/**
* A helper class for Shuffleboard containers to handle common child operations.
*/
@SuppressWarnings("PMD.TooManyMethods")
final class ContainerHelper {
private final ShuffleboardContainer m_container;
private final Set<String> m_usedTitles = new HashSet<>();

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2018-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -19,7 +19,6 @@ import edu.wpi.first.wpilibj.Sendable;
/**
* Common interface for objects that can contain shuffleboard components.
*/
@SuppressWarnings("PMD.TooManyMethods")
public interface ShuffleboardContainer extends ShuffleboardValue {
/**

View File

@@ -21,7 +21,6 @@ import static edu.wpi.first.wpilibj.util.ErrorMessages.requireNonNullParam;
/**
* A layout in a Shuffleboard tab. Layouts can contain widgets and other layouts.
*/
@SuppressWarnings("PMD.TooManyMethods")
public class ShuffleboardLayout extends ShuffleboardComponent<ShuffleboardLayout>
implements ShuffleboardContainer {
private final ContainerHelper m_helper = new ContainerHelper(this);

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2018-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -22,7 +22,6 @@ import edu.wpi.first.wpilibj.Sendable;
* can also be added to layouts with {@link #getLayout(String, String)}; layouts can be nested
* arbitrarily deep (note that too many levels may make deeper components unusable).
*/
@SuppressWarnings("PMD.TooManyMethods")
public final class ShuffleboardTab implements ShuffleboardContainer {
private final ContainerHelper m_helper = new ContainerHelper(this);
private final ShuffleboardRoot m_root;

View File

@@ -14,7 +14,6 @@ import edu.wpi.first.wpilibj.AnalogInput;
/**
* Class to control a simulated analog input.
*/
@SuppressWarnings("PMD.TooManyMethods")
public class AnalogInputSim {
private final int m_index;

View File

@@ -15,7 +15,6 @@ import java.util.NoSuchElementException;
/**
* Class to control a simulated encoder.
*/
@SuppressWarnings("PMD.TooManyMethods")
public class EncoderSim {
private final int m_index;

View File

@@ -13,7 +13,7 @@ import edu.wpi.first.hal.simulation.RoboRioDataJNI;
/**
* Class to control a simulated RoboRIO.
*/
@SuppressWarnings({"PMD.ExcessivePublicCount", "PMD.TooManyMethods", "PMD.UseUtilityClass"})
@SuppressWarnings({"PMD.ExcessivePublicCount", "PMD.UseUtilityClass"})
public class RoboRioSim {
public static CallbackStore registerFPGAButtonCallback(NotifyCallback callback,
boolean initialNotify) {

View File

@@ -21,7 +21,6 @@ import edu.wpi.first.networktables.NetworkTable;
import edu.wpi.first.networktables.NetworkTableEntry;
import edu.wpi.first.networktables.NetworkTableValue;
@SuppressWarnings("PMD.TooManyMethods")
public class SendableBuilderImpl implements SendableBuilder {
private static class Property {
Property(NetworkTable table, String key) {

View File

@@ -24,7 +24,6 @@ import edu.wpi.first.wpilibj.Sendable;
* The SendableRegistry class is the public interface for registering sensors
* and actuators for use on dashboards and LiveWindow.
*/
@SuppressWarnings("PMD.TooManyMethods")
public class SendableRegistry {
private static class Component {
Component() {}

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2008-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2008-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -26,7 +26,7 @@ import edu.wpi.first.wpilibj.Sendable;
* <p>When a value is put into the SmartDashboard here, it pops up on the SmartDashboard on the
* laptop. Users can put values into and get values from the SmartDashboard.
*/
@SuppressWarnings({"PMD.GodClass", "PMD.TooManyMethods"})
@SuppressWarnings("PMD.GodClass")
public final class SmartDashboard {
/**
* The {@link NetworkTable} used by {@link SmartDashboard}.

View File

@@ -20,7 +20,6 @@ import edu.wpi.first.wpilibj.simulation.SimHooks;
import static org.junit.jupiter.api.Assertions.assertEquals;
class TimedRobotTest {
@SuppressWarnings("PMD.TooManyMethods")
class MockRobot extends TimedRobot {
public final AtomicInteger m_robotInitCount = new AtomicInteger(0);
public final AtomicInteger m_simulationInitCount = new AtomicInteger(0);

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -22,7 +22,6 @@ import edu.wpi.first.wpilibj.command.Subsystem;
* <p>NOTE: Simulation currently approximates this as as single pneumatic
* cylinder and ignores the latch.
*/
@SuppressWarnings("PMD.TooManyMethods")
public class Shooter extends Subsystem {
// Devices
DoubleSolenoid m_piston1 = new DoubleSolenoid(1, 3, 4);

View File

@@ -17,7 +17,7 @@ package edu.wpi.first.wpiutil.math;
*
* @param <T> The {@link Num} this represents.
*/
@SuppressWarnings({"MethodName", "unused", "PMD.TooManyMethods"})
@SuppressWarnings({"MethodName", "unused"})
public interface Nat<T extends Num> {
/**
* The number this interface represents.

View File

@@ -14,7 +14,7 @@ import edu.wpi.first.wpiutil.math.Nat;
import edu.wpi.first.wpiutil.math.Num;
import edu.wpi.first.wpiutil.math.Pair;
@SuppressWarnings({"PMD.TooManyMethods", "ParameterName", "MethodTypeParameterName"})
@SuppressWarnings({"ParameterName", "MethodTypeParameterName"})
public final class Discretization {
private Discretization() {
// Utility class

View File

@@ -21,7 +21,7 @@ import edu.wpi.first.wpiutil.math.VecBuilder;
import edu.wpi.first.wpiutil.math.numbers.N1;
import edu.wpi.first.wpiutil.math.numbers.N3;
@SuppressWarnings({"PMD.TooManyMethods", "ParameterName"})
@SuppressWarnings("ParameterName")
public final class StateSpaceUtil {
private StateSpaceUtil() {
// Utility class

View File

@@ -12,7 +12,7 @@ import edu.wpi.first.wpiutil.math.Matrix;
import edu.wpi.first.wpiutil.math.Num;
import edu.wpi.first.wpiutil.math.numbers.N1;
@SuppressWarnings({"PMD.TooManyMethods", "ClassTypeParameterName"})
@SuppressWarnings("ClassTypeParameterName")
public class LinearSystem<States extends Num, Inputs extends Num,
Outputs extends Num> {

View File

@@ -29,7 +29,7 @@ import edu.wpi.first.wpiutil.math.numbers.N1;
* @param <R> The number of rows in this matrix.
* @param <C> The number of columns in this matrix.
*/
@SuppressWarnings({"PMD.TooManyMethods", "PMD.ExcessivePublicCount"})
@SuppressWarnings("PMD.ExcessivePublicCount")
public class Matrix<R extends Num, C extends Num> {
protected final SimpleMatrix m_storage;

View File

@@ -18,7 +18,6 @@ import org.ejml.simple.SimpleMatrix;
import edu.wpi.first.math.WPIMathJNI;
@SuppressWarnings("PMD.TooManyMethods")
public final class SimpleMatrixUtils {
private SimpleMatrixUtils() {
}

View File

@@ -25,7 +25,6 @@ import edu.wpi.first.wpiutil.math.numbers.N9;
*
* @param <N> The dimension of the vector to be constructed.
*/
@SuppressWarnings("PMD.TooManyMethods")
public class VecBuilder<N extends Num> extends MatBuilder<N, N1> {
public VecBuilder(Nat<N> rows) {
super(rows, Nat.N1());

View File

@@ -13,7 +13,6 @@ import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
@SuppressWarnings("PMD.TooManyMethods")
class Translation2dTest {
private static final double kEpsilon = 1E-9;

View File

@@ -14,7 +14,6 @@ import edu.wpi.first.wpilibj.geometry.Translation2d;
import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertEquals;
@SuppressWarnings("PMD.TooManyMethods")
class MecanumDriveKinematicsTest {
private static final double kEpsilon = 1E-9;

View File

@@ -15,7 +15,6 @@ import edu.wpi.first.wpilibj.geometry.Translation2d;
import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertEquals;
@SuppressWarnings("PMD.TooManyMethods")
class SwerveDriveKinematicsTest {
private static final double kEpsilon = 1E-9;

View File

@@ -27,7 +27,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
@SuppressWarnings("PMD.TooManyMethods")
public class StateSpaceUtilTest {
@Test
public void testCostArray() {

View File

@@ -13,7 +13,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
@SuppressWarnings({"PMD.TooManyMethods", "PMD.AvoidInstantiatingObjectsInLoops"})
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
class TrapezoidProfileTest {
private static final double kDt = 0.01;