e-ucm/rage-analytics-backend

View on GitHub

Showing 590 of 590 total issues

Function buildEntries has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    var buildEntries = function (gameplayId, versionId, activityId, session, firstSessionStarted, currentSessionStarted) {
Severity: Minor
Found in lib/traces.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                for (var i = 0; i < fields.length; ++i) {
                                    var field = fields[i];
                                    if (field && field.name && field.name.indexOf('ext.') === 0) {
                                        isVersion2 = field;
                                        break;
    Severity: Major
    Found in bin/upgrade/controllers/upgrade-elastic-indices.js - About 45 mins to fix

      Function addTraces has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

                              addTraces: function (playerId, versionId, gameplayId, activity, data, convertedTraces) {
      Severity: Minor
      Found in test/tests/collectorTest.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                    if (isVersion2) {
                                        console.log('Fields parsed, found ext. def at field ' + JSON.stringify(isVersion2, null, 4));
                                        callback('2');
                                    } else {
                                        console.log('Fields parsed object has elements but no ext valued found, defaulting to minimum version');
        Severity: Major
        Found in bin/upgrade/controllers/upgrade-elastic-indices.js - About 45 mins to fix

          Function checkConsumerData has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  var checkConsumerData = function(playerId, versionId, gameplayId, activity, data, convertedTraces) {
          Severity: Minor
          Found in test/tests/collectorTest.js - About 45 mins 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 addTraces has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                            addTraces: function (playerId, versionId, gameplayId, activity, data, convertedTraces) {
            Severity: Minor
            Found in test/tests/collectorTest.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if (!extensions.extensions) {
                                      extensions.extensions = {};
                                  }
              Severity: Major
              Found in lib/csvToXAPI.js - About 45 mins to fix

                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

                  Function addTraces has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                                  addTraces: function (playerId, versionId, gameplayId, activity, data, convertedTraces) {
                  Severity: Minor
                  Found in test/tests/collectorTest.js - About 45 mins to fix

                    Function addTraces has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                                    addTraces: function (playerId, versionId, gameplayId, activity, data, convertedTraces) {
                    Severity: Minor
                    Found in test/tests/collectorTest.js - About 45 mins to fix

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

                      module.exports = (function () {
                          var Q = require('q');
                          var Collection = require('easy-collections');
                          var authTokens = new Collection(require('./db'), 'authtokens');
                          var gameplays = require('./gameplays');
                      Severity: Minor
                      Found in lib/auth-tokens.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 addTraces has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              addTraces: function (playerId, versionId, gameplayId, activity, data, convertedData) {
                      Severity: Minor
                      Found in lib/consumers/openlrs.js - About 45 mins to fix

                        Function createDashboard has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            kibana.createDashboard = function (dashboard, id, parentId, esClient, config, user) {
                        Severity: Minor
                        Found in lib/kibana/kibana.js - About 45 mins to fix

                          Function addTraces has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                  addTraces: function (playerId, versionId, gameplayId, activity, data, convertedData) {
                          Severity: Minor
                          Found in lib/consumers/kafka.js - About 45 mins to fix

                            Function createVisualization has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                kibana.createVisualization = function(config, gameId, id, visualizationId, position, esClient) {
                            Severity: Minor
                            Found in lib/kibana/kibana.js - About 45 mins to fix

                              Function addTraces has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                      addTraces: function (playerId, versionId, gameplayId, activity, data, convertedData) {
                              Severity: Minor
                              Found in lib/consumers/fsraw.js - About 45 mins to fix

                                Function addTraces has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                        addTraces: function (playerId, versionId, gameplayId, activity, data, convertedData) {
                                Severity: Minor
                                Found in lib/consumers/elasticsearch.js - About 45 mins to fix

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

                                              request.post('/api/collector/start/' + trackingCode)
                                                  .expect(404)
                                                  .expect('Content-Type', /json/)
                                                  .send({
                                                      anonymous: nonExistantAnonymousPlayerId
                                  Severity: Minor
                                  Found in test/tests/collectorTest.js and 1 other location - About 40 mins to fix
                                  test/tests/collectorTest.js on lines 646..710

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

                                  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: ObjectID('5a959b29ca50e50077dec85d'),
                                              title: 'd1',
                                              created: new Date('2018-02-27T17:53:45.468Z'),
                                              authors: [
                                  Severity: Minor
                                  Found in test/upgraderTests/mongo/upgradeOutputs/exampleTo4OUT.js and 1 other location - About 40 mins to fix
                                  test/upgraderTests/mongo/upgradeOutputs/exampleTo4OUT.js on lines 8..20

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

                                  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