codenautas/backend-plus

View on GitHub

Showing 408 of 408 total issues

File backend-plus.js has 3029 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/// <reference path="./in-backend-plus.d.ts" />
"use strict";

var backendPlus = {};
Severity: Major
Found in lib/backend-plus.js - About 1 wk to fix

    File my-tables.js has 2997 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    "use strict";
    
    /*global myOwn, my, XLSX, Pikaday  */
    /*global miniMenuPromise, dialogPromise, alertPromise, confirmPromise, promptPromise, simpleFormPromise */
    /*global Blob, document, CustomEvent, URL  */
    Severity: Major
    Found in for-client/my-tables.js - About 1 wk to fix

      Function displayGrid has a Cognitive Complexity of 208 (exceeds 5 allowed). Consider refactoring.
      Open

      myOwn.TableGrid.prototype.displayGrid = function displayGrid(){
          var grid = this;
          var tbody = grid.dom.table.tBodies[0];
          grid.updateRowData = function updateRowData(depot, skipUpdateStatus){
              var grid = this;
      Severity: Minor
      Found in for-client/my-tables.js - About 4 days 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 dumpDbSchemaPartial has a Cognitive Complexity of 161 (exceeds 5 allowed). Consider refactoring.
      Open

      AppBackend.prototype.dumpDbSchemaPartial = async function dumpDbSchemaPartial(partialTableStructures, opts = {}){
          var complete = opts.complete;
          var be = this;
          var db=be.db;
          db.quoteInteger = function quoteInteger(integerValue){
      Severity: Minor
      Found in lib/backend-plus.js - About 3 days 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

      File procedures-table.js has 1256 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // @ts-check
      "use strict";
      
      var {datetime, changing, coalesce, splitRawRowIntoRow} = require('best-globals');
      var XLSX = require('xlsx');
      Severity: Major
      Found in lib/procedures-table.js - About 3 days to fix

        Function start has 633 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        AppBackend.prototype.start = function start(opts){
            var be = this;
            this.getTables().forEach(
                // TODO: quitar, no debería hacer falta poner esto acá
                /**
        Severity: Major
        Found in lib/backend-plus.js - About 3 days to fix

          Function dumpDbSchemaPartial has 437 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          AppBackend.prototype.dumpDbSchemaPartial = async function dumpDbSchemaPartial(partialTableStructures, opts = {}){
              var complete = opts.complete;
              var be = this;
              var db=be.db;
              db.quoteInteger = function quoteInteger(integerValue){
          Severity: Major
          Found in lib/backend-plus.js - About 2 days to fix

            Function displayGrid has 420 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            myOwn.TableGrid.prototype.displayGrid = function displayGrid(){
                var grid = this;
                var tbody = grid.dom.table.tBodies[0];
                grid.updateRowData = function updateRowData(depot, skipUpdateStatus){
                    var grid = this;
            Severity: Major
            Found in for-client/my-tables.js - About 2 days to fix

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

              myOwn.i18n.messages.es=changing(myOwn.i18n.messages.es, {
                  Delete : "Eliminar",
                  Filter : "Filtrar",
                  actualValueInDB: "valor actual en la base de datos",
                  allGWillDelete: "(se borrarán {$t} registros)",
              Severity: Major
              Found in for-client/my-tables.js and 1 other location - About 2 days to fix
              for-client/my-tables.js on lines 43..111

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

              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

              myOwn.i18n.messages.en=changing(myOwn.i18n.messages.en, {
                  Delete : "Delete",
                  Filter : "Filter",
                  actualValueInDB: "actual value in database",
                  allGWillDelete: "({$t} records will be deleted)",
              Severity: Major
              Found in for-client/my-tables.js and 1 other location - About 2 days to fix
              for-client/my-tables.js on lines 113..181

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

              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 coreFunction has 407 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      coreFunction:async function(context, parameters, files){
                          var be=context.be;
                          var doing="opening file";
                          var skipUnknownFieldsAtImport = coalesce(parameters.skipUnknownFieldsAtImport, be.config.skipUnknownFieldsAtImport);
                          /** @type {string[]} */
              Severity: Major
              Found in lib/procedures-table.js - About 2 days to fix

                Function coreFunction has a Cognitive Complexity of 100 (exceeds 5 allowed). Consider refactoring.
                Open

                        coreFunction:async function(context, parameters, files, opts){
                            var be=context.be;
                            var mainDefTable=be.tableStructures[parameters.table](context);
                            var action=parameters.status=='new'?'insert':'update';
                            if(!mainDefTable.allow[action] && (!opts || !opts.forImport)){
                Severity: Minor
                Found in lib/procedures-table.js - About 2 days 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

                File my-things.js has 809 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                "use strict";
                
                /// <reference path="../node_modules/types.d.ts/modules/typed-controls/index.d.ts" />
                //no/ <reference path="../node_modules/types.d.ts/modules/dialog-promise/index.d.ts" />
                /// <reference path="../node_modules/types.d.ts/modules/codenautas-umd/index.d.ts" />
                Severity: Major
                Found in for-client/my-things.js - About 1 day to fix

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

                          var createPromiseForFK = function createPromiseForFK(fk:ForeignKey){
                              return Promise.resolve().then(async function(){
                                  var fkTableDef=await ldb.getStructure(fk.references);
                                  if(fkTableDef){
                                      var pk:string[] = [];
                  Severity: Major
                  Found in src/for-client/my-localdb.ts and 1 other location - About 1 day to fix
                  src/for-client/my-websqldb.ts on lines 272..293

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

                  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

                          var createPromiseForFK = function createPromiseForFK(fk:ForeignKey){
                              return Promise.resolve().then(async function(){
                                  var fkTableDef=await ldb.getStructure(fk.references);
                                  if(fkTableDef){
                                      var pk:string[] = [];
                  Severity: Major
                  Found in src/for-client/my-websqldb.ts and 1 other location - About 1 day to fix
                  src/for-client/my-localdb.ts on lines 305..326

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

                  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 addProcedureServices has 327 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  AppBackend.prototype.addProcedureServices = function addProcedureServices(forUnlogged){ 
                      var be = this;
                      if(forUnlogged){
                          var app = express();
                      }else{
                  Severity: Major
                  Found in lib/backend-plus.js - About 1 day to fix

                    Function tableDefAdapt has 307 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function tableDefAdapt(tableDef, context){
                        var be = this;
                        var fieldDomain = be.fieldDomain || {};
                        if(false && !be.fieldDomain){
                            throw new Error('lack of fieldDomain in backend. postConfig must call super.postConfig');
                    Severity: Major
                    Found in lib/table-def-adapt.js - About 1 day to fix

                      Function tableDefAdapt has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function tableDefAdapt(tableDef, context){
                          var be = this;
                          var fieldDomain = be.fieldDomain || {};
                          if(false && !be.fieldDomain){
                              throw new Error('lack of fieldDomain in backend. postConfig must call super.postConfig');
                      Severity: Minor
                      Found in lib/table-def-adapt.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

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

                      myOwn.TableConnector = function(context, opts){
                          var connector = this;
                          for(var attr in context){
                              connector[attr] = context[attr];
                          }
                      Severity: Major
                      Found in for-client/my-tables.js and 1 other location - About 1 day to fix
                      for-client/my-tables.js on lines 444..463

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

                      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

                      myOwn.TableConnectorLocal = function(context, opts){
                          var connector = this;
                          for(var attr in context){
                              connector[attr] = context[attr];
                          }
                      Severity: Major
                      Found in for-client/my-tables.js and 1 other location - About 1 day to fix
                      for-client/my-tables.js on lines 289..308

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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language