e-ucm/rage-analytics-frontend

View on GitHub

Showing 27 of 143 total issues

File kibana.js has 610 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: Major
Found in app/public/js/controllers/kibana.js - About 1 day to fix

    File activity.js has 510 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: Major
    Found in app/public/js/controllers/activity.js - About 1 day to fix

      Function getTempleateVisualizations has 112 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              $scope.getTempleateVisualizations = function () {
                  if ($scope.game && $scope.version) {
      
                      $http.get(CONSTANTS.PROXY + '/kibana/templates/index/' + $scope.game._id)
                          .success(function (data) {
      Severity: Major
      Found in app/public/js/controllers/kibana.js - About 4 hrs to fix

        File participantsConf.js has 352 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 app/public/js/controllers/participantsConf.js - About 4 hrs to fix

          Function getStatements has 111 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      $scope.getStatements = function () {
                          $http.get(CONSTANTS.PROXY + '/games/statements').success(function (data) {
          
                              var dash = new ADL.XAPIDashboard();
                              dash.addStatements(data.statements);
          Severity: Major
          Found in app/public/js/controllers/analytics.js - About 4 hrs to fix

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

                    $scope.submitTemplateVisualization = function () {
                        $scope.templateVisualization.contents = JSON.parse($scope.templateVisualization.contents);
                        if ($scope.templateVisualization.contents) {
                            var isDevVis = $scope.templateVisualization.contents.isDeveloper;
                            var isTchVis = $scope.templateVisualization.contents.isTeacher;
            Severity: Major
            Found in app/public/js/controllers/kibana.js - About 3 hrs to fix

              Function exports has 80 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 3 hrs to fix

                Function selectVisualization has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        $scope.selectVisualization = function (usr, visualizationId) {
                            $scope.waitOperation = true;
                            var checkboxList;
                            var listVisualizations;
                            var obj = {};
                Severity: Major
                Found in app/public/js/controllers/kibana.js - About 2 hrs to fix

                  Function generateTestVisualization has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          $scope.generateTestVisualization = function () {
                              var panels = [];
                              var uiStates = {};
                  
                              // Add index
                  Severity: Major
                  Found in app/public/js/controllers/kibana.js - About 2 hrs to fix

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

                    module.exports = function (grunt) {
                    
                        // Code adapted from http://stackoverflow.com/a/18402335/15472
                        grunt.registerTask('default', function () {
                    
                    
                    Severity: Minor
                    Found in Gruntfile.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 addTemplateVisualization has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            $scope.addTemplateVisualization = function () {
                                var visualization = JSON.parse(document.getElementById('exampleVisualization').value);
                                if (visualization) {
                                    $http.post(CONSTANTS.PROXY + '/kibana/templates/visualization/author/' + $scope.username, visualization)
                                        .success(function (visualizationData) {
                    Severity: Major
                    Found in app/public/js/controllers/kibana.js - About 2 hrs to fix

                      File app.js has 255 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 app/public/js/controllers/app.js - About 2 hrs to fix

                        Function onSetActivity has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                    var onSetActivity = function () {
                                        Classes.get({classId: $scope.activity.classId}).$promise.then(function (c) {
                                            classReady = true;
                                            $scope.class = c;
                                            if ($scope.activity.groupings && $scope.activity.groupings.length > 0) {
                        Severity: Minor
                        Found in app/public/js/controllers/activity.js - About 1 hr to fix

                          Function acceptCourseClass has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                      $scope.acceptCourseClass = function (classObj) {
                                          var courseId = $scope.courseId.id;
                                          if (courseId === 'NEW') {
                                              if ($scope.newCourse.newName) {
                                                  $http.post(CONSTANTS.PROXY + '/courses', {title: $scope.newCourse.newName})
                          Severity: Minor
                          Found in app/public/js/controllers/class-list.js - About 1 hr to fix

                            Function createConfig has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    createConfig: ['appPrefix', function (done, results) {
                            
                                        var fsOptions = {
                                            encoding: 'utf-8'
                                        };
                            Severity: Minor
                            Found in bin/setup.js - About 1 hr to fix

                              Function setProgress has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              ColumnProgress.prototype.setProgress = function (progress) {
                                  this.progressRectangle
                                      .attr('height', this.height * progress)
                                      .attr('y', this.y + this.height - (this.height * progress));
                              
                              
                              Severity: Minor
                              Found in app/public/js/ui.js - About 1 hr to fix

                                Function transformRequest has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                                transformRequest: function (data, headersGetter) {
                                                    if (data._id !== undefined) {
                                                        delete data._id;
                                                    }
                                                    if (data.classId !== undefined) {
                                Severity: Minor
                                Found in app/public/js/services.js - About 1 hr to fix

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

                                          $scope.selectField = function (visualizationField, newField) {
                                              $scope.dataWithField[visualizationField] = newField;
                                              $scope.selectedVisualizationDevList.forEach(function (visualization) {
                                                  $http.post(CONSTANTS.PROXY + '/kibana/visualization/game/' + $scope.game._id + '/' + visualization.id, $scope.dataWithField)
                                                      .success(function () {
                                  Severity: Minor
                                  Found in app/public/js/controllers/kibana.js - About 1 hr to fix

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

                                                var dashboardLink = function (userName, attempt) {
                                                    var url = CONSTANTS.KIBANA + '/app/kibana#/dashboard/dashboard_' +
                                                        $scope.activity._id + '?embed=true_g=(refreshInterval:(display:\'5%20seconds\',' +
                                                        'pause:!f,section:1,value:5000),time:(from:now-1h,mode:quick,to:now))';
                                                    if (url.startsWith('localhost')) {
                                    Severity: Minor
                                    Found in app/public/js/controllers/activity.js - About 1 hr to fix

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

                                                  $ctrl.modifyGroup = function (usr, role, toAdd) {
                                                      if ($ctrl.selectedGroup) {
                                                          var route;
                                                          if (toAdd) {
                                                              route = CONSTANTS.PROXY + '/classes/groups/' + $ctrl.selectedGroup._id;
                                      Severity: Minor
                                      Found in app/public/js/controllers/participantsConf.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language