e-ucm/rage-analytics-backend

View on GitHub

Showing 590 of 590 total issues

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

    function compareFunction(fileIn, fileOut, idSession, searchObj, callback) {
        var bodyOut = require(fileOut);

        setTimeout(function () {
            app.esClient.search(searchObj, function (err, response) {
Severity: Minor
Found in test/upgraderTests/elastic/elasticTransformerTo2.js - About 1 hr to fix

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

    module.exports = (function () {
        var Collection = require('easy-collections');
        var lti = new Collection(require('./db'), 'lti');
    
        lti.sort = {
    Severity: Minor
    Found in lib/lti.js - About 1 hr to fix

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

      var openLRSConsumer = function (lrs) {
          var Q = require('q');
          var request = require('request');
          var options = {
              uri: lrs.uri + 'statements',
      Severity: Minor
      Found in lib/consumers/openlrs.js - About 1 hr to fix

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

            kibana.buildKibanaResources = function (indexNames, config, esClient) {
                var deferred = Q.defer();
        
                console.log('kibana.buildKibanaResources -> Started!');
        
        
        Severity: Minor
        Found in lib/kibana/kibana.js - About 1 hr to fix

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

              activities.createActivity = function (gameId, versionId, classId, username, name, rootId, offline, allowAnonymous) {
                  return getGameVersionAndClass(gameId, versionId, classId).then(function (result) {
                      if (!name) {
                          name = 'new Activity';
                      }
          Severity: Minor
          Found in lib/activities.js - About 1 hr to fix

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

                kibana.getVisualizations = function (user, gameId, esClient) {
                    var deferred = Q.defer();
            
                    esClient.search({
                        index: '.games' + gameId,
            Severity: Minor
            Found in lib/kibana/kibana.js - About 1 hr to fix

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

                      startTopology: function (topologyName, analysisFolder, kafkaTopicName) {
                          var config = {
                              topologyName: topologyName,
                              kafkaTopicName: kafkaTopicName,
                              zookeeperURL: zookeeperUrl,
              Severity: Minor
              Found in lib/services/storm.js - About 1 hr to fix

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

                    authTokens.track = function (authorization) {
                        var deferred = Q.defer();
                        var set = {
                            lastAccessed: new Date()
                        };
                Severity: Minor
                Found in lib/auth-tokens.js - About 1 hr to fix

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

                                      if (!group.participants.teachers || group.participants.teachers.indexOf(username) === -1) {
                                          throw {
                                              message: 'You don\'t have permission to modify this group.',
                                              status: 401
                                          };
                  Severity: Major
                  Found in lib/groups.js and 1 other location - About 1 hr to fix
                  lib/groups.js on lines 198..203

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

                  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 (!groupRes.participants.teachers || groupRes.participants.teachers.indexOf(username) === -1) {
                                      throw {
                                          message: 'You don\'t have permission to delete this groups.',
                                          status: 401
                                      };
                  Severity: Major
                  Found in lib/groups.js and 1 other location - About 1 hr to fix
                  lib/groups.js on lines 152..157

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

                  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 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 parseExtensions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  var parseExtensions = function (result, container) {
                      var extensions = result.extensions;
                      if (extensions) {
                          container.ext = {};
                          for (var key in extensions) {
                  Severity: Minor
                  Found in lib/tracesConverter.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 createGroup has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      groups.createGroup = function (username, classId, group) {
                  
                          if (group.participants) {
                              if (!group.participants.teachers) {
                                  group.participants.teachers = [];
                  Severity: Minor
                  Found in lib/groups.js - About 1 hr to fix

                    Function parseCSV has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    var parseCSV = function (trace) {
                        trace = trace.replace('\r', '');
                        var list = [];
                    
                        var escape = false;
                    Severity: Minor
                    Found in lib/csvToXAPI.js - About 1 hr to fix

                      Function checkDiffs has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function* checkDiffs(hits) {
                              if (hits.length === 1) {
                                  return;
                              }
                              while (hits.length > 0) {
                      Severity: Minor
                      Found in bin/delete-duplicates.js - About 1 hr to fix

                        Function resolveParticipants has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            var resolveParticipants = function (groupsObj, groupingsObj, classId, callback) {
                                var deferred = Q.defer();
                        
                                var participants = {students: [], teachers: [], assistants: []};
                                if (groupingsObj.length > 0) {
                        Severity: Minor
                        Found in lib/kibana/kibana.js - About 1 hr to fix

                          Function startActivity has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              activities.startActivity = function (activityId) {
                                  return activities.findById(activityId).then(function (activity) {
                                      if (!activity) {
                                          throw {
                                              message: 'Activity does not exist',
                          Severity: Minor
                          Found in lib/activities.js - About 1 hr to fix

                            Function deleteUserData has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                activities.deleteUserData = function (defaultConfig, activityId, userData, esClient) {
                                    return activities.findById(activityId, true).then(function(result) {
                                        if (!result) {
                                            throw {
                                                message: 'Activity not found',
                            Severity: Minor
                            Found in lib/activities.js - About 1 hr to fix

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

                                              return activities.createActivity(req.body.gameId, req.body.versionId, req.body.classId,
                                                  username, req.body.name, undefined, req.body.offline, allowAnonymous);
                              Severity: Major
                              Found in routes/activities.js and 1 other location - About 1 hr to fix
                              routes/activities.js on lines 235..235

                              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

                              Severity
                              Category
                              Status
                              Source
                              Language