freedomjs/freedom-for-node

View on GitHub

Showing 10 of 16 total issues

File core.tcpsocket.js has 286 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*globals require, console, Uint8Array */
/*jslint node:true,sloppy:true */

/**
 * A freedom.js tcp socket provider on Node Streams
Severity: Minor
Found in providers/core.tcpsocket.js - About 2 hrs to fix

    Function exports has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function (grunt) {
      'use strict';
      require('time-grunt')(grunt);
      require('jit-grunt')(grunt, {
        'npm-publish': 'grunt-npm'
    Severity: Major
    Found in Gruntfile.js - About 2 hrs to fix

      Function replaceBuffers has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      NodeLink.prototype.replaceBuffers = function(msg) {
        var retValue, i;
        if (typeof msg === 'object' && msg && msg.byteLength) {
          retValue = msg;
          try {
      Severity: Minor
      Found in lib/link.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 onError has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      TcpSocket_node.prototype.onError = function (error) {
        if (this.state === TcpSocket_node.state.CONNECTING) {
          this.callback(undefined, {
            "errcode": "CONNECTION_FAILED",
            "message": "Socket Error: " + error.message
      Severity: Minor
      Found in providers/core.tcpsocket.js - About 1 hr to fix

        Function secure has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        TcpSocket_node.prototype.secure = function (callback) {
          if (this.state === TcpSocket_node.state.CONNECTED) {
            var cleartext = this.tlsconnect({
              socket: this.connection,
              rejectUnauthorized: true,
        Severity: Minor
        Found in providers/core.tcpsocket.js - About 1 hr to fix

          Function fix has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          NodeLink.prototype.fix = function(message) {
            if (message && message.message && message.message.message) {
              message.message.message = this.replaceBuffers(message.message.message);
            }
            if (message && message.message && message.message.binary) {
          Severity: Minor
          Found in lib/link.js - About 55 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 deliverMessage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          NodeLink.prototype.deliverMessage = function(flow, message) {
            if (this.obj) {
              /* //- For Debugging Purposes -
              if (!this.config.moduleContext) {
                console.warn('->[' + flow + '] ' + JSON.stringify(message));
          Severity: Minor
          Found in lib/link.js - About 45 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 _checkDebug has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          Debug.prototype._checkDebug = function() {
            "use strict";
            var arg, equalsIndex, i; 
            for (i=0; i<process.execArgv.length; i++) {
              arg = process.execArgv[i];
          Severity: Minor
          Found in lib/debug.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 close has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          TcpSocket_node.prototype.close = function (continuation) {
            if (this.connection && this.state !== TcpSocket_node.state.CLOSED) {
              try {
                if (this.state === TcpSocket_node.state.LISTENING) {
                  // Close server socket
          Severity: Minor
          Found in providers/core.tcpsocket.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 onConnect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          TcpSocket_node.prototype.onConnect = function (status) {
            if (this.state === TcpSocket_node.state.CONNECTING) {
              this.state = TcpSocket_node.state.CONNECTED;
              TcpSocket_node.connectionState[this.id] = this.state;
            } else if (this.state === TcpSocket_node.state.BINDING) {
          Severity: Minor
          Found in providers/core.tcpsocket.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