codenautas/backend-plus

View on GitHub

Showing 408 of 408 total issues

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

"use strict";

// require('lazy-some').bindToPrototypeIn(Array);
var changing = require('best-globals').changing;
myOwn.wScreens={}
Severity: Major
Found in for-client/my-menu.js - About 1 day to fix

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

    "use strict";
    (function codenautasModuleDefinition(root, name, factory) {
        /* global define */
        /* istanbul ignore next */
        if(typeof root.globalModuleName !== 'string'){
    Severity: Major
    Found in unlogged/my-ajax.js - About 1 day to fix

      Function ajaxPromise has 227 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      myAjax.ajaxPromise = function ajaxPromise(procedureDef,data,opts){
          opts = opts || {};
          if(!('visiblyLogErrors' in opts)){
              opts.visiblyLogErrors=true;
          }
      Severity: Major
      Found in unlogged/my-ajax.js - About 1 day to fix

        Function prepareGrid has 224 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        myOwn.TableGrid.prototype.prepareGrid = function prepareGrid(){
            var grid = this;
            var my = grid.my;
            grid.view.hiddenColumns=grid.view.hiddenColumns||grid.def.hiddenColumns||[];
            grid.def.fields.forEach(function(fieldDef){
        Severity: Major
        Found in for-client/my-tables.js - About 1 day to fix

          Function coreFunction has 211 lines of code (exceeds 25 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: Major
          Found in lib/procedures-table.js - About 1 day to fix

            Function addUnloggedServices has 200 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            AppBackend.prototype.addUnloggedServices = function addUnloggedServices(mainApp, baseUrl){
                var be=this;
                if(be.config.login.forget?.urlPath){
                    mainApp.get(Path.posix.join(baseUrl,be.config.login.forget.urlPath), be.config.login.plus.newPassPageServe)
                    mainApp.get(Path.posix.join(baseUrl,be.config.login.forget.urlPathOk), be.config.login.plus.newPassPageServe2)
            Severity: Major
            Found in lib/backend-plus.js - About 1 day to fix

              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

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

                            server:{
                                backupNotAvailable: 'Backup not available',
                                backupReady: 'Backup ready to download',
                                backupZipping: 'Zipping backup file',
                                badBackupEncryptKey: 'encrypt key not present or less than 10 characters',
                        Severity: Major
                        Found in lib/backend-plus.js and 1 other location - About 7 hrs to fix
                        lib/backend-plus.js on lines 328..364

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

                        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

                            server:{
                                backupNotAvailable: 'Backup no disponible',
                                backupReady: 'Archivo listo para bajar',
                                backupZipping: 'Compactando el backup',
                                badBackupEncryptKey: 'Debe proveer una clave de encriptacion de 10 caracteres o mas para encriptar el archivo de destino',
                        Severity: Major
                        Found in lib/backend-plus.js and 1 other location - About 7 hrs to fix
                        lib/backend-plus.js on lines 246..282

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

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

                        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 for-client/my-things.js and 1 other location - About 7 hrs to fix
                        unlogged/my-ajax.js on lines 2..700

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

                        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 unlogged/my-ajax.js and 1 other location - About 7 hrs to fix
                        for-client/my-things.js on lines 17..919

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

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

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

                                              if(aboveCell.getTypedValue){
                                                  var value=aboveCell.getTypedValue();
                                                  if(info.td.setTypedValue){
                                                      info.td.setTypedValue(value, true);
                                                      var belowPos=info.tr.rowIndex+1;
                          Severity: Major
                          Found in for-client/my-things.js and 1 other location - About 6 hrs to fix
                          for-client/my-things.js on lines 736..750

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

                          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