hybridgroup/node-bebop

View on GitHub

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"),
Severity: Major
Found in lib/bebop.js - About 1 day to fix

    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
    Severity: Minor
    Found in lib/bebop.js - About 7 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 _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
    Severity: Major
    Found in lib/bebop.js - About 4 hrs to fix

      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
      Severity: Minor
      Found in lib/bebop.js - About 3 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 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;
      Severity: Major
      Found in lib/bebop.js - About 2 hrs to fix

        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
        Severity: Minor
        Found in lib/bebop.js - About 1 hr to fix

          Avoid deeply nested control flow statements.
          Open

                    if (!Buffer.isBuffer(this._arstreamFrame.fragments[i])) {
                      skip = true;
                      break;
                    }
          Severity: Major
          Found in lib/bebop.js - About 45 mins to fix

            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);
                      }
            Severity: Major
            Found in lib/bebop.js - About 45 mins to fix

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

              Piloting.prototype.pcmd = function(flag, roll, pitch, yaw, gaz,
                                                 timestampAndSeqNum) {
              Severity: Minor
              Found in lib/Piloting.js - About 45 mins to fix

                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;
                Severity: Major
                Found in lib/bebop.js - About 45 mins to fix

                  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;
                  Severity: Major
                  Found in lib/bebop.js - About 45 mins to fix

                    Function sendControllerGPS has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    GPSSettings.prototype.sendControllerGPS = function(latitude, longitude,
                                                                       altitude, horizontalAccuracy,
                                                                       verticalAccuracy) {
                    Severity: Minor
                    Found in lib/GPSSettings.js - About 35 mins to fix

                      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";
                      Severity: Minor
                      Found in lib/types.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

                      Severity
                      Category
                      Status
                      Source
                      Language