codenautas/best-globals

View on GitHub

Showing 24 of 37 total issues

File best-globals.js has 983 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 best-globals.js - About 2 days to fix

    Function TimeInterval has 80 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 best-globals.js - About 3 hrs to fix

      Function registerJson4All has 55 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: Major
      Found in 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 best-globals.js - About 2 hrs to fix

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

          function changing(original, changes){
              var opts = changing.retreiveOptions(arguments);
              if (changes instanceof ChangingWithSpecial) {
                  return changes.change(original);
              }
          Severity: Minor
          Found in best-globals.js - About 1 hr 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 best-globals.js - About 1 hr to fix

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

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

                Function exports has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = function(config, preConfig) {
                  config.set({
                
                    // base path that will be used to resolve all patterns (eg. files, exclude)
                    basePath: '',
                Severity: Minor
                Found in karma.conf.js - About 1 hr to fix

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

                  bestGlobals.serie = function serie(NorFirstOrObject, NifNoFirst){
                      var last;
                      var first;
                      var step;
                      var n; 
                  Severity: Minor
                  Found in best-globals.js - About 1 hr to fix

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

                    bestGlobals.dateForceIfNecesary = function dateForceIfNecesary(dt, strict) {
                        if(!strict){
                            if(dt==null) return null;
                        }
                        if(dt.ms == null && ! bestGlobals.date.isOK(dt)) { throw new Error('invalid date'); }
                    Severity: Minor
                    Found in 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 || bestGlobals;
                          return function forOrderComparator(row1,row2){
                              var column;
                              var i=0;
                      Severity: Minor
                      Found in 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 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 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 best-globals.js - About 45 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 best-globals.js - About 40 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 best-globals.js - About 40 mins to fix

                                  Consider simplifying this complex logical expression.
                                  Open

                                      if(m){
                                          var sign=m[1]=='-'?-1:1;
                                          return bestGlobals.timeInterval({
                                              ms     : m[8]*sign||0,
                                              seconds: m[7]*sign||0,
                                  Severity: Major
                                  Found in 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 best-globals.js - About 35 mins to fix

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

                                          this.toHms = function toHms(omitSeconds, withDays, omitLeftCeros, omitHourCero, omitFirstLeftCero) {
                                      Severity: Minor
                                      Found in 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 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

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language