e-ucm/rage-analytics-backend

View on GitHub
bin/upgrade/transformers/elastic/transformToVersion2.js

Summary

Maintainability
F
1 wk
Test Coverage

File transformToVersion2.js has 905 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: Major
Found in bin/upgrade/transformers/elastic/transformToVersion2.js - About 2 days to fix

    Function identifyExtensionsFromIndex has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

    function* identifyExtensionsFromIndex(esClient, index) {
    
        let oldMapping = yield at(esClient.indices.getMapping({index: index.index}));
        let upgradeIndex = 'upgrade_' + index.index;
        let mapping = {};
    Severity: Minor
    Found in bin/upgrade/transformers/elastic/transformToVersion2.js - About 4 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 identifyExtensionsFromIndex has 77 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function* identifyExtensionsFromIndex(esClient, index) {
    
        let oldMapping = yield at(esClient.indices.getMapping({index: index.index}));
        let upgradeIndex = 'upgrade_' + index.index;
        let mapping = {};
    Severity: Major
    Found in bin/upgrade/transformers/elastic/transformToVersion2.js - About 3 hrs to fix

      Function upgradeGameIndex has 76 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function* upgradeGameIndex(esClient, gameIndex) {
      
          let totalSessionsVis = yield at(esClient.get({
              index: gameIndex.index,
              type: 'visualization',
      Severity: Major
      Found in bin/upgrade/transformers/elastic/transformToVersion2.js - About 3 hrs to fix

        Function check has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function check(config, callback) {
            co(function* () {
        
                    let esClient = config.elasticsearch.esClient;
                    yield at(esClient.indices.refresh({index: '_all'}));
        Severity: Major
        Found in bin/upgrade/transformers/elastic/transformToVersion2.js - About 2 hrs to fix

          Function backup has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function backup(config, callback) {
          
              co(function* () {
                  let esClient = config.elasticsearch.esClient;
                  yield at(esClient.ping({requestTimeout: 2000}));
          Severity: Major
          Found in bin/upgrade/transformers/elastic/transformToVersion2.js - About 2 hrs to fix

            Function checkNeedsUpdateVisualization has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            function checkNeedsUpdateVisualization(visualization) {
            
                let visState = JSON.parse(visualization._source.visState.replaceAll('\\\"', '"'));
            
                /*
            Severity: Minor
            Found in bin/upgrade/transformers/elastic/transformToVersion2.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 clean has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function clean(config, callback) {
                co(function* () {
            
                    let esClient = config.elasticsearch.esClient;
                    yield at(esClient.indices.refresh({index: '_all'}));
            Severity: Minor
            Found in bin/upgrade/transformers/elastic/transformToVersion2.js - About 1 hr to fix

              Function checkNeedsUpdateIndexPattern has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

              function checkNeedsUpdateIndexPattern(indexPattern) {
              
                  let fields = JSON.parse(indexPattern._source.fields.replaceAll('\\\"', '"'));
              
              
              
              Severity: Minor
              Found in bin/upgrade/transformers/elastic/transformToVersion2.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 upgrade has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function upgrade(config, callback) {
                  co(function* () {
              
              
                      let esClient = config.elasticsearch.esClient;
              Severity: Minor
              Found in bin/upgrade/transformers/elastic/transformToVersion2.js - About 1 hr to fix

                Function checkNeedsUpdateVisualization has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function checkNeedsUpdateVisualization(visualization) {
                
                    let visState = JSON.parse(visualization._source.visState.replaceAll('\\\"', '"'));
                
                    /*
                Severity: Minor
                Found in bin/upgrade/transformers/elastic/transformToVersion2.js - About 1 hr to fix

                  Function sourcesEquals has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function sourcesEquals(x, y) {
                      // Recursive object equality check
                      let p = Object.keys(x);
                      return Object.keys(y).every(function (i) {
                          if (i === 'ext') {
                  Severity: Minor
                  Found in bin/upgrade/transformers/elastic/transformToVersion2.js - About 1 hr to fix

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

                    function checkNeedsUpdateIndexPattern(indexPattern) {
                    
                        let fields = JSON.parse(indexPattern._source.fields.replaceAll('\\\"', '"'));
                    
                    
                    
                    Severity: Minor
                    Found in bin/upgrade/transformers/elastic/transformToVersion2.js - About 1 hr to fix

                      Function setUpKibanaIndex has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function* setUpKibanaIndex(esClient) {
                          if (!indices.configs.kibana) {
                              return;
                          }
                      
                      
                      Severity: Minor
                      Found in bin/upgrade/transformers/elastic/transformToVersion2.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 setUpKibanaIndex has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function* setUpKibanaIndex(esClient) {
                          if (!indices.configs.kibana) {
                              return;
                          }
                      
                      
                      Severity: Minor
                      Found in bin/upgrade/transformers/elastic/transformToVersion2.js - About 1 hr to fix

                        Function reindexManually has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        let reindexManually = function* (esClient, from, to) {
                            let mapping = yield at(esClient.indices.getMapping({index: from}));
                        
                            if (!(yield at(esClient.indices.exists({index: to})))) {
                                yield at(esClient.indices.create({index: to}));
                        Severity: Minor
                        Found in bin/upgrade/transformers/elastic/transformToVersion2.js - About 1 hr to fix

                          Function restore has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function restore(config, callback) {
                              co(function* () {
                          
                                  let esClient = config.elasticsearch.esClient;
                                  yield at(esClient.indices.refresh({index: '_all'}));
                          Severity: Minor
                          Found in bin/upgrade/transformers/elastic/transformToVersion2.js - About 1 hr to fix

                            Function at has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                            let at = function (promise) {
                                return promiseRetry(defaultRetryOptions, function (retry, number) {
                                    return promise.catch(function (error) {
                                        if (error.statusCode === 404 ||
                                            error.status === 404) {
                            Severity: Minor
                            Found in bin/upgrade/transformers/elastic/transformToVersion2.js - About 45 mins 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 reindexManually has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                            let reindexManually = function* (esClient, from, to) {
                                let mapping = yield at(esClient.indices.getMapping({index: from}));
                            
                                if (!(yield at(esClient.indices.exists({index: to})))) {
                                    yield at(esClient.indices.create({index: to}));
                            Severity: Minor
                            Found in bin/upgrade/transformers/elastic/transformToVersion2.js - About 45 mins 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

                            Avoid deeply nested control flow statements.
                            Open

                                                if (defaultTraceAttributes.indexOf(property) === -1) {
                                                    if (!newProperties.ext) {
                                                        newProperties.ext = {
                                                            properties: {}
                                                        };
                            Severity: Major
                            Found in bin/upgrade/transformers/elastic/transformToVersion2.js - About 45 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return extensions.indexOf(i) !== -1;
                              Severity: Major
                              Found in bin/upgrade/transformers/elastic/transformToVersion2.js - About 30 mins to fix

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

                                    let xAPIVerbsActivity = yield at(esClient.get({
                                        index: gameIndex.index,
                                        type: 'visualization',
                                        id: 'xAPIVerbsActivity'
                                    })).catch(function (notFound) {
                                Severity: Major
                                Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 1 other location - About 2 hrs to fix
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 391..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 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

                                    let totalSessionsVis = yield at(esClient.get({
                                        index: gameIndex.index,
                                        type: 'visualization',
                                        id: 'TotalSessionPlayers-Cmn'
                                    })).catch(function (notFound) {
                                Severity: Major
                                Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 1 other location - About 2 hrs to fix
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 428..436

                                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

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

                                        indices = {
                                            traces: [],
                                            versions: [],
                                            results: [],
                                            opaqueValues: [],
                                Severity: Major
                                Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 1 other location - About 2 hrs to fix
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 181..196

                                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

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

                                let indices = {
                                    traces: [],
                                    versions: [],
                                    results: [],
                                    opaqueValues: [],
                                Severity: Major
                                Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 1 other location - About 2 hrs to fix
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 1128..1143

                                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

                                        for (let j = 0; j < defaultTraceAttributes.length; ++j) {
                                            let defaultAttribute = defaultTraceAttributes[j];
                                
                                            if (fieldName === defaultAttribute ||
                                                fieldName === defaultAttribute + '.keyword') {
                                Severity: Major
                                Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 1 other location - About 1 hr to fix
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 685..693

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

                                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

                                        for (let j = 0; j < defaultTraceAttributes.length; ++j) {
                                            let defaultAttribute = defaultTraceAttributes[j];
                                
                                            if (field === defaultAttribute ||
                                                field === defaultAttribute + '.keyword') {
                                Severity: Major
                                Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 1 other location - About 1 hr to fix
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 794..802

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

                                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

                                    if (!(yield at(esClient.indices.exists({index: to})))) {
                                        yield at(esClient.indices.create({index: to}));
                                    }
                                Severity: Major
                                Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 1 other location - About 1 hr to fix
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 558..560

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

                                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

                                    if (!(yield at(esClient.indices.exists({index: upgradeIndex})))) {
                                        yield at(esClient.indices.create({index: upgradeIndex}));
                                    }
                                Severity: Major
                                Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 1 other location - About 1 hr to fix
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 251..253

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

                                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

                                    for (let i = 0; i < indices.games.length; i++) {
                                        let gameIndex = indices.games[i];
                                        yield setUpGameIndex(esClient, gameIndex);
                                    }
                                Severity: Major
                                Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 1 other location - About 1 hr to fix
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 478..481

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

                                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

                                    for (let i = 0; i < indices.games.length; i++) {
                                        let gameIndex = indices.games[i];
                                        yield upgradeGameIndex(esClient, gameIndex);
                                    }
                                Severity: Major
                                Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 1 other location - About 1 hr to fix
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 890..893

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

                                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

                                        for (let type in indexMapping) {
                                            yield at(esClient.indices.putMapping({
                                                index: to,
                                                type: type,
                                                body: indexMapping[type]
                                Severity: Minor
                                Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 1 other location - About 55 mins to fix
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 564..570

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

                                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

                                    for (let type in indexMapping) {
                                        yield at(esClient.indices.putMapping({
                                            index: upgradeIndex,
                                            type: type,
                                            body: indexMapping[type]
                                Severity: Minor
                                Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 1 other location - About 55 mins to fix
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 257..264

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

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

                                    co(function* () {
                                
                                            let esClient = config.elasticsearch.esClient;
                                            yield at(esClient.indices.refresh({index: '_all'}));
                                
                                
                                Severity: Major
                                Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 4 other locations - About 35 mins to fix
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 326..384
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 911..955
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 1108..1159
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 1178..1207

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

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

                                    co(function* () {
                                
                                
                                        let esClient = config.elasticsearch.esClient;
                                        yield at(esClient.indices.refresh({index: '_all'}));
                                Severity: Major
                                Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 4 other locations - About 35 mins to fix
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 326..384
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 1031..1102
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 1108..1159
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 1178..1207

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

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

                                    co(function* () {
                                        let esClient = config.elasticsearch.esClient;
                                        yield at(esClient.ping({requestTimeout: 2000}));
                                        yield at(esClient.indices.refresh({index: '_all'}));
                                        const responseIndices = yield at(esClient.cat.indices({format: 'json'}));
                                Severity: Major
                                Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 4 other locations - About 35 mins to fix
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 911..955
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 1031..1102
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 1108..1159
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 1178..1207

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

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

                                    co(function* () {
                                
                                        let esClient = config.elasticsearch.esClient;
                                        yield at(esClient.indices.refresh({index: '_all'}));
                                
                                
                                Severity: Major
                                Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 4 other locations - About 35 mins to fix
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 326..384
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 911..955
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 1031..1102
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 1108..1159

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

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

                                    co(function* () {
                                
                                        let esClient = config.elasticsearch.esClient;
                                        yield at(esClient.indices.refresh({index: '_all'}));
                                
                                
                                Severity: Major
                                Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 4 other locations - About 35 mins to fix
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 326..384
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 911..955
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 1031..1102
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 1178..1207

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

                                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

                                            console.error('Error retrying ' + number +
                                                ' for promise ' + promise.name + ' logs: ' +
                                                JSON.stringify(error, null, 4));
                                Severity: Minor
                                Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 2 other locations - About 30 mins to fix
                                bin/delete-duplicates.js on lines 56..58
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 212..214

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

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

                                        if (bulkUpgradedTraces.length > 0) {
                                            yield at(esClient.bulk({body: bulkUpgradedTraces}));
                                            upgraded = true;
                                        }
                                Severity: Major
                                Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 3 other locations - About 30 mins to fix
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 581..584
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 729..732
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 867..870

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

                                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

                                                console.error('Error on BULK errores, retrying ' + number +
                                                    ' for promise ' + promise.name + ' logs: ' +
                                                    JSON.stringify(resp, null, 4));
                                Severity: Minor
                                Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 2 other locations - About 30 mins to fix
                                bin/delete-duplicates.js on lines 56..58
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 206..208

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

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

                                        if (bulkUpgradedTraces.length > 0) {
                                            yield at(esClient.bulk({body: bulkUpgradedTraces}));
                                            upgraded = true;
                                        }
                                Severity: Major
                                Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 3 other locations - About 30 mins to fix
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 581..584
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 836..839
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 867..870

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

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

                                        if (bulkUpgradedTraces.length > 0) {
                                            yield at(esClient.bulk({body: bulkUpgradedTraces}));
                                            upgraded = true;
                                        }
                                Severity: Major
                                Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 3 other locations - About 30 mins to fix
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 581..584
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 729..732
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 836..839

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

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

                                        if (bulkUpgradedTraces.length > 0) {
                                            yield at(esClient.bulk({body: bulkUpgradedTraces}));
                                            upgraded = true;
                                        }
                                Severity: Major
                                Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 3 other locations - About 30 mins to fix
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 729..732
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 836..839
                                bin/upgrade/transformers/elastic/transformToVersion2.js on lines 867..870

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

                                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