e-ucm/rage-analytics-backend

View on GitHub

Showing 590 of 590 total issues

Function removeFolder has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function removeFolder(location, next) {
        fs.readdir(location, function (err, files) {
            async.each(files, function (file, cb) {
                file = location + '/' + file;
                fs.stat(file, function (err, stat) {
Severity: Minor
Found in lib/analysis.js - About 1 hr to fix

    Function getUserTypeForArray has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        groupings.getUserTypeForArray = function(groupingIds, username, ignoreStudents, ignoreAssistants, ignoreTeachers) {
            if (groupingIds.length > 0) {
                groupingIds = groupingIds.slice(0);
                var groupingId = groupingIds.shift();
                return groupings.getUserType(groupingId, username, ignoreStudents, ignoreAssistants, ignoreTeachers)
    Severity: Minor
    Found in lib/groupings.js - About 1 hr to fix

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

                  request.put('/api/classes/' + idClass)
                      .expect(200)
                      .set('X-Gleaner-User', 'Teacher1')
                      .send({
                          teachers: ['Teacher2'],
      Severity: Major
      Found in test/tests/classesTest.js and 1 other location - About 1 hr to fix
      test/tests/coursesTest.js on lines 129..143

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

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

          kibana.updateKibanaPermission = function (config, user, resources, callback) {
              var updateKP = function () {
                  var baseUsersAPI = config.a2.a2ApiPath;
                  request({
                      uri: baseUsersAPI + 'applications/look/kibana',
      Severity: Minor
      Found in lib/kibana/kibana.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 insertAndUpgrade has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  var insertAndUpgrade = function (data, callback) {
                      var transform = function () {
                          var t = require('../../../bin/upgrade/transformers/mongo/transformToVersion4.js');
                          async.waterfall([function (newCallback) {
                                  newCallback(null, config);
          Severity: Minor
          Found in test/upgraderTests/mongo/mongoTransformerTo4.js - About 1 hr to fix

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

                    var insertAndUpgrade = function (data, callback) {
                        var transform = function () {
                            var t = require('../../../bin/upgrade/transformers/mongo/transformToVersion3.js');
                            async.waterfall([function (newCallback) {
                                    newCallback(null, config);
            Severity: Minor
            Found in test/upgraderTests/mongo/mongoTransformerTo3.js - About 1 hr to fix

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

                  var getGameVersionAndClass = function (gameId, versionId, classId) {
                      return games.findById(gameId).then(function (game) {
                          if (!game) {
                              throw {
                                  message: 'Game does not exist',
              Severity: Minor
              Found in lib/activities.js - About 1 hr to fix

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

                    router.get('/my', function (req, res) {
                        var username = req.headers['x-gleaner-user'];
                        restUtils.processResponse(activities.getUserActivities(username), res);
                    });
                Severity: Major
                Found in routes/activities.js and 1 other location - About 1 hr to fix
                routes/classes.js on lines 87..90

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

                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('/my', function (req, res) {
                    var username = req.headers['x-gleaner-user'];
                    restUtils.processResponse(classes.getUserClasses(username), res);
                });
                Severity: Major
                Found in routes/classes.js and 1 other location - About 1 hr to fix
                routes/activities.js on lines 77..80

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

                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

                        afterEach(function (done) {
                            db.collection('games').drop(function () {
                                db.collection('versions').drop(function () {
                                    done();
                                });
                Severity: Major
                Found in test/tests/analysisTest.js and 1 other location - About 1 hr to fix
                test/upgraderTests/mongo/mongoController.js on lines 74..80

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

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

                    }, function (error, response) {
                        if (!error) {
                            res.json(response);
                        } else {
                            res.status(error.status);
                Severity: Major
                Found in routes/kibana.js and 3 other locations - About 1 hr to fix
                routes/kibana.js on lines 117..124
                routes/kibana.js on lines 323..330
                routes/kibana.js on lines 703..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 58.

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

                                }, function (error, response) {
                                    if (!error) {
                                        res.json(obj);
                                    } else {
                                        res.status(error.status);
                Severity: Major
                Found in routes/kibana.js and 3 other locations - About 1 hr to fix
                routes/kibana.js on lines 117..124
                routes/kibana.js on lines 323..330
                routes/kibana.js on lines 467..474

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

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

                    }, function (error, response) {
                        if (!error) {
                            res.json(response);
                        } else {
                            res.status(error.status);
                Severity: Major
                Found in routes/kibana.js and 3 other locations - About 1 hr to fix
                routes/kibana.js on lines 117..124
                routes/kibana.js on lines 467..474
                routes/kibana.js on lines 703..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 58.

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

                            req.app.esClient.index(obj, function (error, response) {
                                if (!error) {
                                    res.json(response);
                                } else {
                                    res.status(error.status);
                Severity: Major
                Found in routes/kibana.js and 3 other locations - About 1 hr to fix
                routes/kibana.js on lines 323..330
                routes/kibana.js on lines 467..474
                routes/kibana.js on lines 703..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 58.

                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

                                    db.collection('versions').drop(function () {
                                        db.collection('sessions').drop(function () {
                                            db.collection('classes').drop(function () {
                                                done();
                                            });
                Severity: Major
                Found in test/upgraderTests/mongo/mongoController.js and 1 other location - About 1 hr to fix
                test/tests/analysisTest.js on lines 55..61

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

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

                    var processTraces = function (playerId, versionId, gameplayId, activityId, session, firstSessionStarted, currentSessionStarted, data, start) {
                Severity: Major
                Found in lib/traces.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 insertAndUpgrade has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            var insertAndUpgrade = function (data, callback) {
                                var transform = function () {
                                    var t = require('../../../bin/upgrade/transformers/mongo/transformToVersion2.js');
                                    async.waterfall([function (newCallback) {
                                            newCallback(null, config);
                    Severity: Minor
                    Found in test/upgraderTests/mongo/mongoTransformerTo2.js - About 1 hr to fix

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

                      function upgrade(config, callback) {
                          // Transformers
                          var classes = new Collection(config.mongodb.db, 'classes');
                          var sessionsCollection = config.mongodb.db.collection('sessions');
                          var cursor = sessionsCollection.find();
                      Severity: Minor
                      Found in bin/upgrade/transformers/mongo/transformToVersion2.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language