e-ucm/rage-analytics-backend

View on GitHub

Showing 244 of 590 total issues

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

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

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

    module.exports = (function () {
        var Q = require('q');
        var authTokens = require('./auth-tokens');
        var players = require('./players');
        var dataSource = require('./traces');
    Severity: Major
    Found in lib/collector.js - About 5 hrs to fix

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

      module.exports = function (request, db, config) {
          config.mongodb.db = db;
      
          /**-------------------------------------------------------------**/
          /**-------------------------------------------------------------**/
      Severity: Major
      Found in test/upgraderTests/mongo/mongoTransformerTo3.js - About 5 hrs to fix

        Function createAnalysis has 122 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            analysis.createAnalysis = function (versionId, username, req, res) {
        
                versionId = analysis.toObjectID(versionId);
                return analysis.findById(versionId)
                    .then(function (analysisResult) {
        Severity: Major
        Found in lib/analysis.js - About 4 hrs to fix

          Function identifyExtensionsFromIndex has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
          Open

          function* identifyExtensionsFromIndex(esClient, index) {
          
              let oldMapping = yield at(esClient.indices.getMapping({index: index.index}));
              let upgradeIndex = 'upgrade_' + index.index;
              let mapping = {};
          Severity: Minor
          Found in bin/upgrade/transformers/elastic/transformToVersion2.js - About 4 hrs 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 exports has 115 lines of code (exceeds 25 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: Major
          Found in lib/auth-tokens.js - About 4 hrs to fix

            Function checkAttempts has 113 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function checkAttempts(config, callback) {
            
                var playersCollection = config.mongodb.db.collection('players');
                var authTokensCollection = config.mongodb.db.collection('authtokens');
            
            
            Severity: Major
            Found in bin/upgrade/transformers/mongo/transformToVersion4.js - About 4 hrs to fix

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

              module.exports = (function () {
              
                  var hasKey = function (object, key) {
                      var o = object;
                      var matches = 0;
              Severity: Minor
              Found in lib/utils.js - About 4 hrs 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 exports has 105 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              module.exports = (function () {
                  var Q = require('q');
                  var tracesConverter = require('./tracesConverter');
                  // Consumers interested in the incoming traces
                  var consumers = [];
              Severity: Major
              Found in lib/traces.js - About 4 hrs to fix

                Function createOfflinetraces has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    offlinetraces.createOfflinetraces = function (activityId, username, req, res, kahoot) {
                        activityId = offlinetraces.toObjectID(activityId);
                        var nofileMessage = '';
                        var trackingCode = '';
                        // 1 - Check if anactivity exists for the given activityId
                Severity: Major
                Found in lib/offlinetraces.js - About 4 hrs to fix

                  Function getTarget has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                  var getTarget = function (statement, trace) {
                      var object = statement.object;
                      if (object) {
                          var objectId = object.id;
                          var index;
                  Severity: Minor
                  Found in lib/tracesConverter.js - About 4 hrs 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 exports has 102 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  module.exports = function (request, app, db) {
                  
                      var mongoController;
                  
                      /**-------------------------------------------------------------**/
                  Severity: Major
                  Found in test/upgraderTests/mongo/mongoController.js - About 4 hrs to fix

                    File classesTest.js has 334 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    /*
                     * Copyright 2016 e-UCM (http://www.e-ucm.es/)
                     *
                     * Licensed under the Apache License, Version 2.0 (the "License");
                     * you may not use this file except in compliance with the License.
                    Severity: Minor
                    Found in test/tests/classesTest.js - About 4 hrs to fix

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

                      module.exports = (function () {
                          var Collection = require('easy-collections');
                          var db = require('./db');
                          var utils = require('./utils');
                          var groups = require('./groups');
                      Severity: Minor
                      Found in lib/groupings.js - About 3 hrs 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 exports has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                      Open

                      module.exports = (function () {
                          var Q = require('q');
                          var authTokens = require('./auth-tokens');
                          var players = require('./players');
                          var dataSource = require('./traces');
                      Severity: Minor
                      Found in lib/collector.js - About 3 hrs 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 resolvePermissions has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      var resolvePermissions = function () {
                      
                          var documentObj = {};
                          var look = [];
                          var mgetObj = {
                      Severity: Major
                      Found in bin/permissions-recover.js - About 3 hrs to fix

                        Function kahootToCSV has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function kahootToCSV(file) {
                                try {
                                    var buf = fs.readFileSync(file);
                                    var wb = XLSX.read(buf, {type: 'buffer'});
                                    var sheets = wb.SheetNames;
                        Severity: Major
                        Found in lib/offlinetraces.js - About 3 hrs to fix

                          Function modifyClass has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              classes.modifyClass = function (classId, username, body, add) {
                                  var participants = {};
                                  if (!body.participants && body.students) {
                                      participants.students = body.students;
                                      delete body.students;
                          Severity: Major
                          Found in lib/classes.js - About 3 hrs to fix

                            File offlinetraces.js has 311 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            'use strict';
                            
                            module.exports = function () {
                            
                                var collector = require('./collector');
                            Severity: Minor
                            Found in lib/offlinetraces.js - About 3 hrs to fix

                              File elasticTransformerTo2.js has 310 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              /*
                               * Copyright 2016 e-UCM (http://www.e-ucm.es/)
                               *
                               * Licensed under the Apache License, Version 2.0 (the "License");
                               * you may not use this file except in compliance with the License.
                              Severity: Minor
                              Found in test/upgraderTests/elastic/elasticTransformerTo2.js - About 3 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language