codenautas/backend-plus

View on GitHub

Showing 408 of 408 total issues

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

module.exports = function(context){
    var admin=context.user.rol==='boss';
    return context.be.tableDefAdapt({
        name:'ptable',
        title:'periodic table',
Severity: Minor
Found in examples/tables/server/table-ptable.js - About 1 hr to fix

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

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

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

                      if(!rows.length){
                          grid.dom.caption.textContent=my.messages.thereAreNot+': '+grid.dom.caption.textContent;
                          grid.dom.table.setAttribute('error-list','no-errors');
                      }else{
                          grid.dom.table.setAttribute('error-list','have-errors');
      Severity: Major
      Found in for-client/my-tables.js and 1 other location - About 1 hr to fix
      for-client/my-tables.js on lines 1953..1959

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

      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

              depot.my.ajax.table_record_delete({
                  table:depot.def.name, 
                  primaryKeyValues:depot.primaryKeyValues,
                  launcher:opts.launcher
              }).then(function(){
      Severity: Major
      Found in for-client/my-tables.js and 1 other location - About 1 hr to fix
      for-client/my-tables.js on lines 532..537

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

      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

                  if(!grid.depotsToDisplay.length){
                      grid.dom.caption.textContent=my.messages.thereAreNot+': '+grid.dom.caption.textContent;
                      grid.dom.table.setAttribute('error-list','no-errors');
                  }else{
                      grid.dom.table.setAttribute('error-list','have-errors');
      Severity: Major
      Found in for-client/my-tables.js and 1 other location - About 1 hr to fix
      for-client/my-tables.js on lines 819..825

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

      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

              db[depot.def.name].delete(depot.primaryKeyValues).then(function(){
                  depot._isDeleted=true;
                  depot.tr.dispatchEvent(new CustomEvent('deletedRowOk'));
                  var grid=depot.manager;
                  grid.dom.main.dispatchEvent(new CustomEvent('deletedRowOk'));
      Severity: Major
      Found in for-client/my-tables.js and 1 other location - About 1 hr to fix
      for-client/my-tables.js on lines 390..399

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

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

      module.exports = function(context){
          var allow = function(roles){
              return {
                  select:!!roles[context.user.rol],
                  insert:context.user.rol==='admin',
      Severity: Minor
      Found in examples/fichero/server/table-fichas.js - About 1 hr to fix

        Function readStructure has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            readStructure(fileName){
                var be = this;
                be.almacenVacio={
                    formularios:{}
                };
        Severity: Minor
        Found in ejemplos/encuesta.js - About 1 hr to fix

          Function generateSqlForTableDef has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private generateSqlForTableDef(tableDef:TableDefinition):string{
                  var typeDb={
                      integer: 'integer',
                      number: 'real',
                      date: 'text',
          Severity: Minor
          Found in src/for-client/my-websqldb.ts - About 1 hr to fix

            Function displayMenu has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            myOwn.displayMenu = function displayMenu(layout, menu, addrParams, parents){
                var my = this;
                var selectedItem = null;
                var elements=[];
                var depth = parents.length;
            Severity: Minor
            Found in for-client/my-menu.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 captureKeys has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            myOwn.TableGrid.prototype.captureKeys = function captureKeys() {
                document.addEventListener('keypress', function(evento){
                    return;
                    if(evento.which==13){ // Enter
                        var enfoco=this.activeElement;
            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 putOneAndGetIfNeeded has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                private async putOneAndGetIfNeeded<T extends Record>(tableName:string, element:T, needed:boolean):Promise<T|void>{
                    var ldb=this;
                    var db=await ldb.wait4db
                    var tableDef=await ldb.getStructure(tableName);
                    var createPromiseForFK = function createPromiseForFK(fk:ForeignKey){
            Severity: Minor
            Found in src/for-client/my-localdb.ts - 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 putOne has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                async putOne<T>(tableName:string, element:T):Promise<T>{
                    var ldb = this;
                    var createPromiseForFK = function createPromiseForFK(fk:ForeignKey){
                        return Promise.resolve().then(async function(){
                            var fkTableDef=await ldb.getStructure(fk.references);
            Severity: Minor
            Found in src/for-client/my-websqldb.ts - 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 autoSetupMyThings has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function autoSetupMyThings(){
                    var my = this;
                    if(!('server' in my)){
                        my.server = {connected: null, broadcaster:html.div({id:'server-status-broadcaster'}).create()}
                    }
            Severity: Minor
            Found in for-client/my-things.js - About 1 hr to fix

              Function getStructure has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              myOwn.TableConnector.prototype.getStructure = function getStructure(opts){
                  var opts = changing({
                      registerInLocalDB: false, 
                      waitForFreshStructure: false 
                  }, opts || {});
              Severity: Minor
              Found in for-client/my-tables.js - About 1 hr to fix

                Function populateTableXLS has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        var populateTableXLS = function populateTableXLS(ws, depots, fieldDefs, topRow, leftColumn){
                            topRow=topRow||0;
                            leftColumn=leftColumn||0;
                            fieldDefs.forEach(function(field,iColumn){
                                ws[XLSX.utils.encode_cell({c:iColumn+leftColumn,r:topRow})]={t:'s',v:field.name, s:STYLE_HEADER};
                Severity: Minor
                Found in for-client/my-tables.js - About 1 hr to fix

                  Function getData has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  myOwn.TableConnectorLocal.prototype.getData = function getData(){
                      var connector = this;
                      if(((connector.opts||{}).tableDef||{}).forInsertOnlyMode){
                          return Promise.resolve([]);
                      }
                  Severity: Minor
                  Found in for-client/my-tables.js - About 1 hr to fix

                    Function displayAsDeleted has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    myOwn.TableGrid.prototype.displayAsDeleted = function displayAsDeleted(depot, mode){
                        var grid = this;
                        var fast = mode == 'change-ff'
                        if (mode == 'unknown' && myOwn.config.config['grid-row-retain-moved-or-deleted']) {
                            depot.tr.setAttribute('not-here', 'yes'); 
                    Severity: Minor
                    Found in for-client/my-tables.js - About 1 hr to fix

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

                      myOwn.DataColumnGrid.prototype.thFilter = function thFilter(depot, iColumn){
                          var grid = this.grid;
                          var fieldDef = this.fieldDef;
                          var fieldName=fieldDef.name;
                          depot.rowSymbols[fieldDef.name]=depot.rowSymbols[fieldDef.name]||'~';
                      Severity: Minor
                      Found in for-client/my-tables.js - About 1 hr to fix

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

                        myOwn.informDetectedStatus = function informDetectedStatus(statusCode, logged) {
                            var my=this;
                            if(my.debuggingStatus){ my.debuggingStatus(statusCode); }
                            if(my.previousStatusCode!=statusCode){
                                // var previousStatus = my["connection-status"][my.previousStatusCode];
                        Severity: Minor
                        Found in for-client/my-inform-net-status.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language