codenautas/backend-plus

View on GitHub

Showing 409 of 409 total issues

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

                    }else 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 789..803

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

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

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

          AppBackend.prototype.getContextForDump = function getContextForDump(){
              var be=this;
              var contextForDump={be:be, forDump:true, user:{}};
              if(be.config.login){
                  contextForDump.user[be.config.login.userFieldName]='!dump';
          Severity: Major
          Found in lib/backend-plus.js and 1 other location - About 4 hrs to fix
          lib/backend-plus.js on lines 2461..2469

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

          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

          AppBackend.prototype.getEditableForDump = function getEditableForDump(){
              var be=this;
              var contextForDump={be:be, forDump:true, user:{}};
              if(be.config.login){
                  contextForDump.user[be.config.login.userFieldName]='!dump';
          Severity: Major
          Found in lib/backend-plus.js and 1 other location - About 4 hrs to fix
          lib/backend-plus.js on lines 2471..2479

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

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

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

                    unlogged:{
                        login:{
                            title: "log in",
                            username: "username",
                            password: "password",
                Severity: Major
                Found in lib/backend-plus.js and 1 other location - About 4 hrs to fix
                lib/backend-plus.js on lines 286..315

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

                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

                    unlogged:{
                        login:{
                            title: "entrada",
                            username: "usuario",
                            password: "clave",
                Severity: Major
                Found in lib/backend-plus.js and 1 other location - About 4 hrs to fix
                lib/backend-plus.js on lines 198..227

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

                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

                                        "INSERT INTO "+be.db.quoteIdent(defTable.sql.tableName)+
                                        " ("+fieldNames4Insert.map(function(name,i){ return be.db.quoteIdent(name); }).join(', ')+
                                        ") VALUES ("+fieldNames4Insert.map(function(name,i){ return '$'+(i+1); }).join(', ')+
                                        ") "+returningClausule,
                Severity: Major
                Found in lib/procedures-table.js and 1 other location - About 4 hrs to fix
                lib/procedures-table.js on lines 625..628

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

                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

                                    "INSERT INTO "+be.db.quoteIdent(defTable.sql.tableName)+
                                    " ("+fieldNames.map(function(name,i){ return be.db.quoteIdent(name); }).join(', ')+
                                    ") VALUES ("+fieldNames.map(function(name,i){ return '$'+(i+1); }).join(', ')+
                                    ") "+returningClausule,
                Severity: Major
                Found in lib/procedures-table.js and 1 other location - About 4 hrs to fix
                lib/procedures-table.js on lines 325..328

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

                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

                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

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

                                  if(progress.lengthComputable){
                                      progressIndicator.style.width=progress.loaded*100/progress.total+'%';
                                      progressIndicator.title=Math.round(progress.loaded*100/progress.total)+'%';
                                  }else{
                                      progressIndicator.style.backgroundColor='#D4D';
                  Severity: Major
                  Found in for-client/my-tables.js and 1 other location - About 4 hrs to fix
                  unlogged/my-ajax.js on lines 279..285

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

                  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

                                  if(progressInfo.lengthComputable){
                                      progressIndicator.style.width=progressInfo.loaded*100/progressInfo.total+'%';
                                      progressIndicator.title=Math.round(progressInfo.loaded*100/progressInfo.total)+'%';
                                  }else{
                                      progressIndicator.style.backgroundColor='#D4D';
                  Severity: Major
                  Found in unlogged/my-ajax.js and 1 other location - About 4 hrs to fix
                  for-client/my-tables.js on lines 1784..1790

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

                  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