codenautas/backend-plus

View on GitHub

Showing 408 of 408 total issues

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

    encIniciar.addEventListener('click',function(){
        postAction('blanquear', {id:estado.id,estado:'vacio'}).then(function(res) {
           window.location = 'continuar';
       });
    })
Severity: Major
Found in ejemplos/client/index.js and 2 other locations - About 1 hr to fix
ejemplos/client/index.js on lines 48..52
ejemplos/client/index.js on lines 53..57

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

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

    encContinuar.addEventListener('click', function() {
       postAction('set-status', {id:estado.id,estado:'pendiente'}).then(function(res) {
           window.location = 'continuar';
       });
    });
Severity: Major
Found in ejemplos/client/index.js and 2 other locations - About 1 hr to fix
ejemplos/client/index.js on lines 53..57
ejemplos/client/index.js on lines 67..71

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

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

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 64.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

myOwn.createSmartButton = function createSmartButton(opts){
    var button=opts.button || html.button(opts.buttonProperties||{}, opts.buttonContent||opts.buttonLabel).create();
    Object.defineProperty(button, 'smartState', {
        get:function(){ return this.getAttribute('smart-button'); },
        set:function(value){ 
Severity: Minor
Found in for-client/my-things.js - About 1 hr to fix

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

            var excelExport = function(){
                var wb = XLSX.utils.book_new();
                var ws = {};
                var exportFileInformationWs={};
                var i=0;
    Severity: Minor
    Found in for-client/my-tables.js - About 1 hr to fix

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

      myOwn.log = function log(severity, message){
          var my=this;
          var consoleMessage;
          var clientMessage;
          if(!message){
      Severity: Minor
      Found in for-client/my-things.js - About 1 hr to fix

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

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

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

              private async registerStructureInside(tableDef:TableDefinition, wait4db:Promise<IDBDatabase>):Promise<{
                  wait4db:Promise<IDBDatabase>,
                  result:RegisterResult
              }>{
                  var ldb=this;
          Severity: Minor
          Found in src/for-client/my-localdb.ts - About 1 hr to fix

            Function getReference has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            myOwn.getReference = function getReference(referenceName, opts){
                opts = changing({
                    getValue: function getValue(row){
                        return row[reference.tableDef.primaryKey[reference.tableDef.primaryKey.length-1]];
                    },
            Severity: Minor
            Found in for-client/my-tables.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 prepare has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    var prepare=function(){
                        mainDiv.setAttribute("current-state", "preparing");
                        setTimeout(function(){
                            fieldsDef2Export=grid.def.fields.filter(function(fieldDef){ 
                                return (fieldDef.inTable!==false || input.fromOtherTables.checked) 
            Severity: Minor
            Found in for-client/my-tables.js - About 1 hr to fix

              Function createForkeableButton has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              myOwn.createForkeableButton = function createForkeableButton(menu, opts){
                  var my = this;
                  if(typeof opts==="string" || opts==null){
                      opts = {label:opts};
                  }
              Severity: Minor
              Found in for-client/my-menu.js - About 1 hr to fix

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

                function linkButtons(selector, f){
                    var buttons = document.querySelectorAll(selector);
                    Array.prototype.forEach.call(buttons, function(button){
                        button.addEventListener('click', f);
                    });
                Severity: Major
                Found in examples/fichero/client/index.js and 1 other location - About 1 hr to fix
                examples/fichero/client/admin.js on lines 8..13

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

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                function linkButtons(selector, f){
                    var buttons = document.querySelectorAll(selector);
                    Array.prototype.forEach.call(buttons, function(button){
                        button.addEventListener('click', f);
                    });
                Severity: Major
                Found in examples/fichero/client/admin.js and 1 other location - About 1 hr to fix
                examples/fichero/client/index.js on lines 8..13

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

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Function exports has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = function(context){
                    return context.be.tableDefAdapt({
                        name:'isotopes',
                        title:'stable isotopes',
                        allow:{
                Severity: Minor
                Found in examples/tables/server/table-isotopes.js - About 1 hr to fix

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  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 and 1 other location - About 1 hr to fix
                  for-client/my-things.js on lines 686..699

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

                  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((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 and 1 other location - About 1 hr to fix
                  for-client/my-things.js on lines 683..685

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

                  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

                  Consider simplifying this complex logical expression.
                  Open

                              if(depot.status==='new'){
                                  var specialMandatories=grid.def.specialValidator?myOwn.validators[grid.def.specialValidator].getMandatoryMap(depot.row):{};
                                  var mandatoryOmitted=function(fieldDef){
                                      return (specialMandatories[fieldDef.name] || fieldDef.nullable!==true && fieldDef.isPk || fieldDef.nullable===false) 
                                          && depot.row[fieldDef.name]==null 
                  Severity: Critical
                  Found in for-client/my-tables.js - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

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

                      Consider simplifying this complex logical expression.
                      Open

                              if(evento.which==115 && !evento.shiftKey  && !evento.ctrlKey  && !evento.altKey  && !evento.metaKey){ // F4
                                  /** @type {HTMLElement} */
                                  var activeElement = this.activeElement && this.activeElement.tagName!='BODY' && this.activeElement || document.mayBeRepetibleButton; 
                                  var info=tableInfo(activeElement);
                                  if(info.table){
                      Severity: Critical
                      Found in for-client/my-things.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
                          Severity
                          Category
                          Status
                          Source
                          Language