CCGSRobotics/RoboHUD

View on GitHub

Showing 15 of 27 total issues

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

    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

    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

    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

        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', `1, ${i}, ${y}`)
                    } else if (z == 0){
        Severity: Major
        Found in App/JS/controller.js - About 45 mins to fix

          Function lineToAngle has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function lineToAngle(ctx, x1, y1, length, angle, colour) {
          Severity: Minor
          Found in App/JS/client.js - About 45 mins to fix

            Function moveArm has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            function moveArm(dynamixel, upButton, downButton) {
              gamepad = navigator.getGamepads()[0];
              if (gamepad.buttons[upButton].value > 0) {
                if (lastVals[dynamixel] != lastVals[dynamixel]+1 && lastVals[dynamixel] < 100) {
                  moveJointWithPercentage(dynamixel, lastVals[dynamixel]+1);
            Severity: Minor
            Found in App/JS/client.js - About 35 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

            Function moveWrist has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            function moveWrist(dynamixel, upButton, downButton) {
              gamepad = navigator.getGamepads()[0];
              if (gamepad.buttons[upButton].value > 0) {
                if (lastVals[dynamixel] < 100) {
                  moveJointWithPercentage(dynamixel, lastVals[dynamixel]+1);
            Severity: Minor
            Found in App/JS/client.js - About 25 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

            Function find_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def find_file(filename):
                """
                Finds a file in the Servos/ directory
            
                Args:
            Severity: Minor
            Found in Server/Driving/dynamixels.py - About 25 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

            Severity
            Category
            Status
            Source
            Language