CCGSRobotics/RoboHUD

View on GitHub

Showing 27 of 27 total issues

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

        for (var y = 0; y < gamepad.buttons.length; y++) {
          var row = document.createElement('tr');
          row.setAttribute('id', `Axis ${y}`)
          table.appendChild(row)

Severity: Major
Found in App/JS/controller.js and 1 other location - About 1 day to fix
App/JS/controller.js on lines 47..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 269.

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

        for (var x = 0; x < gamepad.axes.length; x++) {
          var row = document.createElement('tr');
          row.setAttribute('id', `Axis ${x}`)
          table.appendChild(row)

Severity: Major
Found in App/JS/controller.js and 1 other location - About 1 day to fix
App/JS/controller.js on lines 69..89

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

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

File client.js has 325 lines of code (exceeds 250 allowed). Consider refactoring.
Open

for (let i = 0; i <= 20; i++) {
  lastVals.push(0);
}

lastVals[10] = 100
Severity: Minor
Found in App/JS/client.js - About 3 hrs to fix

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

        if (gamepad.buttons[5].pressed && !multipliers[0][0]) {
          multipliers[0][1] *= -1;
          multipliers[0][0] = true;
          if (multipliers[0][1] == 1) {
            rightWheelDirection.innerHTML = `Right wheels: forwards`;
    Severity: Major
    Found in App/JS/client.js and 1 other location - About 2 hrs to fix
    App/JS/client.js on lines 490..501

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

    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 (gamepad.buttons[4].pressed && !multipliers[1][0]) {
          multipliers[1][1] *= -1;
          multipliers[1][0] = true;
          if (multipliers[1][1] == 1) {
            leftWheelDirection.innerHTML = `Left wheels: forwards`;
    Severity: Major
    Found in App/JS/client.js and 1 other location - About 2 hrs to fix
    App/JS/client.js on lines 477..487

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

    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(flipperSelect && (dynamixel == 5 || dynamixel == 6)) {
        var val = lastVals[dynamixel] + change;
        if(val < 0) {val = 0;}
        else if (val > 100) {val = 100;}
        if (val != lastVals[dynamixel]) {
    Severity: Major
    Found in App/JS/client.js and 1 other location - About 2 hrs to fix
    App/JS/client.js on lines 327..335

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

    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

      else if(!flipperSelect && (dynamixel == 7 || dynamixel == 8)) {
        var val = lastVals[dynamixel] - change;
        if(val < 0) {val = 0;}
        else if (val > 100) {val = 100;}
        if (val != lastVals[dynamixel]) {
    Severity: Major
    Found in App/JS/client.js and 1 other location - About 2 hrs to fix
    App/JS/client.js on lines 318..335

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

    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

    Function handle has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def handle(self):
            self.data = self.request[0].decode('utf-8').strip()
            new = self.data.split('\n')
            for i in new:
                if len(re.findall(REGEX, i)) == 1:
    Severity: Minor
    Found in Server/Driving/server.py - About 2 hrs 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

    Function handle_regex has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def handle_regex(self, data):
            """Handles the 'special' commands encased in brackets
            Args:
                data: The data to be parsed
            """
    Severity: Minor
    Found in Server/Driving/server.py - About 2 hrs 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

    Function write_value has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def write_value(self, name, value):
            """
            Writes value to the address of name
    
            Args:
    Severity: Minor
    Found in Server/Driving/dynamixels.py - About 2 hrs 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

    Function moveFlipper has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    function moveFlipper(dynamixel, axis) {
      const gamepad = navigator.getGamepads()[0];
      const change = Math.round((gamepad.axes[axis])*5);
      if(flipperSelect && (dynamixel == 5 || dynamixel == 6)) {
        var val = lastVals[dynamixel] + change;
    Severity: Minor
    Found in App/JS/client.js - 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

      } else if (gamepad.buttons[downButton].value > 0) {
        if (lastVals[dynamixel] != lastVals[dynamixel] - 1 &&
          lastVals[dynamixel] > 0) {
          moveJointWithPercentage(dynamixel, lastVals[dynamixel] - 1);
          lastVals[dynamixel] -= 1;
    Severity: Major
    Found in App/JS/client.js and 1 other location - About 1 hr to fix
    App/JS/client.js on lines 271..282

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

    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 (gamepad.buttons[upButton].value > 0) {
        if (lastVals[dynamixel] != lastVals[dynamixel]+1 && lastVals[dynamixel] < 100) {
          moveJointWithPercentage(dynamixel, lastVals[dynamixel]+1);
          lastVals[dynamixel] += 1;
        }
    Severity: Major
    Found in App/JS/client.js and 1 other location - About 1 hr to fix
    App/JS/client.js on lines 276..282

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

    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

    Function moveJointWithPercentage has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    function moveJointWithPercentage(ID, percentage) {
      lastVals[ID] = percentage;
      destination = 1023 + (percentage * 2048) / 100;
      if (ID == 5 || ID == 8) {
        destination = 3071 - (percentage*2048)/100;
    Severity: Minor
    Found in App/JS/client.js - 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

    Function initialise_dynamixel has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def initialise_dynamixel(model, dynamixel_id, protocol):
        """
        Creates a Dynamixel object with a relevant control table
    
        Args:
    Severity: Minor
    Found in Server/Driving/dynamixels.py - 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

    Function read_value has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def read_value(self, name):
            """
            Reads a value at the address of name
    
            Args:
    Severity: Minor
    Found in Server/Driving/dynamixels.py - 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

    function moveStraight() {
      clientSocket.send('011024', 9999, '10.0.0.10')
      clientSocket.send('031024', 9999, '10.0.0.10')
      clientSocket.send('02-1024', 9999, '10.0.0.10')
      clientSocket.send('04-1024', 9999, '10.0.0.10')
    Severity: Major
    Found in App/JS/client.js and 1 other location - About 1 hr to fix
    App/JS/client.js on lines 450..455

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

    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

    function stop() {
      clientSocket.send('010', 9999, '10.0.0.10')
      clientSocket.send('030', 9999, '10.0.0.10')
      clientSocket.send('020', 9999, '10.0.0.10')
      clientSocket.send('040', 9999, '10.0.0.10')
    Severity: Major
    Found in App/JS/client.js and 1 other location - About 1 hr to fix
    App/JS/client.js on lines 443..448

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

    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

    Function moveJointWithPercentage has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function moveJointWithPercentage(ID, percentage) {
      lastVals[ID] = percentage;
      destination = 1023 + (percentage * 2048) / 100;
      if (ID == 5 || ID == 8) {
        destination = 3071 - (percentage*2048)/100;
    Severity: Minor
    Found in App/JS/client.js - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                for (var z = 0; z < 3; z++) {
                  var data = document.createElement('td');
                  if (z == 2) {
                    data.setAttribute('id', `0, ${i}, ${x}`)
                  } else if (z == 0){
      Severity: Major
      Found in App/JS/controller.js - About 45 mins to fix
        Severity
        Category
        Status
        Source
        Language