RAR1741/RA18_RobotCode

View on GitHub
src/main/java/org/redalert1741/powerup/Manipulation.java

Summary

Maintainability
B
6 hrs
Test Coverage

Manipulation has 36 methods (exceeds 20 allowed). Consider refactoring.
Open

public class Manipulation implements Loggable, Configurable {
    private DoubleSolenoidWrapper tilt;
    private TalonSrxWrapper first;
    private TalonSrxWrapper second;
    private TalonSrxWrapper secondFollower;
Severity: Minor
Found in src/main/java/org/redalert1741/powerup/Manipulation.java - About 4 hrs to fix

File Manipulation.java has 254 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

package org.redalert1741.powerup;

import com.ctre.phoenix.motorcontrol.ControlMode;

import edu.wpi.first.wpilibj.DoubleSolenoid;
Severity: Minor
Found in src/main/java/org/redalert1741/powerup/Manipulation.java - About 2 hrs to fix

Remove this unused "firstStageMaxHeight" private field.
Open

    private double firstStageMaxHeight;

If a private field is declared but not used in the program, it can be considered dead code and should therefore be removed. This will improve maintainability because developers will not wonder what the variable is used for.

Note that this rule does not take reflection into account, which means that issues will be raised on private fields that are only accessed using the reflection API.

Noncompliant Code Example

public class MyClass {
  private int foo = 42;

  public int compute(int a) {
    return a * 42;
  }

}

Compliant Solution

public class MyClass {
  public int compute(int a) {
    return a * 42;
  }
}

Exceptions

The Java serialization runtime associates with each serializable class a version number, called serialVersionUID, which is used during deserialization to verify that the sender and receiver of a serialized object have loaded classes for that object that are compatible with respect to serialization.

A serializable class can declare its own serialVersionUID explicitly by declaring a field named serialVersionUID that must be static, final, and of type long. By definition those serialVersionUID fields should not be reported by this rule:

public class MyClass implements java.io.Serializable {
  private static final long serialVersionUID = 42L;
}

Moreover, this rule doesn't raise any issue on annotated fields.

Similar blocks of code found in 4 locations. Consider refactoring.
Wontfix

    @Override
    public void setupLogging(DataLogger logger) {
        brake.setupLogging(logger);
        tilt.setupLogging(logger);
        first.setupLogging(logger);
Severity: Major
Found in src/main/java/org/redalert1741/powerup/Manipulation.java and 3 other locations - About 50 mins to fix
src/main/java/org/redalert1741/powerup/Manipulation.java on lines 311..318
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 157..164
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 166..173

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 44.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Wontfix

    @Override
    public void log(DataLogger logger) {
        brake.log(logger);
        tilt.log(logger);
        first.log(logger);
Severity: Major
Found in src/main/java/org/redalert1741/powerup/Manipulation.java and 3 other locations - About 50 mins to fix
src/main/java/org/redalert1741/powerup/Manipulation.java on lines 302..309
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 157..164
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 166..173

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 44.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public void setFirstStage(double input) {
        if(!brake.get()) {
            first.set(ControlMode.PercentOutput, input);
        } else {
            first.set(ControlMode.PercentOutput, 0);
Severity: Minor
Found in src/main/java/org/redalert1741/powerup/Manipulation.java and 1 other location - About 45 mins to fix
src/main/java/org/redalert1741/powerup/Manipulation.java on lines 128..134

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 40.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public void setFirstStagePos(int pos) {
        if(!brake.get()) {
            first.set(ControlMode.Position, pos);
        } else {
            first.set(ControlMode.PercentOutput, 0);
Severity: Minor
Found in src/main/java/org/redalert1741/powerup/Manipulation.java and 1 other location - About 45 mins to fix
src/main/java/org/redalert1741/powerup/Manipulation.java on lines 116..122

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 40.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Extra separation in import group before 'org.redalert1741.robotbase.config.Config'
Open

import org.redalert1741.robotbase.config.Config;

Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Extra separation in import group before 'edu.wpi.first.wpilibj.DoubleSolenoid'
Open

import edu.wpi.first.wpilibj.DoubleSolenoid;

Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

There are no issues that match your filters.

Category
Status