codenautas/backend-plus

View on GitHub

Showing 243 of 409 total issues

Avoid deeply nested control flow statements.
Open

                        if(!sameValue(depot.row[fieldName], value)){
                            if(grid.def.field[fieldName].allow.update){
                                depot.rowPendingForUpdate[fieldName] = value;
                            }
                            depot.row[fieldName] = value;
Severity: Major
Found in for-client/my-tables.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if(depot.detailControls[detailControl].tr){
                            depot.my.fade(depot.detailControls[detailControl].tr, {fast});
                        }
    Severity: Major
    Found in for-client/my-tables.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

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

        Avoid deeply nested control flow statements.
        Open

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

                  Avoid deeply nested control flow statements.
                  Open

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

                        Avoid deeply nested control flow statements.
                        Open

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

                          Consider simplifying this complex logical expression.
                          Open

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

                            Consider simplifying this complex logical expression.
                            Open

                                    if((evento.which==40 || evento.which==38)  && !evento.shiftKey  && !evento.ctrlKey  && !evento.altKey  && !evento.metaKey){ // KeyDown, KeyUp
                                        var info=tableInfo(this.activeElement);
                                    }
                            Severity: Major
                            Found in for-client/my-things.js - About 40 mins to fix

                              Consider simplifying this complex logical expression.
                              Open

                                          if(toCaption == 'labeled' || toCaption != 'alone' && (typeName == 'boolean' || typeName == 'integer' || typeName == 'bigint' || typeName == 'decimal')){
                                              captionTitle += grid.def.field[pair.fieldName].title + ':'
                                          }
                              Severity: Major
                              Found in for-client/my-tables.js - About 40 mins to fix

                                Consider simplifying this complex logical expression.
                                Open

                                    if(elemento.children.length && !noGoDownWhen(proximo)){
                                        while(proximo.children.length>0 && no_me_voy_a_colgar-- && !noGoDownWhen(proximo)){
                                            proximo=proximo.children[0];
                                        }
                                        return proximo;
                                Severity: Major
                                Found in for-client/my-things.js - About 40 mins to fix

                                  Consider simplifying this complex logical expression.
                                  Open

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

                                    Consider simplifying this complex logical expression.
                                    Open

                                            if(evento.which==13 && !evento.shiftKey  && !evento.ctrlKey  && !evento.altKey  && !evento.metaKey && !this.activeElement.getAttribute("enter-clicks")){ // Enter
                                                var enfoco=this.activeElement;
                                                var este=this.activeElement;
                                                if(enter_hace_tab_en_este_elemento(este)){
                                                    var no_me_voy_a_colgar=2000;
                                    Severity: Major
                                    Found in for-client/my-things.js - About 40 mins to fix

                                      Consider simplifying this complex logical expression.
                                      Open

                                              if((evento.which==40 || evento.which==38)  && !evento.shiftKey  && !evento.ctrlKey  && !evento.altKey  && !evento.metaKey){ // KeyDown, KeyUp
                                                  var info=tableInfo(this.activeElement);
                                                  if(info.table){
                                                      var newPos=info.tr.rowIndex+evento.which-39;
                                                      var newRow=info.table.rows[newPos];
                                      Severity: Major
                                      Found in for-client/my-things.js - About 40 mins to fix

                                        Consider simplifying this complex logical expression.
                                        Open

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