codenautas/txt-to-sql

View on GitHub
web/buffer.js

Summary

Maintainability
F
4 mos
Test Coverage

Function buffer has a Cognitive Complexity of 733 (exceeds 5 allowed). Consider refactoring.
Open

},{}],"buffer":[function(require,module,exports){
/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <https://feross.org>
Severity: Minor
Found in web/buffer.js - About 2 wks 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 buffer has 1322 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{}],"buffer":[function(require,module,exports){
/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <https://feross.org>
Severity: Major
Found in web/buffer.js - About 6 days to fix

    File buffer.js has 1518 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
    'use strict'
    
    exports.byteLength = byteLength
    exports.toByteArray = toByteArray
    Severity: Major
    Found in web/buffer.js - About 4 days to fix

      Function 2 has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
      Open

      },{}],2:[function(require,module,exports){
      exports.read = function (buffer, offset, isLE, mLen, nBytes) {
        var e, m
        var eLen = (nBytes * 8) - mLen - 1
        var eMax = (1 << eLen) - 1
      Severity: Minor
      Found in web/buffer.js - About 1 day 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 1 has 117 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      require=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
      'use strict'
      
      exports.byteLength = byteLength
      exports.toByteArray = toByteArray
      Severity: Major
      Found in web/buffer.js - About 4 hrs to fix

        Function 1 has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

        require=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
        'use strict'
        
        exports.byteLength = byteLength
        exports.toByteArray = toByteArray
        Severity: Minor
        Found in web/buffer.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 2 has 73 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        },{}],2:[function(require,module,exports){
        exports.read = function (buffer, offset, isLE, mLen, nBytes) {
          var e, m
          var eLen = (nBytes * 8) - mLen - 1
          var eMax = (1 << eLen) - 1
        Severity: Major
        Found in web/buffer.js - About 2 hrs to fix

          Function utf8Slice has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function utf8Slice (buf, start, end) {
            end = Math.min(buf.length, end)
            var res = []
          
            var i = start
          Severity: Major
          Found in web/buffer.js - About 2 hrs to fix

            Function utf8ToBytes has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function utf8ToBytes (string, units) {
              units = units || Infinity
              var codePoint
              var length = string.length
              var leadSurrogate = null
            Severity: Major
            Found in web/buffer.js - About 2 hrs to fix

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

              Buffer.prototype.write = function write (string, offset, length, encoding) {
                // Buffer#write(string)
                if (offset === undefined) {
                  encoding = 'utf8'
                  length = this.length
              Severity: Major
              Found in web/buffer.js - About 2 hrs to fix

                Function arrayIndexOf has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
                  var indexSize = 1
                  var arrLength = arr.length
                  var valLength = val.length
                
                
                Severity: Minor
                Found in web/buffer.js - About 1 hr to fix

                  Function fill has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  Buffer.prototype.fill = function fill (val, start, end, encoding) {
                    // Handle string cases:
                    if (typeof val === 'string') {
                      if (typeof start === 'string') {
                        encoding = start
                  Severity: Minor
                  Found in web/buffer.js - About 1 hr to fix

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

                    Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
                      if (!Buffer.isBuffer(target)) {
                        throw new TypeError('Argument must be a Buffer')
                      }
                    
                    
                    Severity: Minor
                    Found in web/buffer.js - About 1 hr to fix

                      Function slowToString has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function slowToString (encoding, start, end) {
                        var loweredCase = false
                      
                        // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
                        // property of a typed array.
                      Severity: Minor
                      Found in web/buffer.js - About 1 hr to fix

                        Function write has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
                          var e, m, c
                          var eLen = (nBytes * 8) - mLen - 1
                          var eMax = (1 << eLen) - 1
                          var eBias = eMax >> 1
                        Severity: Minor
                        Found in web/buffer.js - About 1 hr to fix

                          Function bidirectionalIndexOf has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
                            // Empty buffer means no match
                            if (buffer.length === 0) return -1
                          
                            // Normalize byteOffset
                          Severity: Minor
                          Found in web/buffer.js - About 1 hr to fix

                            Function byteLength has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function byteLength (string, encoding) {
                              if (Buffer.isBuffer(string)) {
                                return string.length
                              }
                              if (isArrayBufferView(string) || isArrayBuffer(string)) {
                            Severity: Minor
                            Found in web/buffer.js - About 1 hr to fix

                              Function toByteArray has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function toByteArray (b64) {
                                var tmp
                                var lens = getLens(b64)
                                var validLen = lens[0]
                                var placeHoldersLen = lens[1]
                              Severity: Minor
                              Found in web/buffer.js - About 1 hr to fix

                                Function copy has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                Buffer.prototype.copy = function copy (target, targetStart, start, end) {
                                  if (!start) start = 0
                                  if (!end && end !== 0) end = this.length
                                  if (targetStart >= target.length) targetStart = target.length
                                  if (!targetStart) targetStart = 0
                                Severity: Minor
                                Found in web/buffer.js - About 1 hr to fix

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

                                  function fromByteArray (uint8) {
                                    var tmp
                                    var len = uint8.length
                                    var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
                                    var parts = []
                                  Severity: Minor
                                  Found in web/buffer.js - About 1 hr to fix

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

                                    exports.read = function (buffer, offset, isLE, mLen, nBytes) {
                                      var e, m
                                      var eLen = (nBytes * 8) - mLen - 1
                                      var eMax = (1 << eLen) - 1
                                      var eBias = eMax >> 1
                                    Severity: Minor
                                    Found in web/buffer.js - About 1 hr to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                  if (tempCodePoint > 0x7F) {
                                                    codePoint = tempCodePoint
                                                  }
                                      Severity: Major
                                      Found in web/buffer.js - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                  if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
                                        Severity: Major
                                        Found in web/buffer.js - About 45 mins to fix

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

                                          exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
                                          Severity: Minor
                                          Found in web/buffer.js - About 45 mins to fix

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

                                            function checkInt (buf, value, offset, ext, max, min) {
                                            Severity: Minor
                                            Found in web/buffer.js - About 45 mins to fix

                                              Avoid deeply nested control flow statements.
                                              Open

                                                    if ((units -= 3) < 0) break
                                              Severity: Major
                                              Found in web/buffer.js - About 45 mins to fix

                                                Avoid deeply nested control flow statements.
                                                Open

                                                        } else if (i + 1 === length) {
                                                          // unpaired lead
                                                          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
                                                          continue
                                                        }
                                                Severity: Major
                                                Found in web/buffer.js - About 45 mins to fix

                                                  Avoid deeply nested control flow statements.
                                                  Open

                                                              if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
                                                                codePoint = tempCodePoint
                                                              }
                                                  Severity: Major
                                                  Found in web/buffer.js - About 45 mins to fix

                                                    Avoid deeply nested control flow statements.
                                                    Open

                                                                if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
                                                                  codePoint = tempCodePoint
                                                                }
                                                    Severity: Major
                                                    Found in web/buffer.js - About 45 mins to fix

                                                      Avoid deeply nested control flow statements.
                                                      Open

                                                          } else if (codePoint < 0x110000) {
                                                            if ((units -= 4) < 0) break
                                                            bytes.push(
                                                              codePoint >> 0x12 | 0xF0,
                                                              codePoint >> 0xC & 0x3F | 0x80,
                                                      Severity: Major
                                                      Found in web/buffer.js - About 45 mins to fix

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

                                                        function checkIEEE754 (buf, value, offset, ext, max, min) {
                                                        Severity: Minor
                                                        Found in web/buffer.js - About 45 mins to fix

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

                                                          function writeFloat (buf, value, offset, littleEndian, noAssert) {
                                                          Severity: Minor
                                                          Found in web/buffer.js - About 35 mins to fix

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

                                                            function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
                                                            Severity: Minor
                                                            Found in web/buffer.js - About 35 mins to fix

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

                                                              exports.read = function (buffer, offset, isLE, mLen, nBytes) {
                                                              Severity: Minor
                                                              Found in web/buffer.js - About 35 mins to fix

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

                                                                function writeDouble (buf, value, offset, littleEndian, noAssert) {
                                                                Severity: Minor
                                                                Found in web/buffer.js - About 35 mins to fix

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

                                                                  function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
                                                                  Severity: Minor
                                                                  Found in web/buffer.js - About 35 mins to fix

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

                                                                    Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
                                                                    Severity: Minor
                                                                    Found in web/buffer.js - About 35 mins to fix

                                                                      Avoid too many return statements within this function.
                                                                      Open

                                                                            return fromArrayLike(obj.data)
                                                                      Severity: Major
                                                                      Found in web/buffer.js - About 30 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                          return 0
                                                                        Severity: Major
                                                                        Found in web/buffer.js - About 30 mins to fix

                                                                          Avoid too many return statements within this function.
                                                                          Open

                                                                                  return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
                                                                          Severity: Major
                                                                          Found in web/buffer.js - About 30 mins to fix

                                                                            Avoid too many return statements within this function.
                                                                            Open

                                                                              if (y < x) return 1
                                                                            Severity: Major
                                                                            Found in web/buffer.js - About 30 mins to fix

                                                                              Avoid too many return statements within this function.
                                                                              Open

                                                                                      return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
                                                                              Severity: Major
                                                                              Found in web/buffer.js - About 30 mins to fix

                                                                                Avoid too many return statements within this function.
                                                                                Open

                                                                                    return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
                                                                                Severity: Major
                                                                                Found in web/buffer.js - About 30 mins to fix

                                                                                  Avoid too many return statements within this function.
                                                                                  Open

                                                                                      return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
                                                                                  Severity: Major
                                                                                  Found in web/buffer.js - About 30 mins to fix

                                                                                    Avoid too many return statements within this function.
                                                                                    Open

                                                                                      if (x < y) return -1
                                                                                    Severity: Major
                                                                                    Found in web/buffer.js - About 30 mins to fix

                                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                      Open

                                                                                      },{}],"buffer":[function(require,module,exports){
                                                                                      /*!
                                                                                       * The buffer module from node.js, for the browser.
                                                                                       *
                                                                                       * @author   Feross Aboukhadijeh <https://feross.org>
                                                                                      Severity: Major
                                                                                      Found in web/buffer.js and 1 other location - About 3 mos to fix
                                                                                      web/iconv-lite.js on lines 156..1872

                                                                                      Duplicated Code

                                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                      Tuning

                                                                                      This issue has a mass of 13926.

                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                      Refactorings

                                                                                      Further Reading

                                                                                      Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                      Open

                                                                                      require=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
                                                                                      'use strict'
                                                                                      
                                                                                      exports.byteLength = byteLength
                                                                                      exports.toByteArray = toByteArray
                                                                                      Severity: Major
                                                                                      Found in web/buffer.js and 1 other location - About 1 wk to fix
                                                                                      web/iconv-lite.js on lines 1..154

                                                                                      Duplicated Code

                                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                      Tuning

                                                                                      This issue has a mass of 1382.

                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                      Refactorings

                                                                                      Further Reading

                                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                      Open

                                                                                      },{}],2:[function(require,module,exports){
                                                                                      exports.read = function (buffer, offset, isLE, mLen, nBytes) {
                                                                                        var e, m
                                                                                        var eLen = (nBytes * 8) - mLen - 1
                                                                                        var eMax = (1 << eLen) - 1
                                                                                      Severity: Major
                                                                                      Found in web/buffer.js and 1 other location - About 6 days to fix
                                                                                      web/iconv-lite.js on lines 5257..5343

                                                                                      Duplicated Code

                                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                      Tuning

                                                                                      This issue has a mass of 1115.

                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                      Refactorings

                                                                                      Further Reading

                                                                                      There are no issues that match your filters.

                                                                                      Category
                                                                                      Status