codenautas/backend-plus

View on GitHub

Showing 408 of 408 total issues

Avoid deeply nested control flow statements.
Open

                        while(i>=row.cells.length){
                            row.insertCell(-1);
                        }
Severity: Major
Found in unlogged/my-ajax.js - About 45 mins to fix

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

    function sameValue(a,b){
        return a==b ||
          a instanceof Date && b instanceof Date && a.getTime() == b.getTime() ||
          typeof a === 'number' && (a>MAX_SAFE_INTEGER || a< -MAX_SAFE_INTEGER) && Math.abs(a/b)<1.00000000000001 && Math.abs(a/b)>0.99999999999999 ||
          a && !!a.sameValue && a.sameValue(b);
    Severity: Minor
    Found in for-client/my-tables.js - About 45 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

    Avoid deeply nested control flow statements.
    Open

                        if(cells.title){
                            if(o instanceof Array && !isNaN(a)){
                                agregar_class_textInDiv(cells.title, 'row-num', Number(a) + 1); 
                            }else{
                                agregar_class_textInDiv(cells.title, 'attr-name', a); 
    Severity: Major
    Found in unlogged/my-ajax.js - About 45 mins to fix

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

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

      Cognitive Complexity

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

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

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

      Further reading

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

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

      Cognitive Complexity

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

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

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

      Further reading

      Avoid deeply nested control flow statements.
      Open

                              if(document.activeElement){
                                  var sel = window.getSelection()
                                  sel.collapse(document.activeElement,document.activeElement.childNodes.length);
                              }
      Severity: Major
      Found in for-client/my-things.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            }else if(aboveCell.getTypedValue){
                                var value=aboveCell.getTypedValue();
                                if(info.td.setTypedValue){
                                    info.td.setTypedValue(value, true);
                                    var belowPos=info.tr.rowIndex+1;
        Severity: Major
        Found in for-client/my-things.js - About 45 mins to fix

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

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

          Cognitive Complexity

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

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

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

          Further reading

          Avoid deeply nested control flow statements.
          Open

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

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

                td               :{                   encode:function(x){ return json4all.toUrl(x); }, decode:function(x){ return json4all.parse(x)}  },
            Severity: Major
            Found in unlogged/my-ajax.js and 5 other locations - About 45 mins to fix
            unlogged/my-ajax.js on lines 608..608
            unlogged/my-ajax.js on lines 609..609
            unlogged/my-ajax.js on lines 610..610
            unlogged/my-ajax.js on lines 611..611
            unlogged/my-ajax.js on lines 622..622

            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

            Avoid deeply nested control flow statements.
            Open

                                                    if(def == null) {
                                                        throw Error("no se encuentra la columna "+filteredFieldDef[i]+" en "+tableName);
                                                    }
            Severity: Major
            Found in lib/backend-plus.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(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

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

                      ff               :{                   encode:function(x){ return json4all.toUrl(x); }, decode:function(x){ return json4all.parse(x)}  },
                  Severity: Major
                  Found in unlogged/my-ajax.js and 5 other locations - About 45 mins to fix
                  unlogged/my-ajax.js on lines 608..608
                  unlogged/my-ajax.js on lines 610..610
                  unlogged/my-ajax.js on lines 611..611
                  unlogged/my-ajax.js on lines 612..612
                  unlogged/my-ajax.js on lines 622..622

                  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 6 locations. Consider refactoring.
                  Open

                      pf               :{                   encode:function(x){ return JSON.stringify(x); }, decode:function(x){ return JSON.parse(x)}      },
                  Severity: Major
                  Found in unlogged/my-ajax.js and 5 other locations - About 45 mins to fix
                  unlogged/my-ajax.js on lines 608..608
                  unlogged/my-ajax.js on lines 609..609
                  unlogged/my-ajax.js on lines 610..610
                  unlogged/my-ajax.js on lines 612..612
                  unlogged/my-ajax.js on lines 622..622

                  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

                  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

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

                        up               :{                   encode:function(x){ return json4all.toUrl(x); }, decode:function(x){ return json4all.parse(x)}  },
                    Severity: Major
                    Found in unlogged/my-ajax.js and 5 other locations - About 45 mins to fix
                    unlogged/my-ajax.js on lines 608..608
                    unlogged/my-ajax.js on lines 609..609
                    unlogged/my-ajax.js on lines 611..611
                    unlogged/my-ajax.js on lines 612..612
                    unlogged/my-ajax.js on lines 622..622

                    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

                    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(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(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
                          Severity
                          Category
                          Status
                          Source
                          Language