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
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:
- Read upRead up
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
"""
- Read upRead up
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:
- Read upRead up
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;
- Read upRead up
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;
- Read upRead up
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:
- Read upRead up
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:
- Read upRead up
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;
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){
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){
Function lineToAngle
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function lineToAngle(ctx, x1, y1, length, angle, colour) {
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);
- Read upRead up
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);
- Read upRead up
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:
- Read upRead up
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"