codenautas/backend-plus

View on GitHub

Showing 408 of 408 total issues

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

    var allow = function(roles){
        return {
            select:!!roles[context.user.rol],
            insert:context.user.rol==='admin',
            update:context.user.rol==='admin',
Severity: Major
Found in examples/fichero/server/table-fichas.js and 1 other location - About 2 hrs to fix
examples/fichero/server/table-autores.js on lines 4..11

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

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

myOwn.showPage = function showPage(pageDef){
    my.prepareFloating3dots();
    var newHash;
    if(!location.hash){
        newHash=sessionStorage.getItem('backend-plus-hash-redirect');
Severity: Major
Found in for-client/my-menu.js - About 2 hrs to fix

    Function depotRefresh has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        grid.depotRefresh = function depotRefresh(depot,result,opts){
            // ¡ATENCIÓN!: esta función no debe despleegar, llama a updateRowData, ahí se despliega
            opts=opts||{};
            upadteNumberOfRows(depot,grid);
            var retrievedRow = result.updatedRow;
    Severity: Major
    Found in for-client/my-tables.js - About 2 hrs to fix

      Consider simplifying this complex logical expression.
      Open

          if(resultTableDef.sql.policies.enabled==null){
              var pol = resultTableDef.sql.policies;
              pol.enabled = (
                  pol.all.using || pol.select.using || pol.insert.using || pol.update.using || pol.delete.using ||
                  pol.all.check || pol.select.check || pol.insert.check || pol.update.check || pol.delete.check ||
      Severity: Critical
      Found in lib/table-def-adapt.js - About 2 hrs to fix

        Function createRowElements has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            grid.createRowElements = function createRowElements(iRow, depot){
                var grid = this;
                var forInsert = iRow>=0;
                var tr={};
                depot.colNumber = null;
        Severity: Major
        Found in for-client/my-tables.js - About 2 hrs to fix

          Function presentarPlaca has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function presentarPlaca(estado) {
              agregaLogoAlElemento(pantalla);
              var textoComienzaEncuesta=estado.estructura.textos.placas['bienvenido-'+estado.estado];
              var encabezado=textoComienzaEncuesta.encabezado;
              var parrafos=textoComienzaEncuesta.parrafos;
          Severity: Major
          Found in ejemplos/client/index.js - About 2 hrs to fix

            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

                    fields:[
                        {name:'table_name'        , typeName:'text'      },
                        {name:'pk_values'         , typeName:'text'      },
                        {name:'username'          , typeName:'text'      },
                        {name:'machineId'         , typeName:'text'      },
            Severity: Major
            Found in examples/tables/server/table-cursors.js and 1 other location - About 2 hrs to fix
            lib/backend-plus.js on lines 2076..2084

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

                    buttonCreateFilter=html.button({class:'table-button', 'when-filter':'no', "skip-enter":true}, [
                        html.img({
                            src:my.path.img+'filter.png',
                            alt:'FILTER',
                            title:my.messages.filter
            Severity: Major
            Found in for-client/my-tables.js and 2 other locations - About 2 hrs to fix
            for-client/my-tables.js on lines 2017..2023
            for-client/my-tables.js on lines 2027..2033

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

            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

                    buttonCreateFilterAdd=html.button({class:'table-button', 'when-filter':'yes', "skip-enter":true}, [
                        html.img({
                            src:my.path.img+'filter-line-add.png',
                            alt:'FIL',
                            title:my.messages.filterAdd
            Severity: Major
            Found in for-client/my-tables.js and 2 other locations - About 2 hrs to fix
            for-client/my-tables.js on lines 2007..2013
            for-client/my-tables.js on lines 2027..2033

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

            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

            WebsqlDb has 23 functions (exceeds 20 allowed). Consider refactoring.
            Open

            export class WebsqlDb{
                private db:Database;
                private wait4detectedFeatures:Promise<DetectFeatures>;
                constructor(public name:string){
                    var version = 1.0;
            Severity: Minor
            Found in src/for-client/my-websqldb.ts - About 2 hrs to fix

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

                      buttonDestroyFilter=html.button({class:'table-button', 'when-filter':'yes', "skip-enter":true}, [
                          html.img({
                              src:my.path.img+'destroy-filter.png',
                              alt:'FILTER OFF',
                              title:my.messages.filterOff
              Severity: Major
              Found in for-client/my-tables.js and 2 other locations - About 2 hrs to fix
              for-client/my-tables.js on lines 2007..2013
              for-client/my-tables.js on lines 2017..2023

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

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

                      coreFunction:async function(context, parameters){
                          var be=context.be;
                          var db=be.db;
                          var tableDef=be.tableStructures[parameters.table](context);
                          var tableDefArray = [tableDef].concat(tableDef.offline.details.map(name=>be.tableStructures[name](context)));
              Severity: Major
              Found in lib/procedures-table.js - About 2 hrs to fix

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

                  function agregar_json(div, o, ubicaciones=agregar_json_default_ubicaciones){
                      if(o == null){
                          return ;
                      }
                      if(typeof o == "object" && !(o instanceof Date) && !o.isRealDateTime){
                  Severity: Major
                  Found in unlogged/my-ajax.js - About 2 hrs to fix

                    Function prepareGrid has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                    myOwn.TableGrid.prototype.prepareGrid = function prepareGrid(){
                        var grid = this;
                        var my = grid.my;
                        grid.view.hiddenColumns=grid.view.hiddenColumns||grid.def.hiddenColumns||[];
                        grid.def.fields.forEach(function(fieldDef){
                    Severity: Minor
                    Found in for-client/my-tables.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 createRowInsertElements has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                    myOwn.TableGrid.prototype.createRowInsertElements = function createRowInsertElements(aboveDepot, belowDepot){
                        var grid = this;
                        if(!belowDepot){
                            if(aboveDepot){
                                if(belowDepot=aboveDepot.tr.previousSibling){
                    Severity: Minor
                    Found in for-client/my-tables.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 dialogUpload has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                    myOwn.dialogUpload = function dialogUpload(ajaxPath, ajaxParams, ajaxPrepareResultFun, showWithMiniMenu, messages, refresheable, acceptPhotos, optsNames){
                        messages = changing(my.messages, messages||{})
                        optsNames = optsNames || [];
                        var doneFun = function doneFun(){
                            var fileAttr={class:'import-button',type:'file',style:'min-width:400px'};
                    Severity: Minor
                    Found in for-client/my-tables.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

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

                                    "DELETE FROM "+be.db.quoteIdent(defTable.sql.tableName)+
                                    " WHERE "+fieldNames.map(function(name,i){
                                        return be.db.quoteIdent(name)+' = $'+(i+1)}).join( ' AND '),values
                    Severity: Major
                    Found in lib/procedures-table.js and 1 other location - About 2 hrs to fix
                    lib/procedures-table.js on lines 360..361

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

                    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

                                                "UPDATE "+be.db.quoteIdent(defTable.sql.tableName)+
                                                " SET "+fieldNames4Update.map(function(name,i){ return be.db.quoteIdent(name)+" = $"+(i+1); }).join(', ')+
                    Severity: Major
                    Found in lib/procedures-table.js and 1 other location - About 2 hrs to fix
                    lib/procedures-table.js on lines 659..661

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

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language