wh1ter0se/PowerUp-2018

View on GitHub

Showing 39 of 39 total issues

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

    private void screwCameraStream(){

        cameraScrew = CameraServer.getInstance().startAutomaticCapture("Screw", VisionConstants.SCREW_ID);
        
        CvSink cvsinkScrew = new CvSink("screwSink");
Severity: Major
Found in src/org/usfirst/frc/team3695/robot/Vision.java and 1 other location - About 3 hrs to fix
src/org/usfirst/frc/team3695/robot/Vision.java on lines 74..97

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

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 frameCameraStream(){
        cameraFrame = CameraServer.getInstance().startAutomaticCapture("Frame", VisionConstants.HOOK_ID);
        
        CvSink cvsinkFrame = new CvSink("frameSink");
        cvsinkFrame.setSource(cameraFrame);
Severity: Major
Found in src/org/usfirst/frc/team3695/robot/Vision.java and 1 other location - About 3 hrs to fix
src/org/usfirst/frc/team3695/robot/Vision.java on lines 48..72

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

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

SubsystemDrive has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

public class SubsystemDrive extends Subsystem {


    private static TalonSRX leftMaster;
    private static TalonSRX leftSlave;
Severity: Minor
Found in src/org/usfirst/frc/team3695/robot/subsystems/SubsystemDrive.java - About 2 hrs to fix

    Method robotInit has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public void robotInit() {
            /// instantiate bot chooser
            botChooser = new SendableChooser<>();
            botChooser.addDefault(Bot.TEUFELSKIND.toString(), Bot.TEUFELSKIND);
            botChooser.addObject(Bot.OOF.toString(), Bot.OOF);
    Severity: Minor
    Found in src/org/usfirst/frc/team3695/robot/Robot.java - About 1 hr to fix

      Method driveForza has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          public void driveForza(Joystick joy, double ramp, double radius, double inhibitor) {
              double left = 0,
                      right = 0;
              double acceleration = Xbox.RT(joy) - Xbox.LT(joy);
      
      Severity: Minor
      Found in src/org/usfirst/frc/team3695/robot/subsystems/SubsystemDrive.java - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

          public static class TEUFELSKIND {
              public static final boolean
                  LEFT_MOTOR_INVERT         = false,
                  RIGHT_MOTOR_INVERT        = true,
          
      Severity: Major
      Found in src/org/usfirst/frc/team3695/robot/Constants.java and 1 other location - About 1 hr to fix
      src/org/usfirst/frc/team3695/robot/Constants.java on lines 64..91

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

      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 static class OOF {
              public static final boolean
                  LEFT_MOTOR_INVERT         = false,
                  RIGHT_MOTOR_INVERT        = false, 
          
      Severity: Major
      Found in src/org/usfirst/frc/team3695/robot/Constants.java and 1 other location - About 1 hr to fix
      src/org/usfirst/frc/team3695/robot/Constants.java on lines 93..120

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

      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

      Method concatCameraStream has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private void concatCameraStream() {
              cameraLeft = CameraServer.getInstance().startAutomaticCapture("Left", VisionConstants.LEFT_ID);
              cameraRight = CameraServer.getInstance().startAutomaticCapture("Right", VisionConstants.RIGHT_ID);
      
              /// Dummy sinks to keep camera connections open.
      Severity: Minor
      Found in src/org/usfirst/frc/team3695/robot/Vision.java - About 1 hr to fix

        Method moveBySpeed has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public void moveBySpeed(Joystick joy, double inhibitor) {
                double dualAction = Xbox.RT(joy) - Xbox.LT(joy);
                double screwSpeed = Xbox.LEFT_Y(joy) + dualAction;
                double pinionSpeed = Xbox.RIGHT_Y(joy) + dualAction;
                
        Severity: Minor
        Found in src/org/usfirst/frc/team3695/robot/subsystems/SubsystemMast.java - About 55 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

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

            public static final double leftify(double left) {
                Boolean invert = Robot.bot == Bot.OOF ? Constants.OOF.LEFT_MOTOR_INVERT : Constants.TEUFELSKIND.LEFT_MOTOR_INVERT;
                return left * (invert ? -1.0 : 1.0) * (docking ? dockInhibitor : 1);
            }
        src/org/usfirst/frc/team3695/robot/subsystems/SubsystemDrive.java on lines 98..101

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

        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 static final double rightify(double right) {
                Boolean invert = Robot.bot == Bot.OOF ? Constants.OOF.RIGHT_MOTOR_INVERT : Constants.TEUFELSKIND.RIGHT_MOTOR_INVERT;
                return right * (invert ? -1.0 : 1.0) * (docking ? dockInhibitor : 1);
            }
        src/org/usfirst/frc/team3695/robot/subsystems/SubsystemDrive.java on lines 92..95

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

        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

        Method setPIDF has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                public static void setPIDF(TalonSRX _talon, Boolean invert, double p, double i, double d, double f) {
        Severity: Minor
        Found in src/org/usfirst/frc/team3695/robot/subsystems/SubsystemDrive.java - About 45 mins to fix

          Method screwCameraStream has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private void screwCameraStream(){
          
                  cameraScrew = CameraServer.getInstance().startAutomaticCapture("Screw", VisionConstants.SCREW_ID);
                  
                  CvSink cvsinkScrew = new CvSink("screwSink");
          Severity: Minor
          Found in src/org/usfirst/frc/team3695/robot/Vision.java - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

          package org.usfirst.frc.team3695.robot.commands;
          
          import edu.wpi.first.wpilibj.command.Command;
          import org.usfirst.frc.team3695.robot.Robot;
          
          src/org/usfirst/frc/team3695/robot/commands/ButtonCommandEat.java on lines 1..36
          src/org/usfirst/frc/team3695/robot/commands/ButtonCommandSpit.java on lines 1..36
          src/org/usfirst/frc/team3695/robot/commands/ToggleCommandHook.java on lines 1..28

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

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

          package org.usfirst.frc.team3695.robot.commands;
          
          import org.usfirst.frc.team3695.robot.Constants;
          import org.usfirst.frc.team3695.robot.Robot;
          import org.usfirst.frc.team3695.robot.enumeration.Position;
          src/org/usfirst/frc/team3695/robot/commands/ButtonCommandEat.java on lines 1..36
          src/org/usfirst/frc/team3695/robot/commands/ToggleCommandClamp.java on lines 1..28
          src/org/usfirst/frc/team3695/robot/commands/ToggleCommandHook.java on lines 1..28

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

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

          package org.usfirst.frc.team3695.robot.commands;
          
          import edu.wpi.first.wpilibj.command.Command;
          import org.usfirst.frc.team3695.robot.Robot;
          
          src/org/usfirst/frc/team3695/robot/commands/ButtonCommandEat.java on lines 1..36
          src/org/usfirst/frc/team3695/robot/commands/ButtonCommandSpit.java on lines 1..36
          src/org/usfirst/frc/team3695/robot/commands/ToggleCommandClamp.java on lines 1..28

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

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

          package org.usfirst.frc.team3695.robot.commands;
          
          import org.usfirst.frc.team3695.robot.Constants;
          import org.usfirst.frc.team3695.robot.Robot;
          import org.usfirst.frc.team3695.robot.enumeration.Position;
          src/org/usfirst/frc/team3695/robot/commands/ButtonCommandSpit.java on lines 1..36
          src/org/usfirst/frc/team3695/robot/commands/ToggleCommandClamp.java on lines 1..28
          src/org/usfirst/frc/team3695/robot/commands/ToggleCommandHook.java on lines 1..28

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

          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

          Method frameCameraStream has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private void frameCameraStream(){
                  cameraFrame = CameraServer.getInstance().startAutomaticCapture("Frame", VisionConstants.HOOK_ID);
                  
                  CvSink cvsinkFrame = new CvSink("frameSink");
                  cvsinkFrame.setSource(cameraFrame);
          Severity: Minor
          Found in src/org/usfirst/frc/team3695/robot/Vision.java - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

                      } else if (!reversing ? Xbox.LEFT_X(joy) > 0 : Xbox.LEFT_X(joy) < 0) {
                          left = acceleration;
                          right = (acceleration * ((2 * (1 - Math.abs(Xbox.LEFT_X(joy)))) - 1)) / radius;
                      } else {
          src/org/usfirst/frc/team3695/robot/subsystems/SubsystemDrive.java on lines 206..209

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

          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

                                  if (gameData.charAt(0) == 'L'){ //When the switch is on the left
                                      addSequential(new CyborgCommandRotateDegrees(AutonomousConstants.ROT_90_COUNTERCLOCKWISE));
                                      addSequential(new CyborgCommandDriveDistance(AutonomousConstants.DIST_CENTER_LINE_SWITCH_ALIGN));
                                      addSequential(new CyborgCommandRotateDegrees(AutonomousConstants.ROT_90_CLOCKWISE));
                                      addSequential(new CyborgCommandDriveDistance(AutonomousConstants.DIST_WALL_TO_BLOCKS
          Severity: Minor
          Found in src/org/usfirst/frc/team3695/robot/auto/CommandGroupAuto.java and 1 other location - About 45 mins to fix
          src/org/usfirst/frc/team3695/robot/auto/CommandGroupAuto.java on lines 80..88

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

          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

          Severity
          Category
          Status
          Source
          Language