RAR1741/RA18_RobotCode

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

Summary

Maintainability
A
1 hr
Test Coverage

Remove this unused "speedMode" private field.
Open

    private boolean speedMode;

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 log(DataLogger logger) {
        left1.log(logger);
        left2.log(logger);
        right1.log(logger);
Severity: Major
Found in src/main/java/org/redalert1741/powerup/TankDrive.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/Manipulation.java on lines 311..318
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 157..164

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 setupLogging(DataLogger logger) {
        left1.setupLogging(logger);
        left2.setupLogging(logger);
        right1.setupLogging(logger);
Severity: Major
Found in src/main/java/org/redalert1741/powerup/TankDrive.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/Manipulation.java on lines 311..318
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 5 locations. Consider refactoring.
Wontfix

    public void setP(double pval) {
        left1.setP(pval);
        left2.setP(pval);
        right1.setP(pval);
        right2.setP(pval);
Severity: Major
Found in src/main/java/org/redalert1741/powerup/TankDrive.java and 4 other locations - About 40 mins to fix
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 114..119
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 121..126
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 138..143
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 150..155

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 36.

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 5 locations. Consider refactoring.
Wontfix

    public void setD(double dval) {
        left1.setD(dval);
        left2.setD(dval);
        right1.setD(dval);
        right2.setD(dval);
Severity: Major
Found in src/main/java/org/redalert1741/powerup/TankDrive.java and 4 other locations - About 40 mins to fix
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 107..112
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 114..119
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 138..143
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 150..155

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 36.

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 5 locations. Consider refactoring.
Wontfix

    public void setBrakes(boolean brake) {
        left1.setBrake(brake);
        left2.setBrake(brake);
        right1.setBrake(brake);
        right2.setBrake(brake);
Severity: Major
Found in src/main/java/org/redalert1741/powerup/TankDrive.java and 4 other locations - About 40 mins to fix
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 107..112
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 114..119
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 121..126
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 138..143

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 36.

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 5 locations. Consider refactoring.
Wontfix

    public void setI(double ival) {
        left1.setI(ival);
        left2.setI(ival);
        right1.setI(ival);
        right2.setI(ival);
Severity: Major
Found in src/main/java/org/redalert1741/powerup/TankDrive.java and 4 other locations - About 40 mins to fix
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 107..112
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 121..126
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 138..143
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 150..155

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 36.

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 5 locations. Consider refactoring.
Wontfix

    public void setRampRate(double time) {
        left1.setClosedLoopRampRate(time);
        right1.setClosedLoopRampRate(time);
        left2.setClosedLoopRampRate(time);
        right2.setClosedLoopRampRate(time);
Severity: Major
Found in src/main/java/org/redalert1741/powerup/TankDrive.java and 4 other locations - About 40 mins to fix
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 107..112
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 114..119
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 121..126
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 150..155

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 36.

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

    private void driveMotors(double left, double right) {
        left1.set(ControlMode.PercentOutput, left);
        right1.set(ControlMode.PercentOutput, right);
    }
Severity: Minor
Found in src/main/java/org/redalert1741/powerup/TankDrive.java and 1 other location - About 35 mins to fix
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 83..86

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 29.

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 driveMotorsPercentV(double left, double right){
        left1.set(ControlMode.PercentOutput, left);
        right1.set(ControlMode.PercentOutput, right);
    }
Severity: Minor
Found in src/main/java/org/redalert1741/powerup/TankDrive.java and 1 other location - About 35 mins to fix
src/main/java/org/redalert1741/powerup/TankDrive.java on lines 64..67

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 29.

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.wrapper.SolenoidWrapper'
Open

import org.redalert1741.robotbase.wrapper.SolenoidWrapper;

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 '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.

Abbreviation in name 'setPID' must contain no more than '2' consecutive capital letters.
Wontfix

    public void setPID(double pval, double ival, double dval) {

Validates abbreviations (consecutive capital letters) length in identifier name,it also allows to enforce camel case naming. Please read more atGoogle Style Guideto get to know how to avoid long abbreviations in names.

allowedAbbreviationLength specifies how many consecutive capital letters areallowed in the identifier.A value of 3 indicates that up to 4 consecutive capital letters are allowed,one after the other, before a violation is printed. The identifier 'MyTEST' would beallowed, but 'MyTESTS' would not be.A value of 0 indicates that only 1 consecutive capital letter is allowed. Thisis what should be used to enforce strict camel casing. The identifier 'MyTest' wouldbe allowed, but 'MyTEst' would not be.

ignoreFinal, ignoreStatic, and ignoreStaticFinalcontrol whether variables with the respective modifiers are to be ignored.Note that a variable that is both static and final will always be considered underignoreStaticFinal only, regardless of the values of ignoreFinaland ignoreStatic. So for example if ignoreStatic is true butignoreStaticFinal is false, then static final variables will not be ignored.

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