e-ucm/rage-analytics-backend

View on GitHub

Showing 244 of 590 total issues

Function storm has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var storm = function (stormConfig, zookeeperUrl, kafkaUrl) {

    var genYMLAndLaunch = function (src, ymlPath, stormJar, config) {
        var deferred = Q.defer();

Severity: Major
Found in lib/services/storm.js - About 3 hrs to fix

    Function kafkaService has 83 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var kafkaService = function (clientUri) {
        var cl;
        var pr;
        var co;
    
    
    Severity: Major
    Found in lib/services/kafka.js - About 3 hrs to fix

      File transformToVersion4.js has 304 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 bin/upgrade/transformers/mongo/transformToVersion4.js - About 3 hrs to fix

        Function upgradeAttempts has 82 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function upgradeAttempts(config, callback) {
            // Transformers
            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 3 hrs to fix

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

          module.exports = function (request, db, config) {
          
              /**-------------------------------------------------------------**/
              /**-------------------------------------------------------------**/
              /**                   Test Tracker                              **/
          Severity: Minor
          Found in test/tests/collectorTest.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 23 (exceeds 5 allowed). Consider refactoring.
          Open

          module.exports = (function () {
              var Q = require('q');
              var tracesConverter = require('./tracesConverter');
              // Consumers interested in the incoming traces
              var consumers = [];
          Severity: Minor
          Found in lib/traces.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 81 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function(request, db) {
          
              /**-------------------------------------------------------------**/
              /**-------------------------------------------------------------**/
              /**                   Test Versions API                         **/
          Severity: Major
          Found in test/tests/versionsTest.js - About 3 hrs to fix

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

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

              Function identifyExtensionsFromIndex has 77 lines of code (exceeds 25 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: Major
              Found in bin/upgrade/transformers/elastic/transformToVersion2.js - About 3 hrs to fix

                Function upgradeGameIndex has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function* upgradeGameIndex(esClient, gameIndex) {
                
                    let totalSessionsVis = yield at(esClient.get({
                        index: gameIndex.index,
                        type: 'visualization',
                Severity: Major
                Found in bin/upgrade/transformers/elastic/transformToVersion2.js - About 3 hrs to fix

                  Function compareDocuments has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  var compareDocuments = function (doc1, doc2, ignoredFields) {
                      if (ignoredFields === undefined || ignoredFields === null) {
                          ignoredFields = ['uuidv4'];
                      }
                  
                  
                  Severity: Major
                  Found in test/upgraderTests/upgraderTestUtils.js - About 2 hrs to fix

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

                    module.exports = function (grunt) {
                    
                        // Code adapted from http://stackoverflow.com/a/18402335/15472
                        grunt.registerTask('default', function () {
                    
                    
                    Severity: Major
                    Found in Gruntfile.js - About 2 hrs to fix

                      File activitiesTest.js has 286 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/activitiesTest.js - About 2 hrs to fix

                        Function guessModelVersion has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        MongoController.prototype.guessModelVersion = function(db, callback) {
                        
                            console.log('Starting to guess mongo model version!');
                            var minVersion = '1';
                            db.db.collections(function (error, collections) {
                        Severity: Major
                        Found in bin/upgrade/controllers/upgrade-mongo-collections.js - About 2 hrs to fix

                          Function checkGameplay has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              var checkGameplay = function(gameplay, callback) {
                                  // Check new player fields
                                  var err = null;
                                  if (!gameplay.playerName) {
                                      err = 'A gameplay does not contain its player name.';
                          Severity: Major
                          Found in bin/upgrade/transformers/mongo/transformToVersion4.js - About 2 hrs to fix

                            Function roll has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function roll(callback) {
                            
                                var refreshes = {};
                                for (var key in controllers) {
                                    var controller = controllers[key];
                            Severity: Major
                            Found in bin/upgrade/upgrader.js - About 2 hrs to fix

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

                              module.exports = (function () {
                                  var Q = require('q');
                                  var Collection = require('easy-collections');
                                  var db = require('./db');
                                  var games = new Collection(db, 'games');
                              Severity: Minor
                              Found in lib/games.js - About 2 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 buildXAPIProfile has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                              Open

                              var buildXAPIProfile = function (statement, trace) {
                                  var eventError = getEvent(statement, trace);
                                  if (eventError) {
                                      return eventError;
                                  }
                              Severity: Minor
                              Found in lib/tracesConverter.js - About 2 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

                              File groups.js has 274 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

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

                                Function start has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        start: function (body, trackingCode, authorization, username) {
                                            // First we look for the activity
                                            return activities.find({
                                                trackingCode: trackingCode
                                            }, true).then(function (activity) {
                                Severity: Major
                                Found in lib/collector.js - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language