codenautas/txt-to-sql

View on GitHub
web/best-globals.js

Summary

Maintainability
F
6 days
Test Coverage

File best-globals.js has 615 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"use strict";

(function codenautasModuleDefinition(root, name, factory) {
    /* global define */
    /* istanbul ignore next */
Severity: Major
Found in web/best-globals.js - About 1 day to fix

    Function TimeInterval has 73 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    bestGlobals.TimeInterval = function TimeInterval(timePack){
        /* istanbul ignore next */
        if(typeof timePack === 'number'){
            timePack={ms:timePack};
            console.log('|-----------------------------|');
    Severity: Major
    Found in web/best-globals.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 forOrder has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        bestGlobals.forOrder = function forOrder(text){
            if(text==null){
                return 'zzz(null)';
            }
            if(text instanceof Date){
        Severity: Minor
        Found in web/best-globals.js - About 1 hr to fix

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

          bestGlobals.changing = function changing(original, changes){
              var opts = bestGlobals.changing.retreiveOptions(arguments);
              if(original===null ||
                  !bestGlobals.isPlainObject(original) &&
                      !(original instanceof Error) &&
          Severity: Minor
          Found in web/best-globals.js - About 1 hr to fix

            Function registerJson4All has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            bestGlobals.registerJson4All = function registerJson4All(JSON4all){
                JSON4all.addType(Date, {
                    specialTag: function specialTag(value){
                        if(value.isRealDate){
                            return 'date';
            Severity: Minor
            Found in web/best-globals.js - About 1 hr to fix

              Function toHms has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  this.toHms = function toHms(omitSeconds, withDays, omitLeftCeros) {
                      var leftCero = omitLeftCeros?'':'0';
                      var tm = this.timeInterval.ms;
                      var prefix = (tm<0?'-':'');
                      var tdiff = [];
              Severity: Minor
              Found in web/best-globals.js - About 1 hr to fix

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

                bestGlobals.compareForOrder = function compareForOrder(sortColumns){
                    var thisModule = this;
                    return function forOrderComparator(row1,row2){
                        var column;
                        var i=0;
                Severity: Minor
                Found in web/best-globals.js - About 1 hr to fix

                  Function ymdHmsMm has 8 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  bestGlobals.datetime.ymdHmsMm = function ymdHmsMm(year, month, day, hour, minutes, seconds, ms, micros){
                  Severity: Major
                  Found in web/best-globals.js - About 1 hr to fix

                    Function ymdHmsM has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    bestGlobals.datetime.ymdHmsM = function ymdHmsM(y, m, d, hh, mm, ss, ms) {
                    Severity: Major
                    Found in web/best-globals.js - About 50 mins to fix

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

                      bestGlobals.datetime.ymdHms = function ymdHms(y, m, d, hh, mm, ss) {
                      Severity: Minor
                      Found in web/best-globals.js - About 45 mins to fix

                        Consider simplifying this complex logical expression.
                        Open

                            if(match){
                                var integerParts={};
                                integerParts.year    = parseInt(match[2],10)
                                integerParts.month   = parseInt(match[4],10)
                                integerParts.day     = parseInt(match[7],10)
                        Severity: Major
                        Found in web/best-globals.js - About 40 mins to fix

                          Consider simplifying this complex logical expression.
                          Open

                              if(original===null ||
                                  !bestGlobals.isPlainObject(original) &&
                                      !(original instanceof Error) &&
                                      (!opts.mostlyPlain || typeof original != "object" || !bestGlobals.isPlainObject(changes))
                                   // && !bestGlobals.changing
                          Severity: Major
                          Found in web/best-globals.js - About 40 mins to fix

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

                            bestGlobals.Datetime.isValidTime = function isValidTime(h, m, s, ms, micros) {
                            Severity: Minor
                            Found in web/best-globals.js - About 35 mins to fix

                              Function codenautasModuleDefinition has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                              (function codenautasModuleDefinition(root, name, factory) {
                                  /* global define */
                                  /* istanbul ignore next */
                                  if(typeof root.globalModuleName !== 'string'){
                                      root.globalModuleName = name;
                              Severity: Minor
                              Found in web/best-globals.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

                              Avoid too many return statements within this function.
                              Open

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

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

                                var letterTranslator = {
                                    'à':'a', 'á':'a', 'â':'a', 'ã':'a', 'ä':'a', 'å':'a', 'À':'a', 'Á':'a', 'Â':'a', 'Ã':'a', 'Ä':'a', 'Å':'a',
                                    'è':'e', 'é':'e', 'ê':'e', 'ë':'e', 'È':'e', 'É':'e', 'Ê':'e', 'Ë':'e',
                                    'ì':'i', 'í':'i', 'î':'i', 'ï':'i', 'Ì':'i', 'Í':'i', 'Î':'i', 'Ï':'i',
                                    'ò':'o', 'ó':'o', 'ô':'o', 'õ':'o', 'ö':'o', 'Ò':'o', 'Ó':'o', 'Ô':'o', 'Õ':'o', 'Ö':'o',
                                Severity: Major
                                Found in web/best-globals.js and 2 other locations - About 1 day to fix
                                lib/txt-to-sql.js on lines 202..209
                                web/txt-to-sql.js on lines 202..209

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

                                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

                                (function codenautasModuleDefinition(root, name, factory) {
                                    /* global define */
                                    /* istanbul ignore next */
                                    if(typeof root.globalModuleName !== 'string'){
                                        root.globalModuleName = name;
                                Severity: Major
                                Found in web/best-globals.js and 1 other location - About 7 hrs to fix
                                web/js-to-html.js on lines 5..1431

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

                                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

                                bestGlobals.coalesce.throwError=function throwError(message){
                                    if(this === bestGlobals.coalesce){
                                        return new bestGlobals.coalesce.throwError(message);
                                    }else{
                                        this.message=message;
                                Severity: Major
                                Found in web/best-globals.js and 1 other location - About 1 hr to fix
                                web/best-globals.js on lines 58..64

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

                                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

                                bestGlobals.coalesce.throwErrorIfUndefined=function throwErrorIfUndefined(message){
                                    if(this === bestGlobals.coalesce){
                                        return new bestGlobals.coalesce.throwErrorIfUndefined(message);
                                    }else{
                                        this.message=message;
                                Severity: Major
                                Found in web/best-globals.js and 1 other location - About 1 hr to fix
                                web/best-globals.js on lines 50..56

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

                                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