Showing 10 of 31 total issues

File index.js has 298 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var Stream = require('stream');
var Quorum = require('./lib/quorum');
var Connection = require('./lib/connection');
var Pool = require('generic-pool').Pool;
var Balancer = require('./lib/balancer');
Severity: Minor
Found in index.js - About 3 hrs to fix

    Function parse has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    exports.parse = function (response, parse) {
    
        response = Quorum.convert(response);
    
        for (var key in response) {
    Severity: Minor
    Found in lib/parser.js - 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 _makeRequest has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    RiakPBC.prototype._makeRequest = function (options) {
    
        var self = this;
        var stream, callback;
    
    
    Severity: Minor
    Found in index.js - About 1 hr to fix

      Function _receive has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      ConnectionManager.prototype._receive = function (data) {
      
          var length;
      
          // Make sure we can accomodate the incoming data
      Severity: Minor
      Found in lib/connection.js - About 1 hr to fix

        Function parse has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.parse = function (response, parse) {
        
            response = Quorum.convert(response);
        
            for (var key in response) {
        Severity: Minor
        Found in lib/parser.js - About 1 hr to fix

          Avoid deeply nested control flow statements.
          Open

                          else if (response.key) {
                              response[key] = response[key].toString();
                          }
          Severity: Major
          Found in lib/parser.js - About 45 mins to fix

            Function _receive has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            ConnectionManager.prototype._receive = function (data) {
            
                var length;
            
                // Make sure we can accomodate the incoming data
            Severity: Minor
            Found in lib/connection.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

            Avoid deeply nested control flow statements.
            Open

                                if (contentType === 'application/json') {
                                    response[key] = JSON.parse(response[key]);
                                }
                                else if (textPattern.test(contentType)) {
                                    response[key] = response[key].toString();
            Severity: Major
            Found in lib/parser.js - About 45 mins to fix

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

              RiakPBC.prototype._makeRequest = function (options) {
              
                  var self = this;
                  var stream, callback;
              
              
              Severity: Minor
              Found in index.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 _processMessage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              ConnectionManager.prototype._processMessage = function (data) {
              
                  var response, messageCode, err, done;
              
                  messageCode = riakproto.codes['' + data[0]];
              Severity: Minor
              Found in lib/connection.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