e-ucm/rage-analytics-backend

View on GitHub

Showing 590 of 590 total issues

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

        {
            _id: ObjectID('5a16c1c1bfc960008bc5e06e'),
            playerId: ObjectID('5a16c1c1bfc960008bc5e06d'),
            playerName: 'blao',
            playerType: 'identified',
Severity: Major
Found in test/upgraderTests/mongo/upgradeOutputs/exampleTo4OUT.js and 3 other locations - About 2 hrs to fix
test/upgraderTests/mongo/upgradeOutputs/exampleTo4OUT.js on lines 509..525
test/upgraderTests/mongo/upgradeOutputs/exampleTo4OUT.js on lines 526..542
test/upgraderTests/mongo/upgradeOutputs/exampleTo4OUT.js on lines 543..559

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

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

        var startNewSession = function (expectedSession, playerIdentifier, checkAnimalName, type) {
            request.post('/api/collector/start/' + trackingCode)
                .expect(200)
                .expect('Content-Type', /json/)
                .send({
Severity: Major
Found in test/tests/collectorTest.js - About 2 hrs to fix

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

            {
                timestamp: '2018-04-13T09:17:37.510Z',
                actor: {
                    account: {homePage: 'http://localhost:3000/', name: 'offline'},
                    name: 'XJIR'
    Severity: Major
    Found in test/tests/csvToXAPItest.js and 1 other location - About 2 hrs to fix
    test/tests/csvToXAPItest.js on lines 105..119

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

    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

            {
                timestamp: '2018-04-13T09:17:37.728Z',
                actor: {
                    account: {homePage: 'http://localhost:3000/', name: 'offline'},
                    name: 'XJIR'
    Severity: Major
    Found in test/tests/csvToXAPItest.js and 1 other location - About 2 hrs to fix
    test/tests/csvToXAPItest.js on lines 65..79

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

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

    var toStatement = function (statement, trace) {
    
        var parts = parseCSV(trace);
    
        var username = parts[0];
    Severity: Major
    Found in lib/csvToXAPI.js - About 2 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 guessModelVersion has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        ElasticController.prototype.guessModelVersion = function(esClient, callback) {
            console.log('Trying to guess elasticsearch existing model version!');
            var defaultIndex = require(Path.resolve(__dirname, '../../../lib/kibana/defaultIndex.js'));
            var indexId = 'defaultIndex';
        
        
        Severity: Major
        Found in bin/upgrade/controllers/upgrade-elastic-indices.js - About 2 hrs to fix

          Function createGameTemplates has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              games.kibana.createGameTemplates = function (gameId, esClient) {
          
                  var deferred = Q.defer();
          
                  kibana.getIndexTemplate('defaultIndex', esClient)
          Severity: Major
          Found in lib/games.js - About 2 hrs to fix

            File analysis.js has 263 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            'use strict';
            
            module.exports = (function () {
                var Q = require('q');
                var Collection = require('easy-collections');
            Severity: Minor
            Found in lib/analysis.js - About 2 hrs to fix

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

                  router.get('/:activityId', function (req, res) {
                      var username = req.headers['x-gleaner-user'];
                      restUtils.processResponse(activities.isAuthorizedFor(req.params.activityId, username, 'get', '/activities/:activityId')
                          .then(function (activity) {
                              return activity;
              Severity: Major
              Found in routes/activities.js and 1 other location - About 2 hrs to fix
              routes/classes.js on lines 121..127

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 81.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

              router.get('/:classId', function (req, res) {
                  var username = req.headers['x-gleaner-user'];
                  restUtils.processResponse(classes.isAuthorizedFor(req.params.classId, username, 'get', '/classes/:classId')
                      .then(function (classReq) {
                          return classReq;
              Severity: Major
              Found in routes/classes.js and 1 other location - About 2 hrs to fix
              routes/activities.js on lines 112..118

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 81.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

                  versions: [
                      {
                          _id: ObjectID('5a14760fffce74008bddcabc'),
                          gameId: ObjectID('5a14760fffce74008bddcabb'),
                          trackingCode: '5a14760fffce74008bddcabcfb1gtsm6sif'
              Severity: Major
              Found in test/upgraderTests/mongo/upgradeInputs/exampleTo4IN.js and 1 other location - About 2 hrs to fix
              test/upgraderTests/mongo/upgradeOutputs/exampleTo4OUT.js on lines 107..123

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 81.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

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

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 81.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

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

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 81.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

                  versions: [
                      {
                          _id: ObjectID('5a14760fffce74008bddcabc'),
                          gameId: ObjectID('5a14760fffce74008bddcabb'),
                          trackingCode: '5a14760fffce74008bddcabcfb1gtsm6sif'
              Severity: Major
              Found in test/upgraderTests/mongo/upgradeOutputs/exampleTo4OUT.js and 1 other location - About 2 hrs to fix
              test/upgraderTests/mongo/upgradeInputs/exampleTo4IN.js on lines 113..129

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 81.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

              module.exports = (function () {
                  var Collection = require('easy-collections');
                  var players = new Collection(require('./db'), 'players');
              
                  /**
              Severity: Major
              Found in lib/players.js - About 2 hrs to fix

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

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

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

                  module.exports = (function () {
                  
                      var hasKey = function (object, key) {
                          var o = object;
                          var matches = 0;
                  Severity: Major
                  Found in lib/utils.js - About 2 hrs to fix

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

                            var startNewIdentifiedSession = function (expectedSession, playerIdentifier) {
                                request.post('/api/collector/start/' + trackingCode)
                                    .expect(200)
                                    .expect('Content-Type', /json/)
                                    .set('x-gleaner-user', playerIdentifier)
                    Severity: Major
                    Found in test/tests/collectorTest.js - About 2 hrs to fix

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

                          function getBestType(type1, type2) {
                              if (type1 === 'teacher' || type2 === 'teacher') {
                                  return 'teacher';
                              }
                              if (type1 === 'assistant' || type2 === 'assistant') {
                      Severity: Major
                      Found in lib/groupings.js and 2 other locations - About 2 hrs to fix
                      lib/activities.js on lines 195..206
                      lib/groups.js on lines 266..277

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 79.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Severity
                      Category
                      Status
                      Source
                      Language