Showing 13 of 131 total issues
File bebop.js
has 564 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
var EventEmitter = require("events").EventEmitter,
dgram = require("dgram"),
util = require("util"),
Function _packetReceiver
has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring. Open
Bebop.prototype._packetReceiver = function(message) {
var networkFrame = networkFrameParser(message);
//
// libARNetwork/Sources/ARNETWORK_Receiver.c#ARNETWORK_Receiver_ThreadRun
- 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 _packetReceiver
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
Bebop.prototype._packetReceiver = function(message) {
var networkFrame = networkFrameParser(message);
//
// libARNetwork/Sources/ARNETWORK_Receiver.c#ARNETWORK_Receiver_ThreadRun
Function _createARStreamACK
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
Bebop.prototype._createARStreamACK = function(arstreamFrame) {
//
// ARSTREAM_NetworkHeaders_AckPacket_t;
//
// uint16_t frameNumber; // id of the current frame
- 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 exports
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Bebop = module.exports = function(opts) {
opts = opts || {};
this.navData = {};
this.ip = opts.ip || "192.168.42.1";
this.c2dPort = opts.c2dPort || 54321;
Function _createARStreamACK
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Bebop.prototype._createARStreamACK = function(arstreamFrame) {
//
// ARSTREAM_NetworkHeaders_AckPacket_t;
//
// uint16_t frameNumber; // id of the current frame
Avoid deeply nested control flow statements. Open
if (types.hasOwnProperty(arg.type)) {
args[arg.name] = types[arg.type]
.read(networkFrame.data, offset, arg);
offset += types[arg.type].length;
Avoid deeply nested control flow statements. Open
switch (networkFrame.data.readInt32LE(4)) {
case constants.ARCOMMANDS_ARDRONE3_PILOTINGSTATE_FLYINGSTATECHANGED_STATE_LANDED:
this.navData.flyingState = { landed: true };
this.emit("landed");
break;
Function pcmd
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Piloting.prototype.pcmd = function(flag, roll, pitch, yaw, gaz,
timestampAndSeqNum) {
Avoid deeply nested control flow statements. Open
else if (event.arg instanceof Object) {
if (types.hasOwnProperty(event.arg.type)) {
args[event.arg.name] = types[event.arg.type]
.read(networkFrame.data, offset, event.arg);
}
Avoid deeply nested control flow statements. Open
if (!Buffer.isBuffer(this._arstreamFrame.fragments[i])) {
skip = true;
break;
}
Function sendControllerGPS
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
GPSSettings.prototype.sendControllerGPS = function(latitude, longitude,
altitude, horizontalAccuracy,
verticalAccuracy) {
Function read
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
read: function(buffer, index, arg) {
var value, name, len;
len = buffer.length - index;
if (len < 4) {
name = "invalid enum";
- 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"