codenautas/backend-plus

View on GitHub

Showing 408 of 408 total issues

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

myOwn.insertRow = function insertRow(where){
    var my = this;
    var section, iRow, newTr;
    if(where.under){
        section = where.under.parentNode;
Severity: Minor
Found in for-client/my-things.js - About 1 hr to fix

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

    myOwn.fade = function fade(element, options){
        options=options||{};
        if (!element.parentNode) return
        if(element.tagName.toUpperCase()==='TR' && element.parentNode.replaceChild && !options.fast){
            var parent=element.parentNode;
    Severity: Minor
    Found in for-client/my-things.js - About 1 hr to fix

      Function coreFunction has 40 lines of code (exceeds 25 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 1 hr to fix

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

            lines.push("grant connect, temporary on database "+db.quoteIdent(be.config.db.database)+" to "+db.quoteIdent(be.config.db.user)+";");
        Severity: Major
        Found in lib/backend-plus.js and 1 other location - About 1 hr to fix
        lib/backend-plus.js on lines 2585..2585

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

        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

            getProcedures(){
                var be = this;
                return super.getProcedures().then(function(procedures){
                    return procedures.concat(
                        require('./procedures-examples.js').map(be.procedureDefCompleter, be)
        Severity: Major
        Found in examples/tables/server/server-tables.js and 1 other location - About 1 hr to fix
        examples/4test/server/app-4test.js on lines 27..34

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

        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

            getProcedures(){
                var be = this;
                return super.getProcedures().then(function(procedures){
                    return procedures.concat(
                        require('./procedures-4test.js').map(be.procedureDefCompleter, be)
        Severity: Major
        Found in examples/4test/server/app-4test.js and 1 other location - About 1 hr to fix
        examples/tables/server/server-tables.js on lines 78..85

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

        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

            lines.push("create user "+db.quoteIdent(be.config.db.user)+" password "+db.quoteLiteral(be.config.db.password)+";");
        Severity: Major
        Found in lib/backend-plus.js and 1 other location - About 1 hr to fix
        lib/backend-plus.js on lines 2589..2589

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

        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 td has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        myOwn.DataColumnGrid.prototype.td = function td(depot, iColumn, tr, saveRow){
            var grid = this.grid;
            var fieldDef = this.fieldDef;
            var forInsert = false; // TODO: Verificar que esto está en desuso
            var enabledInput=depot.allow.update !== false && grid.def.allow.update /* && !grid.connector.fixedField[fieldDef.name] */ && (forInsert?fieldDef.allow.insert:fieldDef.allow.update);
        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 cellAttributes has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        myOwn.DataColumnGrid.prototype.cellAttributes = function cellAttributes(specificAttributes,opts){
            var fieldDef = this.fieldDef;
            var grid=this.grid;
            var opts=opts||{};
            var attr=changing({"my-colname":fieldDef.name},specificAttributes);
        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 createForkeableButton has a Cognitive Complexity of 13 (exceeds 5 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

        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 transformInput has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        AppBackend.prototype.transformInput = function transformInput(fieldDef, value){
            var be = this;
            if(fieldDef.typeName == 'text'){
                var idTransformer = fieldDef.transformer ?? be.config.data.transformers.text;
                var parameters = be.inputTransformers[idTransformer] ?? idTransformer ?? {}
        Severity: Minor
        Found in lib/backend-plus.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 addUnloggedServices has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        AppBackend.prototype.addUnloggedServices = function addUnloggedServices(mainApp, baseUrl){
            var be=this;
            if(be.config.login.forget?.urlPath){
                mainApp.get(Path.posix.join(baseUrl,be.config.login.forget.urlPath), be.config.login.plus.newPassPageServe)
                mainApp.get(Path.posix.join(baseUrl,be.config.login.forget.urlPathOk), be.config.login.plus.newPassPageServe2)
        Severity: Minor
        Found in lib/backend-plus.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 inTransaction has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            async inTransaction<T>(callback:(ldb:LocalDb)=>Promise<T>):Promise<T>{
                var name=this.localDbName;
                this.oneByOneChain = this.oneByOneChain.then(async function(){
                    var ldb = new LocalDb(name);
                    async function closeLdb(err:Error):Promise<never>;
        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 validateBitacora has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        AppBackend.prototype.validateBitacora = function validateBitacora(procedureDef){
            var be = this;
            if(procedureDef.bitacora.targetTable in be.tableStructures){
                var contextForDump=be.getContextForDump();
                var tableDefFields = be.tableStructures[procedureDef.bitacora.targetTable](contextForDump).fields;
        Severity: Minor
        Found in lib/backend-plus.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 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                prepare:function(depot, fieldName){
                    depot.rowControls[fieldName].addEventListener('update',function(){
                        var control = this;
                        var valor = control.getTypedValue();
                        if((valor=='B' || valor=='🔑') && "no estaba lockeado"){
        Severity: Minor
        Found in for-client/my-tables.js - About 1 hr to fix

          Function createRowFilter has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              grid.createRowFilter = function createRowFilter(otherRow, filterColumns){
                  var grid = this;
                  if(!otherRow && grid.hasFilterRow){
                      // return true;
                  }
          Severity: Minor
          Found in for-client/my-tables.js - About 1 hr to fix

            Function getStructuresToRegisterInLdb has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            myOwn.getStructuresToRegisterInLdb = function getStructuresToRegisterInLdb(parentTableDef, structuresArray){
                var promiseChain = Promise.resolve();
                structuresArray.push(parentTableDef);
                if(parentTableDef.offline.mode==='master'){
                    parentTableDef.offline.details.forEach(function(tableName){
            Severity: Minor
            Found in for-client/my-tables.js - About 1 hr to fix

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

                                  return be.db.quoteIdent(resultTableDef.alias)+'.'+be.db.quoteIdent(pair.source)
                                      + ' = ' + be.db.quoteIdent(fkDef.alias)+'.'+be.db.quoteIdent(pair.target);
              Severity: Major
              Found in lib/table-def-adapt.js and 1 other location - About 1 hr to fix
              lib/table-def-adapt.js on lines 350..350

              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

                                  be.db.quoteIdent(fieldDef.referencedAlias)+"."+be.db.quoteIdent(fieldDef.referencedName)+" as "+be.db.quoteIdent(fieldDef.name)
              Severity: Major
              Found in lib/table-def-adapt.js and 1 other location - About 1 hr to fix
              lib/table-def-adapt.js on lines 267..268

              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

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

              Severity
              Category
              Status
              Source
              Language