codenautas/txt-to-sql

View on GitHub

Showing 405 of 405 total issues

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

function deduceType(engineTypes, columnIndex, info) {
    var maxTypeIndex=0;
    var typeIndex=0;
    while(! engineTypes[typeIndex].validates(columnIndex, info.rows)) {
        typeIndex++;
Severity: Major
Found in web/txt-to-sql.js and 1 other location - About 2 hrs to fix
lib/txt-to-sql.js on lines 505..513

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 77.

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

function deduceType(engineTypes, columnIndex, info) {
    var maxTypeIndex=0;
    var typeIndex=0;
    while(! engineTypes[typeIndex].validates(columnIndex, info.rows)) {
        typeIndex++;
Severity: Major
Found in lib/txt-to-sql.js and 1 other location - About 2 hrs to fix
web/txt-to-sql.js on lines 505..513

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 77.

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

Function verifyInputParams has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

function verifyInputParams(info){
    info.opts = changing(txtToSql.defaultOpts, info.opts || {});
    txtToSql.detectBooleans = info.opts.detectBooleans;
    info.messages=txtToSql.dictionary[info.opts.lang];
    var errors=[];
Severity: Minor
Found in web/txt-to-sql.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 verifyInputParams has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

function verifyInputParams(info){
    info.opts = changing(txtToSql.defaultOpts, info.opts || {});
    txtToSql.detectBooleans = info.opts.detectBooleans;
    info.messages=txtToSql.dictionary[info.opts.lang];
    var errors=[];
Severity: Minor
Found in lib/txt-to-sql.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 doFast has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function doFast(params, inputBase, fastBufferingThreshold, outputStream) {
    var inStream, outStream;
    var rl;
    var preparedResult;
    return Promise.resolve().then(function() {
Severity: Major
Found in bin/fast.js - About 2 hrs to fix

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

    DBCSDecoder.prototype.write = function(buf) {
        var newBuf = Buffer.alloc(buf.length*2),
            nodeIdx = this.nodeIdx, 
            prevBuf = this.prevBuf, prevBufOffset = this.prevBuf.length,
            seqStart = -this.prevBuf.length, // idx of the start of current parsed sequence.
    Severity: Major
    Found in web/iconv-lite.js - About 2 hrs to fix

      Function 24 has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      },{}],24:[function(require,module,exports){
      /* eslint-disable node/no-deprecated-api */
      var buffer = require('buffer')
      var Buffer = buffer.Buffer
      
      
      Severity: Major
      Found in web/iconv-lite.js - About 2 hrs to fix

        Function DBCSCodec has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function DBCSCodec(codecOptions, iconv) {
            this.encodingName = codecOptions.encodingName;
            if (!codecOptions)
                throw new Error("DBCS codec is called without the data.")
            if (!codecOptions.table)
        Severity: Minor
        Found in web/iconv-lite.js - About 2 hrs to fix

          Consider simplifying this complex logical expression.
          Open

              if(h<0 || m<0 || s<0 || ms<0 || h>23 || m>59 || s>59 || ms>999 || micros<0 || micros>999) { return false; }
          Severity: Critical
          Found in web/best-globals.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 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/iconv-lite.js - About 1 hr to fix

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

                },{"safer-buffer":25,"string_decoder":26}],8:[function(require,module,exports){
                "use strict";
                var Buffer = require("safer-buffer").Buffer;
                
                // Single-byte codec. Needs a 'chars' string parameter that contains 256 or 128 chars that
                Severity: Minor
                Found in web/iconv-lite.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/iconv-lite.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

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

                              if (!inBase64) { // We're in direct mode.
                                  // Write direct chars until '+'
                                  if (buf[i] == plusChar) {
                                      res += this.iconv.decode(buf.slice(lastI, i), "ascii"); // Write direct chars.
                                      lastI = i+1;
                      Severity: Major
                      Found in web/iconv-lite.js and 1 other location - About 1 hr to fix
                      web/iconv-lite.js on lines 5147..5170

                      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 73.

                      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

                      function createInsertInto(info) {
                          return "insert into "+info.quotedTableName+" ("+info.columnsInfo.map(function(columnInfo){
                              return info.quote(columnInfo.name);
                          }).join(', ')+") values";
                      }
                      Severity: Major
                      Found in lib/txt-to-sql.js and 1 other location - About 1 hr to fix
                      web/txt-to-sql.js on lines 685..689

                      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 73.

                      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

                      function createInsertInto(info) {
                          return "insert into "+info.quotedTableName+" ("+info.columnsInfo.map(function(columnInfo){
                              return info.quote(columnInfo.name);
                          }).join(', ')+") values";
                      }
                      Severity: Major
                      Found in web/txt-to-sql.js and 1 other location - About 1 hr to fix
                      lib/txt-to-sql.js on lines 685..689

                      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 73.

                      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

                              if (!inBase64) { // We're in direct mode.
                                  // Write direct chars until '&'
                                  if (buf[i] == andChar) {
                                      res += this.iconv.decode(buf.slice(lastI, i), "ascii"); // Write direct chars.
                                      lastI = i+1;
                      Severity: Major
                      Found in web/iconv-lite.js and 1 other location - About 1 hr to fix
                      web/iconv-lite.js on lines 4976..4999

                      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 73.

                      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

                      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 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/iconv-lite.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language