e-ucm/rage-analytics-backend

View on GitHub
test/upgraderTests/elastic/elasticTransformerTo2.js

Summary

Maintainability
F
4 days
Test Coverage

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

module.exports = function (app, esClient, mongo) {

    /**-------------------------------------------------------------**/
    /**-------------------------------------------------------------**/
    /**              Test Elastic Transformer To v2                 **/
Severity: Major
Found in test/upgraderTests/elastic/elasticTransformerTo2.js - About 1 day to fix

    File elasticTransformerTo2.js has 310 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * Copyright 2016 e-UCM (http://www.e-ucm.es/)
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
    Severity: Minor
    Found in test/upgraderTests/elastic/elasticTransformerTo2.js - About 3 hrs to fix

      Function generateTracesAndBulk has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function generateTracesAndBulk(num, nTraces, index, sameIndex, callback) {
              var times = [];
              var count = 0;
              for (var t = 0; t < num; t++) {
                  times.push(t);
      Severity: Major
      Found in test/upgraderTests/elastic/elasticTransformerTo2.js - About 2 hrs to fix

        Function compareFunction has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function compareFunction(fileIn, fileOut, idSession, searchObj, callback) {
                var bodyOut = require(fileOut);
        
                setTimeout(function () {
                    app.esClient.search(searchObj, function (err, response) {
        Severity: Minor
        Found in test/upgraderTests/elastic/elasticTransformerTo2.js - About 1 hr to fix

          Function generateTracesAndBulk has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              function generateTracesAndBulk(num, nTraces, index, sameIndex, callback) {
          Severity: Minor
          Found in test/upgraderTests/elastic/elasticTransformerTo2.js - About 35 mins to fix

            Function bulkFunction has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                function bulkFunction(fileIn, fileOut, index, searchObj, callback) {
            Severity: Minor
            Found in test/upgraderTests/elastic/elasticTransformerTo2.js - About 35 mins to fix

              Function compareFunction has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  function compareFunction(fileIn, fileOut, idSession, searchObj, callback) {
              Severity: Minor
              Found in test/upgraderTests/elastic/elasticTransformerTo2.js - About 35 mins to fix

                Function transformFunction has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    function transformFunction(fileIn, fileOut, idSession, searchObj, callback) {
                Severity: Minor
                Found in test/upgraderTests/elastic/elasticTransformerTo2.js - About 35 mins to fix

                  Function checkEmptyDB has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      function checkEmptyDB(fileIn, fileOut, idSession, searchObj, callback) {
                  Severity: Minor
                  Found in test/upgraderTests/elastic/elasticTransformerTo2.js - About 35 mins to fix

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

                            it('should transform correctly .kibana index', function (done) {
                                var fileIn = './upgradeInputs/kibanaIndexTo2IN.js';
                                var fileOut = './upgradeOutputs/kibanaIndexTo2OUT.js';
                                var searchObj = {
                                    index: '.kibana'
                    Severity: Major
                    Found in test/upgraderTests/elastic/elasticTransformerTo2.js and 2 other locations - About 3 hrs to fix
                    test/upgraderTests/elastic/elasticTransformerTo2.js on lines 101..120
                    test/upgraderTests/elastic/elasticTransformerTo2.js on lines 122..141

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

                    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

                            it('should transform correctly .game indices', function (done) {
                                var fileIn = './upgradeInputs/gameIndexTo2IN.js';
                                var fileOut = './upgradeOutputs/gameIndexTo2OUT.js';
                                var searchObj = {
                                    index: '.games1234'
                    Severity: Major
                    Found in test/upgraderTests/elastic/elasticTransformerTo2.js and 2 other locations - About 3 hrs to fix
                    test/upgraderTests/elastic/elasticTransformerTo2.js on lines 80..99
                    test/upgraderTests/elastic/elasticTransformerTo2.js on lines 122..141

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

                    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

                            it('should transform correctly .template index', function (done) {
                                var fileIn = './upgradeInputs/templateIndexTo2IN.js';
                                var fileOut = './upgradeOutputs/templateIndexTo2OUT.js';
                                var searchObj = {
                                    index: '.template'
                    Severity: Major
                    Found in test/upgraderTests/elastic/elasticTransformerTo2.js and 2 other locations - About 3 hrs to fix
                    test/upgraderTests/elastic/elasticTransformerTo2.js on lines 80..99
                    test/upgraderTests/elastic/elasticTransformerTo2.js on lines 101..120

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

                    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

                            bodyIn.forEach(function (doc) {
                                // Action description
                                bulkBody.body.push({
                                    index: {
                                        _index: index ? index : doc.index,
                    Severity: Major
                    Found in test/upgraderTests/elastic/elasticTransformerTo2.js and 1 other location - About 3 hrs to fix
                    test/upgraderTests/elastic/elasticController.js on lines 175..184

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

                    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

                            it('should transform correctly all indices', function (done) {
                                async.waterfall([function (callback) {
                                    callback(null, 20, 400, idSession.toString(), false);
                                },
                                    generateTracesAndBulk,
                    Severity: Major
                    Found in test/upgraderTests/elastic/elasticTransformerTo2.js and 1 other location - About 2 hrs to fix
                    test/upgraderTests/elastic/elasticTransformerTo2.js on lines 185..197

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

                    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

                            it('should transform correctly all traces extensions', function (done) {
                                async.waterfall([function (callback) {
                                    callback(null, 10, 500, idSession.toString(), true);
                                },
                                    generateTracesAndBulk,
                    Severity: Major
                    Found in test/upgraderTests/elastic/elasticTransformerTo2.js and 1 other location - About 2 hrs to fix
                    test/upgraderTests/elastic/elasticTransformerTo2.js on lines 199..211

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

                    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

                    There are no issues that match your filters.

                    Category
                    Status