e-ucm/rage-analytics-backend

View on GitHub

Showing 590 of 590 total issues

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

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

                var checkConsumerData = function(playerId, versionId, gameplayId, activity, data, convertedTraces) {
                    for (var i = 0; i < data.length; ++i) {
                        var extensions = data[i].object.definition.extensions;
                        should(data[i].actor.name).not.eql(playerId);
                        should(data[i].actor.account.name).not.eql(playerId);
        Severity: Minor
        Found in test/tests/collectorTest.js - About 1 hr to fix

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

              gameplays.startAttempt = function (id, player, authToken) {
                  var g = new Collection(require('./db'), 'gameplays_' + id);
                  g.sort = { _id: -1 };
                  return gameplays.find(id, player).then(function (gameplay) {
                      return g.findAndUpdate(gameplay._id.toString(), {
          Severity: Minor
          Found in lib/gameplays.js - About 1 hr to fix

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

                var addToArrayHandler = function (update, object, stringKey, add) {
                    var value = fetchFromObject(object, stringKey);
                    if (hasKey(object, stringKey)) {
                        if (add) {
                            if (!update.$addToSet) {
            Severity: Minor
            Found in lib/utils.js - About 1 hr to fix

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

                                  if (body.link) {
                                      if (!update.$set) {
                                          update.$set = {};
                                      }
                                      update.$set.link = body.link;
              Severity: Major
              Found in lib/games.js and 2 other locations - About 1 hr to fix
              lib/classes.js on lines 517..523
              lib/games.js on lines 157..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 55.

              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

              router.get('/:gameId/versions/:versionId/activities', function (req, res) {
                  restUtils.processResponse(activities.getGameActivities(req.params.gameId, req.params.versionId), res);
              });
              Severity: Major
              Found in routes/games.js and 1 other location - About 1 hr to fix
              routes/kibana.js on lines 210..212

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

              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 (m && m.length > 1) {
                              obj.kibanaSavedObjectMeta.searchSourceJSON = obj.kibanaSavedObjectMeta.searchSourceJSON.replace(m[2], classId);
                          }
              Severity: Major
              Found in lib/kibana/kibana.js and 1 other location - About 1 hr to fix
              lib/kibana/kibana.js on lines 601..603

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

              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

                                  if (body.title) {
                                      if (!update.$set) {
                                          update.$set = {};
                                      }
                                      update.$set.title = body.title;
              Severity: Major
              Found in lib/games.js and 2 other locations - About 1 hr to fix
              lib/classes.js on lines 517..523
              lib/games.js on lines 163..168

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

              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 createActivity has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  activities.createActivity = function (gameId, versionId, classId, username, name, rootId, offline, allowAnonymous) {
              Severity: Major
              Found in lib/activities.js - About 1 hr to fix

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

                                    if (m && m.length > 1) {
                                        obj.kibanaSavedObjectMeta.searchSourceJSON = obj.kibanaSavedObjectMeta.searchSourceJSON.replace(m[2], id);
                                    }
                Severity: Major
                Found in lib/kibana/kibana.js and 1 other location - About 1 hr to fix
                lib/kibana/kibana.js on lines 639..641

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

                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

                router.get('/templates/index/:id', function (req, res) {
                    restUtils.processResponse(kibana.getIndexTemplate(req.params.id, req.app.esClient), res);
                });
                Severity: Major
                Found in routes/kibana.js and 1 other location - About 1 hr to fix
                routes/games.js on lines 476..478

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

                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

                                    if (body.externalId) {
                                        if (!update.$set) {
                                            update.$set = {};
                                        }
                
                
                Severity: Major
                Found in lib/classes.js and 2 other locations - About 1 hr to fix
                lib/games.js on lines 157..162
                lib/games.js on lines 163..168

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

                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

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

                    {
                        id: 4000,
                        type: 'traces',
                        source: {
                            name: 'name',
                Severity: Minor
                Found in test/upgraderTests/elastic/upgradeOutputs/tracesTo2OUT.js and 1 other location - About 55 mins to fix
                test/upgraderTests/elastic/upgradeOutputs/tracesTo2OUT.js on lines 4..17

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 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 3 locations. Consider refactoring.
                Open

                                                        [{
                                                            _id: idActivity,
                                                            trackingCode: activityTrackingCode,
                                                            gameId: idGame,
                                                            versionId: idVersion,
                Severity: Major
                Found in test/tests/attemptsTest.js and 2 other locations - About 55 mins to fix
                test/tests/collectorTest.js on lines 65..76
                test/tests/collectorTest.js on lines 77..88

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

                                            {
                                                _id: idActivity,
                                                trackingCode: trackingCode,
                                                classId: idClass,
                                                gameId: idGame,
                Severity: Major
                Found in test/tests/collectorTest.js and 2 other locations - About 55 mins to fix
                test/tests/attemptsTest.js on lines 62..73
                test/tests/collectorTest.js on lines 77..88

                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

                Severity
                Category
                Status
                Source
                Language