codenautas/backend-plus

View on GitHub
lib/procedures-table.js

Summary

Maintainability
F
2 wks
Test Coverage

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

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

                async function tableDatum(context, parameters){
                    var be=context.be;
                    var tableName=parameters.table;
                    var defTable=be.tableStructures[tableName];
                    if(!defTable){
        Severity: Major
        Found in lib/procedures-table.js - About 3 hrs to fix

          Function coreFunction has 73 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  coreFunction:async function(context,parameters){
                      var {be} = context;
                      var {db} = be;
                      var tableName = parameters.table;
                      var rows = await be.inTransaction(null, async function(client){
          Severity: Major
          Found in lib/procedures-table.js - About 2 hrs to fix

            Function coreFunction has 62 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    coreFunction:async function(context, parameters){
                        var be=context.be;
                        var db=be.db;
                        var tableDef=be.tableStructures[parameters.table](context);
                        var tableDefArray = [tableDef].concat(tableDef.offline.details.map(name=>be.tableStructures[name](context)));
            Severity: Major
            Found in lib/procedures-table.js - About 2 hrs to fix

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

                      coreFunction:async function(context, parameters){
                          context.informProgress({message:"start"});
                          var {be,client} = context;
                          if (!be.can(context,'DownloadBackup')) {
                              throw new Error('Forbiden backup')
              Severity: Minor
              Found in lib/procedures-table.js - About 2 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 coreFunction has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      coreFunction:async function(context, parameters){
                          context.informProgress({message:"start"});
                          var {be,client} = context;
                          if (!be.can(context,'DownloadBackup')) {
                              throw new Error('Forbiden backup')
              Severity: Major
              Found in lib/procedures-table.js - About 2 hrs to fix

                Function coreFunction has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        coreFunction:async function(context, parameters){
                            var be=context.be;
                            context.informProgress({message:be.messages.server.deleting})
                            var be=context.be;
                            var defTable=be.tableStructures[parameters.table](context);
                Severity: Minor
                Found in lib/procedures-table.js - About 1 hr to fix

                  Function coreFunction has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          coreFunction:async function(context, parameters){
                              var be=context.be;
                              var tableName=parameters.table;
                              var changes = {sql: undefined}
                              var defTable=be.tableStructures[tableName];
                  Severity: Minor
                  Found in lib/procedures-table.js - About 1 hr to fix

                    Function testCandidateColumnAndAddIt has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                    var testCandidateColumnAndAddIt=function testCandidateColumnAndAddIt(fieldName, iColumn, cellAddress){
                                        cellAddress=cellAddress||iColumn;
                                        if(fieldName == "#cuidado"){
                                            inputCuidado = true;
                                        }else if(fieldName && fieldName!='#ignore'){
                    Severity: Minor
                    Found in lib/procedures-table.js - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                                              if(defField && 
                                                  defField.inTable!==false && 
                                                  (defField.allow.import || defField.allow.insert && (defField.allow.update || defField.isPk)) &&
                                                  (!defField.clientSide || defField.serverSide)
                                              ){
                      Severity: Critical
                      Found in lib/procedures-table.js - About 1 hr to fix

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

                                                var rowsForUpsert=lines.slice(1).map(function(line){
                                                    var othersArray = [];
                                                    if(separator=='|'){
                                                        var row = splitRawRowIntoRow(line);
                        
                        Severity: Minor
                        Found in lib/procedures-table.js - About 1 hr to fix

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

                                  coreFunction:function(context, parameters){
                                      var be=context.be;
                                      var defTable=be.tableStructures[parameters.table](context);
                                      if(!defTable.allow.delete){
                                          throw changing(new Error("Deletes not allowed"),{status:403});
                          Severity: Minor
                          Found in lib/procedures-table.js - About 1 hr to fix

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

                                    coreFunction:function(context, parameters){
                                        var be=context.be;
                                        var defTable=be.tableStructures['cursors'](context);
                                        var otherFields={username:context.username, machineId:context.machineId, navigator: context.navigator, since:new Date()};
                                        var fieldNames=[];
                            Severity: Minor
                            Found in lib/procedures-table.js - About 1 hr to fix

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

                                          var deleteOneRow=function(row){
                                              //return Promise.resolve().then(function(){
                                              //    row.
                                              var dataParams=[];
                                              var whereParts=[];
                              Severity: Minor
                              Found in lib/procedures-table.js - About 1 hr to fix

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

                                        coreFunction:function(context, parameters){
                                            var be=context.be;
                                            var defTable=be.tableStructures[parameters.table](context);
                                            if(!defTable.allow.delete){
                                                throw changing(new Error("Deletes not allowed"),{status:403});
                                Severity: Minor
                                Found in lib/procedures-table.js - About 45 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

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

                                        coreFunction:async function(context, parameters){
                                            var be=context.be;
                                            var tableName=parameters.table;
                                            var changes = {sql: undefined}
                                            var defTable=be.tableStructures[tableName];
                                Severity: Minor
                                Found in lib/procedures-table.js - About 45 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

                                Function tableDatum has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                        async function tableDatum(context, parameters){
                                            var be=context.be;
                                            var tableName=parameters.table;
                                            var defTable=be.tableStructures[tableName];
                                            if(!defTable){
                                Severity: Minor
                                Found in lib/procedures-table.js - About 45 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

                                Avoid deeply nested control flow statements.
                                Open

                                                                if(typeof cellOfFieldName.v !== 'string'){
                                                                    throw new Error(be.messages.server.importColumnDoesNotHasStringValue.replace('$1', cellAddress));
                                                                }
                                Severity: Major
                                Found in lib/procedures-table.js - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                                  if(raw!=null && raw!=='' || !bpMode){
                                                                      var value;
                                                                      if(raw==null || raw==='' || typeof raw ==="string" && raw.trim() === '') {
                                                                          value=null;
                                                                      }else if(typeof raw ==="string" && raw.startsWith('#') && be.config.imports['hashConverters']){
                                  Severity: Major
                                  Found in lib/procedures-table.js - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                                    if(!fieldNames4Insert.includes(name)){
                                                                        fieldNames4Insert.push(name);
                                                                        values4Insert.push(primaryKeyValues[i]);
                                                                    }
                                    Severity: Major
                                    Found in lib/procedures-table.js - About 45 mins to fix

                                      Consider simplifying this complex logical expression.
                                      Open

                                                  if(mainDefTable.sql.from && result.row && (!opts || !opts.forImport)){
                                                      //var rowFrom = plainUpdate.values.length?result.row:primaryKeyValueObject;
                                                      var rowFrom = parameters.status!='new' && !plainUpdate.values.length?
                                                          likeAr.toPlainObject(mainDefTable.primaryKey,expectedMainPrimaryKeyValues):
                                                          (mainResult||result).row;
                                      Severity: Major
                                      Found in lib/procedures-table.js - About 40 mins to fix

                                        Consider simplifying this complex logical expression.
                                        Open

                                                    if((!mainDefTable || parameters.status!='new') 
                                                        && (!mainDefTable || parameters.primaryKeyValues.length!=mainDefTable.primaryKey.length)
                                                        && (parameters.masive && parameters.primaryKeyValues.length>0)
                                                    ){
                                                        return {masive:true};
                                        Severity: Major
                                        Found in lib/procedures-table.js - About 40 mins to fix

                                          Consider simplifying this complex logical expression.
                                          Open

                                                                      if(fieldDef.summary 
                                                                          && (!fieldDef.summary.types4 || fieldDef.summary.types4.includes(row.data_type))
                                                                          && (!fieldDef.summary.excludeTypes || !fieldDef.summary.excludeTypes.includes(row.data_type))
                                                                      ){
                                                                          var sql=fieldDef.summary.sql|| `select ${(fieldDef.summary.expr)} from $2`;
                                          Severity: Major
                                          Found in lib/procedures-table.js - About 40 mins to fix

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

                                                    coreFunction:function(context, parameters){
                                                        var be=context.be;
                                                        var defTable=be.tableStructures['cursors'](context);
                                                        var otherFields={username:context.username, machineId:context.machineId, navigator: context.navigator, since:new Date()};
                                                        var fieldNames=[];
                                            Severity: Minor
                                            Found in lib/procedures-table.js - About 25 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

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

                                                    coreFunction:function(context, parameters){
                                                        //return 'ok';
                                                        var be=context.be;
                                                        var defTable=be.tableStructures['cursors'](context);
                                                        var otherFields={username:context.username, machineId:context.machineId, navigator: context.navigator};
                                            Severity: Minor
                                            Found in lib/procedures-table.js - About 25 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

                                            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

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

                                                            "DELETE FROM "+be.db.quoteIdent(defTable.sql.tableName)+
                                                            " WHERE "+fieldNames.map(function(name,i){
                                                                return be.db.quoteIdent(name)+' = $'+(i+1)}).join( ' AND '),values
                                            Severity: Major
                                            Found in lib/procedures-table.js and 1 other location - About 2 hrs to fix
                                            lib/procedures-table.js on lines 360..361

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

                                            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

                                                                        "UPDATE "+be.db.quoteIdent(defTable.sql.tableName)+
                                                                        " SET "+fieldNames4Update.map(function(name,i){ return be.db.quoteIdent(name)+" = $"+(i+1); }).join(', ')+
                                            Severity: Major
                                            Found in lib/procedures-table.js and 1 other location - About 2 hrs to fix
                                            lib/procedures-table.js on lines 659..661

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

                                            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

                                                        for(var name in parameters){
                                                            values.push(parameters[name]);
                                                            if(name==='table'){name='table_name'}
                                                            if(name==='primaryKeyValues'){name='pk_values'}
                                                            fieldNames.push(name);
                                            Severity: Major
                                            Found in lib/procedures-table.js and 1 other location - About 2 hrs to fix
                                            lib/procedures-table.js on lines 612..617

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

                                            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

                                                        for(var name in parameters){
                                                            values.push(parameters[name]);
                                                            if(name==='table'){name='table_name'}
                                                            if(name==='primaryKeyValues'){name='pk_values'}
                                                            fieldNames.push(name);
                                            Severity: Major
                                            Found in lib/procedures-table.js and 1 other location - About 2 hrs to fix
                                            lib/procedures-table.js on lines 648..653

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

                                            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

                                                                            "SELECT 'ok' FROM "+be.db.quoteIdent(defTable.sql.tableName)+
                                                                            " WHERE "+defTable.primaryKey.map(function(fieldName, i){
                                                                                return be.db.quoteIdent(fieldName)+" = $"+(i+1+fieldNames4Update.length);
                                                                            }).join(" AND ")+" ",
                                            Severity: Major
                                            Found in lib/procedures-table.js and 1 other location - About 1 hr to fix
                                            lib/procedures-table.js on lines 360..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 64.

                                            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

                                                                                try{
                                                                                    await context.client.query("BEGIN TRANSACTION").execute();
                                                                                }catch(err2){
                                                                                    err.detail+=' *** in BEGIN TRANSACTION ' + err2.message;
                                                                                    throw err
                                            Severity: Major
                                            Found in lib/procedures-table.js and 1 other location - About 1 hr to fix
                                            lib/procedures-table.js on lines 1049..1054

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

                                            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

                                                                                try{
                                                                                    await context.client.query('ROLLBACK').execute();
                                                                                }catch(err2){
                                                                                    err.detail+=' *** in ROLLBACK ' + err2.message;
                                                                                    throw err
                                            Severity: Major
                                            Found in lib/procedures-table.js and 1 other location - About 1 hr to fix
                                            lib/procedures-table.js on lines 1055..1060

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

                                            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

                                            There are no issues that match your filters.

                                            Category
                                            Status