mauritsl/node-castor-client

View on GitHub

Showing 22 of 35 total issues

Function readInet has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

DataStream.prototype.readInet = function() {
  var i;
  if (this.data.length === 4) {
    // IPv4
    var inet = [];
Severity: Minor
Found in classes/DataStream.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 _executeJoin has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Get.prototype._executeJoin = function(rows, join) {
  var self = this;
  var defer = Q.defer();
  var columns = {};
  var values = {};
Severity: Major
Found in classes/Get.js - About 2 hrs to fix

    Function next has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      var next = function() {
        if (!rows.valid()) {
          rows.rewind();
          defer.resolve({columns: columns, values: values});
          return;
    Severity: Major
    Found in classes/Get.js - About 2 hrs to fix

      Function translateType has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Schema.prototype.translateType = function(validator) {
        validator = validator.split('org.apache.cassandra.db.marshal.').join('');
        var baseType = validator.split('(')[0];
        var types = {
          'AsciiType': TypeSpec.ASCII,
      Severity: Minor
      Found in classes/Schema.js - About 1 hr to fix

        Function execute has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Get.prototype.execute = function() {
          var self = this;
          return Q.when(this._schema).then(function(schema) {
            if (typeof schema === 'undefined') {
              throw Error('Unknown table ' + self._table);
        Severity: Minor
        Found in classes/Get.js - About 1 hr to fix

          Function connect has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Transport.prototype.connect = function() {
            var self = this;
            
            if (new Date() - this._lastConnectAttempt < 5000) {
              return;
          Severity: Minor
          Found in classes/Transport.js - About 1 hr to fix

            Function Rows has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var Rows = function(data) {
              this.columns = [];
              this.rowCount = 0;
              this.columnCount = 0;
              this._current = 0;
            Severity: Minor
            Found in classes/Rows.js - About 1 hr to fix

              Function execute has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              Query.prototype.execute = function() {
                var self = this;
                var defer = Q.defer();
                
                var length = Buffer.byteLength(this._cql, 'utf8');
              Severity: Minor
              Found in classes/Query.js - About 1 hr to fix

                Function readByType has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                DataStream.prototype.readByType = function(type) {
                  switch (type.getType()) {
                    case TypeSpec.ASCII:
                    case TypeSpec.VARCHAR:
                    case TypeSpec.TEXT:
                Severity: Minor
                Found in classes/DataStream.js - About 1 hr to fix

                  Function getValueString has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  Field.prototype.getValueString = function() {
                    if (this.value === null) {
                      // All field types can be null.
                      return 'NULL';
                    }
                  Severity: Minor
                  Found in classes/Field.js - About 1 hr to fix

                    Function execute has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    Set.prototype.execute = function() {
                      var self = this;
                      return Q.when(this._schema).then(function(schema) {
                        self._update.forEach(function(update) {
                          if (typeof schema.columns[update.field] === 'undefined') {
                    Severity: Minor
                    Found in classes/Set.js - About 1 hr to fix

                      Function readInet has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      DataStream.prototype.readInet = function() {
                        var i;
                        if (this.data.length === 4) {
                          // IPv4
                          var inet = [];
                      Severity: Minor
                      Found in classes/DataStream.js - About 1 hr to fix

                        Function _fetchFrames has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        Transport.prototype._fetchFrames = function() {
                          // We need at least 8 bytes for the frame header.
                          while (this._inputBuffer.length >= 8) {
                            var length = 8 + this._inputBuffer.readUInt32BE(4);
                            if (this._inputBuffer.length < length) {
                        Severity: Minor
                        Found in classes/Transport.js - About 1 hr to fix

                          Function _fetchFrames has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                          Transport.prototype._fetchFrames = function() {
                            // We need at least 8 bytes for the frame header.
                            while (this._inputBuffer.length >= 8) {
                              var length = 8 + this._inputBuffer.readUInt32BE(4);
                              if (this._inputBuffer.length < length) {
                          Severity: Minor
                          Found in classes/Transport.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 read has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                          Schema.prototype.read = function() {
                            var self = this;
                            var cql = 'SELECT columnfamily_name, column_name, type, validator FROM system.schema_columns WHERE keyspace_name = \'' + this._keyspace + '\'';
                            var query = new Query(this._transport, cql, this._consistency);
                            this._schema = query.then(function(rows) {
                          Severity: Minor
                          Found in classes/Schema.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 lt has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                          Bignum.prototype.lt = function(num) {
                            var a = this._num.toString();
                            var b = num.toString();
                            if (a == b) {
                              return false;
                          Severity: Minor
                          Found in classes/Bignum.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 Rows has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                          var Rows = function(data) {
                            this.columns = [];
                            this.rowCount = 0;
                            this.columnCount = 0;
                            this._current = 0;
                          Severity: Minor
                          Found in classes/Rows.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 getTimestamp has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          Field.prototype.getTimestamp = function() {
                            if (typeof this.value === 'string') {
                              var isDate = this.value.match(/^[0-9]{4}\-[012][0-9]\-[0-3][0-9]$/);
                              var isDateTime = this.value.match(/^[0-9]{4}\-[012][0-9]\-[0-3][0-9]T[0-2][0-9]\:[0-5][0-9]\:[0-5][0-9](\.[0-9]+)?(Z|[\+\-][012][0-9]\:[0-5][0-9])?$/);
                              if (!isDate && !isDateTime) {
                          Severity: Minor
                          Found in classes/Field.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 current has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          Rows.prototype.current = function() {
                            if (typeof this.rows[this._current] === 'undefined') {
                              throw Error('Invalid position');
                            }
                            var row = this.rows[this._current];
                          Severity: Minor
                          Found in classes/Rows.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 _executeJoin has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          Get.prototype._executeJoin = function(rows, join) {
                            var self = this;
                            var defer = Q.defer();
                            var columns = {};
                            var values = {};
                          Severity: Minor
                          Found in classes/Get.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

                          Severity
                          Category
                          Status
                          Source
                          Language