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

@@ -48,7 +48,6 @@ public final class SplineHelper {
* @param waypoints The waypoints
* @return List of splines.
*/
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
public static QuinticHermiteSpline[] getQuinticSplinesFromWaypoints(List<Pose2d> waypoints) {
QuinticHermiteSpline[] splines = new QuinticHermiteSpline[waypoints.size() - 1];
for (int i = 0; i < waypoints.size() - 1; ++i) {
@@ -79,11 +78,7 @@ public final class SplineHelper {
* @return A vector of cubic hermite splines that interpolate through the provided waypoints and
* control vectors.
*/
@SuppressWarnings({
"LocalVariableName",
"PMD.ExcessiveMethodLength",
"PMD.AvoidInstantiatingObjectsInLoops"
})
@SuppressWarnings("LocalVariableName")
public static CubicHermiteSpline[] getCubicSplinesFromControlVectors(
Spline.ControlVector start, Translation2d[] waypoints, Spline.ControlVector end) {
@@ -208,7 +203,7 @@ public final class SplineHelper {
* @param controlVectors The control vectors.
* @return A vector of quintic hermite splines that interpolate through the provided waypoints.
*/
@SuppressWarnings({"LocalVariableName", "PMD.AvoidInstantiatingObjectsInLoops"})
@SuppressWarnings("LocalVariableName")
public static QuinticHermiteSpline[] getQuinticSplinesFromControlVectors(
Spline.ControlVector[] controlVectors) {
QuinticHermiteSpline[] splines = new QuinticHermiteSpline[controlVectors.length - 1];

View File

@@ -96,7 +96,6 @@ public final class SplineParameterizer {
* @throws MalformedSplineException When the spline is malformed (e.g. has close adjacent points
* with approximately opposing headings)
*/
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
public static List<PoseWithCurvature> parameterize(Spline spline, double t0, double t1) {
var splinePoints = new ArrayList<PoseWithCurvature>();