codenautas/backend-plus

View on GitHub
lib/backend-plus.js

Summary

Maintainability
F
1 mo
Test Coverage

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

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

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

    Function dumpDbSchemaPartial has a Cognitive Complexity of 161 (exceeds 5 allowed). Consider refactoring.
    Open

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

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

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

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

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

        Function addProcedureServices has 327 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Function addUnloggedServices has 197 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 7 hrs to fix

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

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

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

              AppBackend.prototype.exportacionesGenerico = async function exportacionesGenerico(result, procedureDef, context, params, files){
                  var {csvFileName, fileName} = procedureDef.forExport
                  if (!(result instanceof Array)) {
                      if (!result || !(result instanceof Object)) {
                          throw new Error ("exportacionesGenerico debe recibir {title:string, rows:Record<string, any>[]}[]")
              Severity: Minor
              Found in lib/backend-plus.js - About 7 hrs to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

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

                Function exportacionesGenerico has 90 lines of code (exceeds 25 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: Major
                Found in lib/backend-plus.js - About 3 hrs to fix

                  Function checkDatabaseStructure has 81 lines of code (exceeds 25 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: Major
                  Found in lib/backend-plus.js - About 3 hrs to fix

                    Function mainPage has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    AppBackend.prototype.mainPage = function mainPage(req, offlineMode, opts){
                        opts = opts||{};
                        if(!opts.icons){
                            if(!opts.icon){
                                opts.icons={
                    Severity: Major
                    Found in lib/backend-plus.js - About 2 hrs to fix

                      Function mainPage has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                      AppBackend.prototype.mainPage = function mainPage(req, offlineMode, opts){
                          opts = opts||{};
                          if(!opts.icons){
                              if(!opts.icon){
                                  opts.icons={
                      Severity: Minor
                      Found in lib/backend-plus.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 BindMemoryPerodicallySaved has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function BindMemoryPerodicallySaved(be){
                          return (
                      /**
                       * @param {Express.Session} session
                       */
                      Severity: Major
                      Found in lib/backend-plus.js - About 2 hrs to fix

                        Function MemoryPerodicallySaved has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function MemoryPerodicallySaved(session){
                            var MemoryStoreConstructor = memorystore(session);
                            class MemoryDevelConstructor extends MemoryStoreConstructor{
                                /**
                                 * @param {memorystore.MemoryConsOpts} opts
                        Severity: Major
                        Found in lib/backend-plus.js - About 2 hrs to fix

                          Function clientIncludes has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          AppBackend.prototype.clientIncludes = function clientIncludes(req, opts) {
                              const hideBEPlusInclusions = opts === true || opts && typeof opts == "object" && opts.hideBEPlusInclusions;
                              opts = opts === true ? {} : opts || {}; 
                              var list = [];
                              if (!hideBEPlusInclusions) {
                          Severity: Major
                          Found in lib/backend-plus.js - About 2 hrs to fix

                            Function constructor has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    constructor(opts){
                                        super(opts);
                                        var store=this;
                                        var fileName='sessions/local-sessions.dump';
                                        Promise.resolve().then(function(){
                            Severity: Major
                            Found in lib/backend-plus.js - About 2 hrs to fix

                              Function processBitacora has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                              var processBitacora = async function(hasError, status){
                                                  var params = getParams();
                                                  var defInsertBitacoraElement = {
                                                      procedure_name : procedureDef.action,
                                                      parameters: JSON.stringify(params),
                              Severity: Major
                              Found in lib/backend-plus.js - About 2 hrs to fix

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

                                AppBackend.prototype.start = function start(opts){
                                    var be = this;
                                    this.getTables().forEach(
                                        // TODO: quitar, no debería hacer falta poner esto acá
                                        /**
                                Severity: Minor
                                Found in lib/backend-plus.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 clientIncludes has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                                Open

                                AppBackend.prototype.clientIncludes = function clientIncludes(req, opts) {
                                    const hideBEPlusInclusions = opts === true || opts && typeof opts == "object" && opts.hideBEPlusInclusions;
                                    opts = opts === true ? {} : opts || {}; 
                                    var list = [];
                                    if (!hideBEPlusInclusions) {
                                Severity: Minor
                                Found in lib/backend-plus.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 configStaticConfig has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                AppBackend.prototype.configStaticConfig = function configStaticConfig(){
                                    this.setStaticConfig(`
                                        login:
                                          unloggedLandPage: /not-logged-in
                                          plus:
                                Severity: Major
                                Found in lib/backend-plus.js - About 2 hrs to fix

                                  Function addLoggedServices has a Cognitive Complexity of 15 (exceeds 5 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: Minor
                                  Found in lib/backend-plus.js - About 1 hr 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 validateBitacora has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  AppBackend.prototype.validateBitacora = function validateBitacora(procedureDef){
                                      var be = this;
                                      if(procedureDef.bitacora.targetTable in be.tableStructures){
                                          var contextForDump=be.getContextForDump();
                                          var tableDefFields = be.tableStructures[procedureDef.bitacora.targetTable](contextForDump).fields;
                                  Severity: Minor
                                  Found in lib/backend-plus.js - About 1 hr 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 addUnloggedServices has a Cognitive Complexity of 13 (exceeds 5 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: Minor
                                  Found in lib/backend-plus.js - About 1 hr 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 transformInput has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  AppBackend.prototype.transformInput = function transformInput(fieldDef, value){
                                      var be = this;
                                      if(fieldDef.typeName == 'text'){
                                          var idTransformer = fieldDef.transformer ?? be.config.data.transformers.text;
                                          var parameters = be.inputTransformers[idTransformer] ?? idTransformer ?? {}
                                  Severity: Minor
                                  Found in lib/backend-plus.js - About 1 hr 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

                                  Consider simplifying this complex logical expression.
                                  Open

                                          if(!fieldDef.clientSide && fieldDef.inTable!==false && !fieldDef.inJoin && !(tableDef.sql.fields[fieldDef.name]||{}).expr || fieldDef.inTable){
                                              var fieldType=typeDb[fieldDef.typeName]||'"'+fieldDef.typeName+'"';
                                              if(fieldDef.sizeByte==4){
                                                  fieldType = 'integer';
                                              }
                                  Severity: Critical
                                  Found in lib/backend-plus.js - About 1 hr to fix

                                    Consider simplifying this complex logical expression.
                                    Open

                                            if(config.nodb){
                                                console.log("server without database");
                                            }else{
                                                if(be.config.login["double-dragon"]){
                                                    be.DoubleDragon = {dbParams:{}}
                                    Severity: Critical
                                    Found in lib/backend-plus.js - About 1 hr to fix

                                      Function validateBitacora has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      AppBackend.prototype.validateBitacora = function validateBitacora(procedureDef){
                                          var be = this;
                                          if(procedureDef.bitacora.targetTable in be.tableStructures){
                                              var contextForDump=be.getContextForDump();
                                              var tableDefFields = be.tableStructures[procedureDef.bitacora.targetTable](contextForDump).fields;
                                      Severity: Minor
                                      Found in lib/backend-plus.js - About 1 hr to fix

                                        Function constructor has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            constructor(){
                                                let be = this;
                                                /** @type {any} */
                                                this.config={};
                                                /** @type {{path:string}[]} */
                                        Severity: Minor
                                        Found in lib/backend-plus.js - About 1 hr to fix

                                          Function informProgress has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                                                      context.informProgress=function informProgress(progressInfo){
                                                                          var progress2send={};
                                                                          if(progressInfo instanceof Error){
                                                                              MiniTools.globalOpts.serveErr.propertiesWhiteList.forEach(function(attr){
                                                                                  progress2send[attr] = progressInfo[attr];
                                          Severity: Minor
                                          Found in lib/backend-plus.js - About 1 hr to fix

                                            Function getDbClient has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                            be.getDbClient = function getDbClient(req){
                                                                var paramsDb = be.DoubleDragon?.dbParams?.[req?.user?.[be.config.login.userFieldName]] ?? be.config.db;
                                                                return pg.connect(paramsDb).then(function(client){
                                                                    var dbAppName=req?(
                                                                        ((req.user||{})[be.config.login.userFieldName]||'!logged')+
                                            Severity: Minor
                                            Found in lib/backend-plus.js - About 1 hr to fix

                                              Function complements has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                                  function complements(fieldDef){
                                                                      if(fieldDef.sequence && !fieldDef.sequence.name){
                                                                          tablesWithStrictSequence[tableName]={}
                                                                      }
                                                                      if(fieldDef.typeName==='text' && !fieldDef.allowEmptyText){
                                              Severity: Minor
                                              Found in lib/backend-plus.js - About 1 hr to fix

                                                Function promise has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                                Open

                                                            var promise = be.inDbClient(req, async (client)=>{
                                                                var now = bestGlobals.datetime.now();
                                                                var {row} = await client.query(`select *
                                                                    from tokens
                                                                    where tokentype = 'new-pass' and token = $1
                                                Severity: Minor
                                                Found in lib/backend-plus.js - About 1 hr to fix

                                                  Function dumpFkConstraint has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                  Open

                                                  AppBackend.prototype.dumpFkConstraint = function dumpFkConstraint(fk, tableDef, forced){
                                                      var db=this.db;
                                                      var sourceFieldList=fk.fields.map(function(pair){ return db.quoteIdent(pair.source); }).join(', ');
                                                      var targetFieldList=fk.fields.map(function(pair){ return db.quoteIdent(pair.target); }).join(', ');
                                                      var consName=db.quoteIdent(fk.consName?fk.consName:(tableDef.alias||tableDef.sql.tableName)+' '+(fk.alias||fk.references)+' REL');
                                                  Severity: Minor
                                                  Found in lib/backend-plus.js - About 55 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(be.config.log.db.results || !(type=='ROW' || type=='RESULT' || type=='QUERY-A' || type=='QUERY-P')){
                                                                                          fs.appendFile('./local-log-all.sql','-- '+(type||'')+'\n'+message+'\n');
                                                                                      }
                                                  Severity: Major
                                                  Found in lib/backend-plus.js - About 45 mins to fix

                                                    Avoid deeply nested control flow statements.
                                                    Open

                                                                                                if(progressInfo.total){
                                                                                                    var rate100=Math.floor(progressInfo.loaded*100/progressInfo.total);
                                                                                                    var rate1000=Math.floor(progressInfo.loaded*1000/progressInfo.total);
                                                                                                    if(rate100<1 && progressInfo.loaded>0){
                                                                                                        progress2send={message:'('+(rate1000||'½')+'‰)', ephemeral:true};
                                                    Severity: Major
                                                    Found in lib/backend-plus.js - About 45 mins to fix

                                                      Avoid deeply nested control flow statements.
                                                      Open

                                                                              if(!fieldDef.clientSide && fieldDef.inTable!==false && !(tableDef.sql.fields[fieldDef.name]||{}).expr || fieldDef.inView){
                                                                                  viewFields.push(db.quoteIdent(fieldDef.name));
                                                                              }
                                                      Severity: Major
                                                      Found in lib/backend-plus.js - About 45 mins to fix

                                                        Avoid deeply nested control flow statements.
                                                        Open

                                                                                if(cons.where){
                                                                                    if(cons.consName == null){
                                                                                        console.error('create unique index constraint: must include consName in ',cons);
                                                                                    }
                                                                                    prefix = 'create unique index '+db.quoteIdent(cons.consName)+' on '+cualQuoteTableName;
                                                        Severity: Major
                                                        Found in lib/backend-plus.js - About 45 mins to fix

                                                          Avoid deeply nested control flow statements.
                                                          Open

                                                                                  if(polcom?.using || polcom?.check){
                                                                                      policyLines.push(`CREATE POLICY ${be.db.quoteIdent(polcom.name ?? `bp ${command ?? `base`}`)} ON ${cualQuoteTableName} `+
                                                                                          `AS ${polcom.permissive ? `PERMISSIVE` : `RESTRICTIVE`} FOR ${command ?? `all`} TO ${be.config.db.user}`+
                                                                                          (polcom.using?     ` USING ( ${polcom.using} )`:'')+
                                                                                          (polcom.check?` WITH CHECK ( ${polcom.check} )`:'')+';'
                                                          Severity: Major
                                                          Found in lib/backend-plus.js - About 45 mins to fix

                                                            Avoid deeply nested control flow statements.
                                                            Open

                                                                                if(!opts.skipEnance && !tableDef.sql.skipEnance){
                                                                                    enanceLines.push(
                                                                                        'PERFORM enance_table('+db.quoteLiteral(tableDef.sql.tableName)+','+db.quoteLiteral(
                                                                                            tableDef.primaryKey.join(',')
                                                                                        )+');'
                                                            Severity: Major
                                                            Found in lib/backend-plus.js - About 45 mins to fix

                                                              Avoid deeply nested control flow statements.
                                                              Open

                                                                                  if(fkEnabling.length){
                                                                                      functionLines.push(
                                                                                          `create or replace function ${(tableDef.schema?be.db.quoteIdent(tableDef.schema)+'.':'')+be.db.quoteIdent(`${tableDef.tableName}_toggle_consts`)}(enable boolean) returns text
                                                                                          language plpgsql security definer as \n$BODY$\nbegin`+fkEnabling.join('')+' return $$ok$$;\nend;\n$BODY$;\n'
                                                                                      );
                                                              Severity: Major
                                                              Found in lib/backend-plus.js - About 45 mins to fix

                                                                Consider simplifying this complex logical expression.
                                                                Open

                                                                                                    if(be.config.log.db.results || !(type=='ROW' || type=='RESULT' || type=='QUERY-A' || type=='QUERY-P')){
                                                                                                        fs.appendFile('./local-log-all.sql','-- '+(type||'')+'\n'+message+'\n');
                                                                                                    }
                                                                Severity: Major
                                                                Found in lib/backend-plus.js - About 40 mins to fix

                                                                  Consider simplifying this complex logical expression.
                                                                  Open

                                                                      if (allTableData) {
                                                                          var prepa = await be.getDataDumpTransformations(allTableData)
                                                                          dataText = [
                                                                              '-- BEGIN DATA FROM DUMP',
                                                                              ...prepa.prepareTransformationSql,
                                                                  Severity: Major
                                                                  Found in lib/backend-plus.js - About 40 mins to fix

                                                                    Function passwordChanger has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                    Open

                                                                                be.passwordChanger=function(req, username, oldPassword, newPassword, done) {
                                                                    Severity: Minor
                                                                    Found in lib/backend-plus.js - About 35 mins to fix

                                                                      Function exportacionesGenerico has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                      Open

                                                                      AppBackend.prototype.exportacionesGenerico = async function exportacionesGenerico(result, procedureDef, context, params, files){
                                                                      Severity: Minor
                                                                      Found in lib/backend-plus.js - About 35 mins to fix

                                                                        Function dumpDbCreateDatabase has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                        Open

                                                                        AppBackend.prototype.dumpDbCreateDatabase = function dumpDbCreateDatabase(){
                                                                            var be = this;
                                                                            var db=be.db;
                                                                            var lines=[];
                                                                            var owner=db.quoteIdent(be.config.db.owner||be.config.install.dump.db.owner||be.config.db.user);
                                                                        Severity: Minor
                                                                        Found in lib/backend-plus.js - About 35 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 procedureDefCompleter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                        Open

                                                                        AppBackend.prototype.procedureDefCompleter = function procedureDefCompleter(procedureDef){
                                                                            procedureDef.isCompleted=true;
                                                                            procedureDef.withFastWindow=procedureDef.withFastWindow||true;
                                                                            procedureDef.method=procedureDef.method||this.defaultMethod;
                                                                            procedureDef.encoding=procedureDef.encoding||'JSON4all';
                                                                        Severity: Minor
                                                                        Found in lib/backend-plus.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 sendMail has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                        Open

                                                                        AppBackend.prototype.sendMail = async function sendMail(mailInfo, options){
                                                                            var be = this;
                                                                            if(be.config.mailer){
                                                                                if(!options || !options.event || be.config.mailer?.supervise?.event[options.event]){
                                                                                    var transporter = nodemailer.createTransport(be.config.mailer.conn);
                                                                        Severity: Minor
                                                                        Found in lib/backend-plus.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 require_resolve has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                        Open

                                                                        function require_resolve(moduleName){
                                                                            var resolved;
                                                                            var ok = 'require';
                                                                            try{
                                                                                resolved = require.resolve(moduleName);
                                                                        Severity: Minor
                                                                        Found in lib/backend-plus.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

                                                                            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

                                                                        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

                                                                        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

                                                                        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

                                                                                                    if(
                                                                                                        'minCount' in procedureDef.files && files.length<procedureDef.files.minCount &&
                                                                                                        'count' in procedureDef.files && files.length<procedureDef.files.count
                                                                                                    ){
                                                                                                        throw new Error("internal procedure "+procedureDef.action+" error: receiving less than "+procedureDef.files.minCount+" files");
                                                                        Severity: Major
                                                                        Found in lib/backend-plus.js and 1 other location - About 3 hrs to fix
                                                                        lib/backend-plus.js on lines 1532..1537

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

                                                                        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(
                                                                                                        'maxCount' in procedureDef.files && files.length<procedureDef.files.maxCount &&
                                                                                                        'count' in procedureDef.files && files.length<procedureDef.files.count
                                                                                                    ){
                                                                                                        throw new Error("internal procedure "+procedureDef.action+" error: receiving less than "+procedureDef.files.minCount+" files");
                                                                        Severity: Major
                                                                        Found in lib/backend-plus.js and 1 other location - About 3 hrs to fix
                                                                        lib/backend-plus.js on lines 1526..1531

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

                                                                        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

                                                                                    list = list.concat([
                                                                                        { type: 'js', file: 'my-things.js' },
                                                                                        { type: 'js', file: 'my-skin.js' },
                                                                                        { type: 'js', file: 'my-tables.js' },
                                                                                        { type: 'js', file: 'my-inform-net-status.js' },
                                                                        Severity: Major
                                                                        Found in lib/backend-plus.js and 1 other location - About 2 hrs to fix
                                                                        examples/tables/server/table-cursors.js on lines 9..17

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

                                                                        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

                                                                                            be.config.login.plus.newPassPageServe=function(req,res,next){
                                                                                                return MiniTools.serveJade(loginFile.replace(/\blogin\b/,'new-password'),be.optsGenericForFiles(req,{withFlash:true}).jade)(req,res,next);
                                                                                            };
                                                                        Severity: Major
                                                                        Found in lib/backend-plus.js and 1 other location - About 2 hrs to fix
                                                                        lib/backend-plus.js on lines 877..879

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

                                                                        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

                                                                                            be.config.login.plus.newPassPageServe2=function(req,res,next){
                                                                                                return MiniTools.serveJade(loginFile.replace(/\blogin\b/,'new-password-result'),be.optsGenericForFiles(req,{withFlash:true}).jade)(req,res,next);
                                                                                            };
                                                                        Severity: Major
                                                                        Found in lib/backend-plus.js and 1 other location - About 2 hrs to fix
                                                                        lib/backend-plus.js on lines 874..876

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

                                                                        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

                                                                            lines.push("grant connect, temporary on database "+db.quoteIdent(be.config.db.database)+" to "+db.quoteIdent(be.config.db.user)+";");
                                                                        Severity: Major
                                                                        Found in lib/backend-plus.js and 1 other location - About 1 hr to fix
                                                                        lib/backend-plus.js on lines 2576..2576

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

                                                                        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

                                                                            lines.push("create user "+db.quoteIdent(be.config.db.user)+" password "+db.quoteLiteral(be.config.db.password)+";");
                                                                        Severity: Major
                                                                        Found in lib/backend-plus.js and 1 other location - About 1 hr to fix
                                                                        lib/backend-plus.js on lines 2580..2580

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

                                                                        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

                                                                            var sql =  `INSERT INTO ${db.quoteIdent(schemaName)}.${db.quoteIdent(tableName)}
                                                                                (${cleanKeys.join(',')}) VALUES (${cleanValues.join(',')}) returning id`;
                                                                        Severity: Major
                                                                        Found in lib/backend-plus.js and 1 other location - About 1 hr to fix
                                                                        lib/backend-plus.js on lines 1350..1352

                                                                        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

                                                                            var sql =  `UPDATE ${db.quoteIdent(schemaName)}.${db.quoteIdent(tableName)} 
                                                                                SET ${setPairs.join(',')}
                                                                                WHERE ${filterPairs.join(' AND ')}`;
                                                                        Severity: Major
                                                                        Found in lib/backend-plus.js and 1 other location - About 1 hr to fix
                                                                        lib/backend-plus.js on lines 1334..1335

                                                                        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

                                                                                                    var dataString="COPY "+db.quoteIdent(tableName)+" ("+
                                                                                                        lines[0].filter(filterField).map(db.quoteIdent).join(', ')+
                                                                                                        ') FROM stdin;\n'+
                                                                                                        rows.map(function(line){
                                                                                                            return line.filter(function(_,i){ return filterField(lines[0][i]);}).map(function(value){
                                                                        Severity: Major
                                                                        Found in lib/backend-plus.js and 1 other location - About 1 hr to fix
                                                                        lib/backend-plus.js on lines 2976..2983

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

                                                                        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

                                                                                    be.app.get('/ext', function(req,res,next){
                                                                                        return MiniTools.serveText(be.mainPage(req, true).toHtmlDoc(),'html')(req,res,next);
                                                                                    });
                                                                        Severity: Major
                                                                        Found in lib/backend-plus.js and 1 other location - About 1 hr to fix
                                                                        lib/backend-plus.js on lines 2286..2288

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

                                                                        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

                                                                                                    var dataString="insert into "+db.quoteIdent(tableName)+" ("+
                                                                                                        lines[0].filter(filterField).map(db.quoteIdent).join(', ')+
                                                                                                        ') values\n'+
                                                                                                        rows.map(function(line){
                                                                                                            return "("+line.filter(function(_,i){ return filterField(lines[0][i]);}).map(function(value){
                                                                        Severity: Major
                                                                        Found in lib/backend-plus.js and 1 other location - About 1 hr to fix
                                                                        lib/backend-plus.js on lines 2967..2974

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

                                                                        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

                                                                                be.app.get('/menu',function(req,res,next){
                                                                                    return MiniTools.serveText(be.mainPage(req, false).toHtmlDoc(),'html')(req,res,next);
                                                                                });
                                                                        Severity: Major
                                                                        Found in lib/backend-plus.js and 1 other location - About 1 hr to fix
                                                                        lib/backend-plus.js on lines 2292..2294

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

                                                                        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

                                                                                mainApp.get(Path.posix.join(baseUrl,be.config.login.forget.urlPath), be.config.login.plus.newPassPageServe)
                                                                        Severity: Major
                                                                        Found in lib/backend-plus.js and 1 other location - About 1 hr to fix
                                                                        lib/backend-plus.js on lines 1812..1812

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

                                                                        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

                                                                                mainApp.get(Path.posix.join(baseUrl,be.config.login.forget.urlPathOk), be.config.login.plus.newPassPageServe2)
                                                                        Severity: Major
                                                                        Found in lib/backend-plus.js and 1 other location - About 1 hr to fix
                                                                        lib/backend-plus.js on lines 1811..1811

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

                                                                        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

                                                                                                        'alter table '+cualQuoteTableName+
                                                                                                        ' add constraint '+db.quoteIdent(fieldDef.name+"<>''")+
                                                                                                        ' check ('+db.quoteIdent(fieldDef.name)+"<>'');"
                                                                        Severity: Minor
                                                                        Found in lib/backend-plus.js and 1 other location - About 45 mins to fix
                                                                        lib/backend-plus.js on lines 2714..2717

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

                                                                        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

                                                                                                        'alter table '+cualQuoteTableName+
                                                                                                        ' add constraint '+db.quoteIdent(fieldDef.name+" invalid option")+
                                                                                                        ' check ('+db.quoteIdent(fieldDef.name)+
                                                                                                            ` in (${fieldDef.options.map(opt=>db.quoteLiteral(opt.option===undefined?opt:opt.option))}) );`
                                                                        Severity: Minor
                                                                        Found in lib/backend-plus.js and 1 other location - About 45 mins to fix
                                                                        lib/backend-plus.js on lines 2707..2709

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

                                                                        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  "+infoFieldList.map(function(fieldOrPair){ return fieldOrPair.split(' as ').map(function(ident){ return be.db.quoteIdent(ident)}).join(' as '); })+
                                                                                                        ", "+be.config.login.activeClausule+" as active "+
                                                                                                        ", "+be.config.login.lockedClausule+" as locked "+
                                                                                                    "  FROM  "+(be.config.login.schema?be.db.quoteIdent(be.config.login.schema)+'.':'')
                                                                        Severity: Minor
                                                                        Found in lib/backend-plus.js and 1 other location - About 40 mins to fix
                                                                        lib/backend-plus.js on lines 1059..1059

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

                                                                        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

                                                                            var targetFieldList=fk.fields.map(function(pair){ return db.quoteIdent(pair.target); }).join(', ');
                                                                        Severity: Minor
                                                                        Found in lib/backend-plus.js and 1 other location - About 40 mins to fix
                                                                        lib/backend-plus.js on lines 2587..2587

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

                                                                        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

                                                                            var sourceFieldList=fk.fields.map(function(pair){ return db.quoteIdent(pair.source); }).join(', ');
                                                                        Severity: Minor
                                                                        Found in lib/backend-plus.js and 1 other location - About 40 mins to fix
                                                                        lib/backend-plus.js on lines 2588..2588

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

                                                                        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

                                                                                        var sql = "UPDATE "+(be.config.login.schema?be.db.quoteIdent(be.config.login.schema)+'.':'')+
                                                                        Severity: Minor
                                                                        Found in lib/backend-plus.js and 1 other location - About 40 mins to fix
                                                                        lib/backend-plus.js on lines 999..1002

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

                                                                        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(!be.config.login.forget?.urlPathOk){
                                                                                    be.config.login.forget.urlPathOk = '/new-pass-ok';
                                                                                }
                                                                        Severity: Minor
                                                                        Found in lib/backend-plus.js and 1 other location - About 40 mins to fix
                                                                        lib/backend-plus.js on lines 1219..1221

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

                                                                        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(!be.config.login.forget?.urlPath){
                                                                                    be.config.login.forget.urlPath = '/new-pass';
                                                                                }
                                                                        Severity: Minor
                                                                        Found in lib/backend-plus.js and 1 other location - About 40 mins to fix
                                                                        lib/backend-plus.js on lines 1222..1224

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

                                                                        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

                                                                                            var {row} = await client.query(`select *
                                                                                                from tokens
                                                                                                where tokentype = 'new-pass' and token = $1
                                                                                                    and due > $2
                                                                                                limit 1;
                                                                        Severity: Minor
                                                                        Found in lib/backend-plus.js and 1 other location - About 35 mins to fix
                                                                        lib/backend-plus.js on lines 1890..1895

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

                                                                        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

                                                                                        var {row} = await client.query(`select *
                                                                                            from tokens
                                                                                            where tokentype = 'new-pass' and token = $1
                                                                                                and $2 < due
                                                                                            limit 1;
                                                                        Severity: Minor
                                                                        Found in lib/backend-plus.js and 1 other location - About 35 mins to fix
                                                                        lib/backend-plus.js on lines 1861..1866

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

                                                                        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

                                                                                be.app.use('/client', function(req,res,next){
                                                                                    return serveContent(path,be.optsGenericForFiles(req))(req,res,next);
                                                                                });
                                                                        Severity: Minor
                                                                        Found in lib/backend-plus.js and 1 other location - About 35 mins to fix
                                                                        lib/backend-plus.js on lines 2332..2334

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

                                                                        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

                                                                                }else{
                                                                                    throw Error("Bitacora bad definition in core function '" + procedureDef.action + "', targetTableUpdateFieldsCondition '" + fieldName + "' is null for table '" + procedureDef.bitacora.targetTable + "'.");
                                                                                }
                                                                        Severity: Minor
                                                                        Found in lib/backend-plus.js and 1 other location - About 35 mins to fix
                                                                        lib/backend-plus.js on lines 2504..2506

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

                                                                        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

                                                                                            lines.push(', primary key ('+tableDef.primaryKey.map(function(name){ return db.quoteIdent(name); }).join(', ')+')');
                                                                        Severity: Minor
                                                                        Found in lib/backend-plus.js and 1 other location - About 35 mins to fix
                                                                        lib/backend-plus.js on lines 2803..2803

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

                                                                        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

                                                                                be.app.use('/lib', function(req,res,next){
                                                                                    return serveContent(path,be.optsGenericForFiles(req))(req,res,next);
                                                                                });
                                                                        Severity: Minor
                                                                        Found in lib/backend-plus.js and 1 other location - About 35 mins to fix
                                                                        lib/backend-plus.js on lines 2329..2331

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

                                                                        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

                                                                                                sql='('+cons.fields.map(function(field){ return db.quoteIdent(field); }).join(', ')+')';
                                                                        Severity: Minor
                                                                        Found in lib/backend-plus.js and 1 other location - About 35 mins to fix
                                                                        lib/backend-plus.js on lines 2733..2733

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

                                                                        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

                                                                                Promise.resolve().then(function(){
                                                                                    if(be.isAdmin(req)){
                                                                                        info=info.concat([
                                                                                            html.h2(be.messages.server.dependences),
                                                                                            html.ul(
                                                                        Severity: Minor
                                                                        Found in lib/backend-plus.js and 1 other location - About 35 mins to fix
                                                                        lib/backend-plus.js on lines 2418..2433

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

                                                                        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

                                                                                    Promise.resolve().then(function(){
                                                                                        if(be.isAdmin(req)){
                                                                                            if(be.setLog){
                                                                                                be.setLog(req.query);
                                                                                                info=[
                                                                        Severity: Minor
                                                                        Found in lib/backend-plus.js and 1 other location - About 35 mins to fix
                                                                        lib/backend-plus.js on lines 2377..2413

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

                                                                        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(!searchResult){
                                                                                            throw Error("Bitacora bad definition in core function '" + procedureDef.action + "', targetTableUpdateFieldsCondition '" + fieldName + "' not exists in table '" + procedureDef.bitacora.targetTable + "'.");
                                                                                        }
                                                                        Severity: Minor
                                                                        Found in lib/backend-plus.js and 1 other location - About 35 mins to fix
                                                                        lib/backend-plus.js on lines 2508..2510

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

                                                                        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

                                                                                return !procedureDef.roles || procedureDef.unlogged || req.user && procedureDef.roles.indexOf(req.user[be.config.login.rolFieldName])>=0;
                                                                        Severity: Minor
                                                                        Found in lib/backend-plus.js and 1 other location - About 30 mins to fix
                                                                        lib/backend-plus.js on lines 1513..1513

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

                                                                        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(procedureDef.roles && procedureDef.roles.indexOf(req.user[be.config.login.rolFieldName])<0){
                                                                        Severity: Minor
                                                                        Found in lib/backend-plus.js and 1 other location - About 30 mins to fix
                                                                        lib/backend-plus.js on lines 1735..1735

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

                                                                        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