codenautas/backend-plus

View on GitHub

Showing 243 of 409 total issues

Function captureKeys has 193 lines of code (exceeds 25 allowed). Consider refactoring.
Open

myOwn.captureKeys = function captureKeys() {
    var previousKey;
    var previousPosition;
    var my=this;
    if(this.captureKeysInstaled){
Severity: Major
Found in for-client/my-things.js - About 7 hrs to fix

    Function dialogDownload has 192 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    myOwn.dialogDownload = function dialogDownload(grid){
        return dialogPromise(function(dialogWindow, closeWindow){
            var prepareDownloadElement=html.button({class:'export-a'},my.messages.prepare).create();
            var downloadElement=html.a({class:'export-a'},my.messages.download).create();
            var input={
    Severity: Major
    Found in for-client/my-tables.js - About 7 hrs to fix

      Function prepareMenu has 189 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      myOwn.TableGrid.prototype.prepareMenu = function prepareMenu(button){
          button.src=my.path.img+'menu-dots.png';
          button.title=my.messages.optionsForThisTable;
          var grid=this;
          var menuOptions=[];
      Severity: Major
      Found in for-client/my-tables.js - About 7 hrs to fix

        Function presentarFormulario has 187 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function presentarFormulario(result, idFormulario, orden){
            var estructuraFormulario=result.estructura.formularios[idFormulario];
            var registro;
            var almacen=result.almacen;
            if(estructuraFormulario.multiple){
        Severity: Major
        Found in ejemplos/client/continuar.js - About 7 hrs to fix

          Function addLoggedServices has 184 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          AppBackend.prototype.addLoggedServices = function addLoggedServices(){
              var be = this;
              var skin=be.config['client-setup'].skin;
              var skinUrl=(skin?skin+'/':'');
              var slashSkin=(skin?'/'+skin:'');
          Severity: Major
          Found in lib/backend-plus.js - About 7 hrs to fix

            Function exportacionesGenerico has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
            Open

            AppBackend.prototype.exportacionesGenerico = async function exportacionesGenerico(result, procedureDef, context, params, files){
                var {csvFileName, fileName} = procedureDef.forExport
                if (!(result instanceof Array)) {
                    if (!result || !(result instanceof Object)) {
                        throw new Error ("exportacionesGenerico debe recibir {title:string, rows:Record<string, any>[]}[]")
            Severity: Minor
            Found in lib/backend-plus.js - About 7 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 controlar_compatibilidad has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
            Open

            function controlar_compatibilidad(ya, id, idBoton){
            "use strict";
                var boton=document.getElementById(idBoton || 'login');
                id = id || 'resultado_incompatibilidad';
                var div=document.getElementById(id);
            Severity: Minor
            Found in unlogged/compatibilidad.js - About 6 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 processCoreFunction has 161 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                            var processCoreFunction = function(){
                                return Promise.resolve().then(function(){
                                    if(procedureDef.roles && procedureDef.roles.indexOf(req.user[be.config.login.rolFieldName])<0){
                                        throw changing(new Error("Not allowed"), {status:"403"});
                                    }
            Severity: Major
            Found in lib/backend-plus.js - About 6 hrs to fix

              Function td has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
              Open

              myOwn.DetailColumnGrid.prototype.td = function td(depot, iColumn, tr){
                  var grid = this.grid;
                  var detailTableDef = this.detailTableDef;
                  var detailTableNameAndAbr = this.detailName;
                  var detailControl = depot.detailControls[detailTableNameAndAbr] || { show:false };
              Severity: Minor
              Found in for-client/my-tables.js - About 6 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 td has 143 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              myOwn.DetailColumnGrid.prototype.td = function td(depot, iColumn, tr){
                  var grid = this.grid;
                  var detailTableDef = this.detailTableDef;
                  var detailTableNameAndAbr = this.detailName;
                  var detailControl = depot.detailControls[detailTableNameAndAbr] || { show:false };
              Severity: Major
              Found in for-client/my-tables.js - About 5 hrs to fix

                Function displayAsDeleted has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                Open

                myOwn.TableGrid.prototype.displayAsDeleted = function displayAsDeleted(depot, mode){
                    var grid = this;
                    var fast = mode == 'change-ff'
                    if (mode == 'unknown' && myOwn.config.config['grid-row-retain-moved-or-deleted']) {
                        depot.tr.setAttribute('not-here', 'yes'); 
                Severity: Minor
                Found in for-client/my-tables.js - About 5 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

                File my-localdb.ts has 394 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                //import { TableDefinition } from "backend-plus";
                "use strict";
                //x// <amd-dependency path="../../../node_modules/like-ar/like-ar.d.ts" name="likeAr"/>
                //x// <reference path="../../node_modules/like-ar/like-ar.d.ts" />
                /// <reference path="../node_modules/types.d.ts/modules/myOwn/in-myOwn.d.ts" />
                Severity: Minor
                Found in src/for-client/my-localdb.ts - About 5 hrs to fix

                  Function tableGrid has 131 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  myOwn.tableGrid = function tableGrid(tableName, mainElement, opts){
                      var my = this;
                      var grid = new my.TableGrid({my: this}, mainElement);
                      opts = opts || {};
                      grid.detailingForUrl=opts.detailingForUrl;
                  Severity: Major
                  Found in for-client/my-tables.js - About 5 hrs to fix

                    Function addLoggedServices has 128 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        addLoggedServices(){
                            super.addLoggedServices();
                            var be = this;
                            this.app.post('/info', function(req, res){
                                res.end('ok!');
                    Severity: Major
                    Found in ejemplos/encuesta.js - About 5 hrs to fix

                      Function dialogDownload has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                      Open

                      myOwn.dialogDownload = function dialogDownload(grid){
                          return dialogPromise(function(dialogWindow, closeWindow){
                              var prepareDownloadElement=html.button({class:'export-a'},my.messages.prepare).create();
                              var downloadElement=html.a({class:'export-a'},my.messages.download).create();
                              var input={
                      Severity: Minor
                      Found in for-client/my-tables.js - About 4 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 preparing has 112 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          var preparing = grid.prepareAndDisplayGrid().then(function(){
                              if(opts.detailing){
                                  grid.depots.forEach(function(depot){
                                      var goIntoDetail=opts.detailing[(/^\w/.test(depot.lastsPrimaryKeyValues)?"":"=")+depot.lastsPrimaryKeyValues]||opts.detailing["*"];
                                      if(goIntoDetail){
                      Severity: Major
                      Found in for-client/my-tables.js - About 4 hrs to fix

                        File encuesta.js has 352 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        "use strict";
                        
                        const _ = require('lodash');
                        const util = require('util');
                        var readYaml = require('read-yaml-promise');
                        Severity: Minor
                        Found in ejemplos/encuesta.js - About 4 hrs to fix

                          File table-def-adapt.js has 351 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          "use strict";
                          
                          var likeAr = require('like-ar');
                          var changing = require('best-globals').changing;
                          var coalesce = require('best-globals').coalesce;
                          Severity: Minor
                          Found in lib/table-def-adapt.js - About 4 hrs to fix

                            File my-websqldb.ts has 338 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            //import { TableDefinition } from "backend-plus";
                            "use strict";
                            //x// <amd-dependency path="../../../node_modules/like-ar/like-ar.d.ts" name="likeAr"/>
                            //x// <reference path="../../node_modules/like-ar/like-ar.d.ts" />
                            /// <reference path="../node_modules/types.d.ts/modules/myOwn/in-myOwn.d.ts" />
                            Severity: Minor
                            Found in src/for-client/my-websqldb.ts - About 4 hrs to fix

                              Function checkDatabaseStructure has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                              Open

                              AppBackend.prototype.checkDatabaseStructure = async function checkDatabaseStructure(client){
                                  var be=this;
                                  var result = await client.query(`select setting from pg_settings where name='server_version';`).fetchUniqueValue();
                                  if(result.value<be.config.db['min-version']){
                                      console.log('PARA INSTALACIONES VIEJAS QUE NO USEN generatedAs O NO ACTUALICEN operativos:');
                              Severity: Minor
                              Found in lib/backend-plus.js - About 4 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

                              Severity
                              Category
                              Status
                              Source
                              Language