codenautas/backend-plus

View on GitHub

Showing 408 of 408 total issues

Function MemoryPerodicallySaved has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function MemoryPerodicallySaved(session){
    var MemoryStoreConstructor = memorystore(session);
    class MemoryDevelConstructor extends MemoryStoreConstructor{
        /**
         * @param {memorystore.MemoryConsOpts} opts
Severity: Major
Found in lib/backend-plus.js - About 2 hrs to fix

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

    myOwn.TableAggregates.min.prototype.acum=function acum(value){
        if(value!=null){
            if(this.value==null || this.value>value){
                this.value = value;
            }
    Severity: Major
    Found in for-client/my-tables.js and 1 other location - About 2 hrs to fix
    for-client/my-tables.js on lines 1909..1915

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

    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

    myOwn.TableAggregates.max.prototype.acum=function acum(value){
        if(value!=null){
            if(this.value==null || this.value<value){
                this.value = value;
            }
    Severity: Major
    Found in for-client/my-tables.js and 1 other location - About 2 hrs to fix
    for-client/my-tables.js on lines 1897..1903

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

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

            grid.displayRows = function displayRows(fromRowNumber, toRowNumber, adding){
                var grid = this;
                if(!adding){
                    if(grid.vertical){
                        // recorrer todos los tr del tbody y dejar solo las primeras columnas?
    Severity: Major
    Found in for-client/my-tables.js - About 2 hrs to fix

      Function clientIncludes has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      AppBackend.prototype.clientIncludes = function clientIncludes(req, opts) {
          const hideBEPlusInclusions = opts === true || opts && typeof opts == "object" && opts.hideBEPlusInclusions;
          opts = opts === true ? {} : opts || {}; 
          var list = [];
          if (!hideBEPlusInclusions) {
      Severity: Major
      Found in lib/backend-plus.js - About 2 hrs to fix

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

            resultTableDef.softForeignKeys.map(function(sfk){
                sfk.fields.forEach(function(pair, i, pairs){
                    if(typeof pair === "string"){
                        pairs[i] = {source: pair, target: pair};
                    }
        Severity: Major
        Found in lib/table-def-adapt.js and 1 other location - About 2 hrs to fix
        lib/table-def-adapt.js on lines 149..155

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

        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

            resultTableDef.foreignKeys.map(function(fk){
                fk.fields.forEach(function(pair, i, pairs){
                    if(typeof pair === "string"){
                        pairs[i] = {source: pair, target: pair};
                    }
        Severity: Major
        Found in lib/table-def-adapt.js and 1 other location - About 2 hrs to fix
        lib/table-def-adapt.js on lines 156..162

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

        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 getReference has 54 lines of code (exceeds 25 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: Major
        Found in for-client/my-tables.js - About 2 hrs to fix

          Function presentarAlmacen has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function presentarAlmacen(result, formAMostrar, ordenAMostrar){
              formAMostrar = formAMostrar || result.estructura['con-for'][result.id["tipo-abonado"]]["formulario-principal"];
              ordenAMostrar = ordenAMostrar || 0;
              dropAllChilds(menu_bar);
              var botonera=[];
          Severity: Major
          Found in ejemplos/client/continuar.js - About 2 hrs to fix

            Function constructor has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    constructor(opts){
                        super(opts);
                        var store=this;
                        var fileName='sessions/local-sessions.dump';
                        Promise.resolve().then(function(){
            Severity: Major
            Found in lib/backend-plus.js - About 2 hrs to fix

              Function processBitacora has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                              var processBitacora = async function(hasError, status){
                                  var params = getParams();
                                  var defInsertBitacoraElement = {
                                      procedure_name : procedureDef.action,
                                      parameters: JSON.stringify(params),
              Severity: Major
              Found in lib/backend-plus.js - About 2 hrs to fix

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

                                    be.config.login.plus.newPassPageServe=function(req,res,next){
                                        return MiniTools.serveJade(loginFile.replace(/\blogin\b/,'new-password'),be.optsGenericForFiles(req,{withFlash:true}).jade)(req,res,next);
                                    };
                Severity: Major
                Found in lib/backend-plus.js and 1 other location - About 2 hrs to fix
                lib/backend-plus.js on lines 883..885

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

                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.config.login.plus.newPassPageServe2=function(req,res,next){
                                        return MiniTools.serveJade(loginFile.replace(/\blogin\b/,'new-password-result'),be.optsGenericForFiles(req,{withFlash:true}).jade)(req,res,next);
                                    };
                Severity: Major
                Found in lib/backend-plus.js and 1 other location - About 2 hrs to fix
                lib/backend-plus.js on lines 880..882

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

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

                myOwn.wScreens.table = function(addrParams){
                    setTimeout(function(){
                        var layout = document.getElementById('main_layout');
                        var opts={tableDef: addrParams.td ?? {}};
                        if(addrParams.ff){
                Severity: Minor
                Found in for-client/my-menu.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 start has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                AppBackend.prototype.start = function start(opts){
                    var be = this;
                    this.getTables().forEach(
                        // TODO: quitar, no debería hacer falta poner esto acá
                        /**
                Severity: Minor
                Found in lib/backend-plus.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 coreFunction has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                        coreFunction:async function(context, parameters){
                            context.informProgress({message:"start"});
                            var {be,client} = context;
                            if (!be.can(context,'DownloadBackup')) {
                                throw new Error('Forbiden backup')
                Severity: Minor
                Found in lib/procedures-table.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 clientIncludes has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                AppBackend.prototype.clientIncludes = function clientIncludes(req, opts) {
                    const hideBEPlusInclusions = opts === true || opts && typeof opts == "object" && opts.hideBEPlusInclusions;
                    opts = opts === true ? {} : opts || {}; 
                    var list = [];
                    if (!hideBEPlusInclusions) {
                Severity: Minor
                Found in lib/backend-plus.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 configStaticConfig has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    configStaticConfig(){
                        super.configStaticConfig();
                        this.setStaticConfig(`
                          server:
                            port: 3033
                Severity: Major
                Found in examples/tables/server/server-tables.js - About 2 hrs to fix

                  Function createRowInsertElements has 52 lines of code (exceeds 25 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: Major
                  Found in for-client/my-tables.js - About 2 hrs to fix

                    Function putOneAndGetIfNeeded has 52 lines of code (exceeds 25 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: Major
                    Found in src/for-client/my-localdb.ts - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language