e-ucm/rage-analytics-backend

View on GitHub

Showing 590 of 590 total issues

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

        it('should GET groupings', function (done) {
            request.get('/api/classes/' + idClass + '/groupings')
                .expect(200)
                .set('X-Gleaner-User', 'teacher')
                .end(function (err, res) {
Severity: Major
Found in test/tests/groupingsTest.js and 1 other location - About 6 hrs to fix
test/tests/groupsTest.js on lines 101..112

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

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

        it('should GET groups', function (done) {
            request.get('/api/classes/' + idClass + '/groups')
                .expect(200)
                .set('X-Gleaner-User', 'teacher')
                .end(function (err, res) {
Severity: Major
Found in test/tests/groupsTest.js and 1 other location - About 6 hrs to fix
test/tests/groupingsTest.js on lines 105..116

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

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

module.exports = function (request, db) {

    /**-------------------------------------------------------------**/
    /**-------------------------------------------------------------**/
    /**                   Test Courses  API                         **/
Severity: Major
Found in test/tests/coursesTest.js - About 6 hrs to fix

    File kibana.js has 439 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    
    var express = require('express'),
        router = express.Router(),
        restUtils = require('./rest-utils'),
    Severity: Minor
    Found in routes/kibana.js - About 6 hrs to fix

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

              it('should not POST a new analysis when the activity does not exist', function (done) {
      
                  request.post('/api/offlinetraces/' + idActivityNotFound)
                      .expect(400)
                      .set('Accept', 'application/json')
      Severity: Major
      Found in test/tests/offlinetracesTest.js and 1 other location - About 6 hrs to fix
      test/tests/offlinetracesTest.js on lines 175..194

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

      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

              it('should not POST a new analysis when the activity is not of type offline', function (done) {
      
                  request.post('/api/offlinetraces/' + idActivity)
                      .expect(400)
                      .set('Accept', 'application/json')
      Severity: Major
      Found in test/tests/offlinetracesTest.js and 1 other location - About 6 hrs to fix
      test/tests/offlinetracesTest.js on lines 153..172

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

      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

                          return activities.find({classId: groupingRes.classId})
                              .then(function (activitiesRes) {
                                  if (activitiesRes.length > 0) {
                                      activitiesRes.forEach(function(activityObj) {
                                          var updateGroupings = {};
      Severity: Major
      Found in lib/groupings.js and 1 other location - About 6 hrs to fix
      lib/groups.js on lines 223..241

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

      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

                                  return groupings.find({classId: groupRes.classId})
                                      .then(function (groupingsRes) {
                                          if (groupingsRes.length > 0) {
                                              groupingsRes.forEach(function (classObj) {
                                                  var updateGroups = {};
      Severity: Major
      Found in lib/groups.js and 1 other location - About 6 hrs to fix
      lib/groupings.js on lines 181..199

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

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

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

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

        module.exports = (function () {
            var Q = require('q');
            var Collection = require('easy-collections');
            var gameplays = {};
        
        
        Severity: Major
        Found in lib/gameplays.js - About 6 hrs to fix

          Function toStatement has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
          Open

          var toStatement = function (statement, trace) {
          
              var parts = parseCSV(trace);
          
              var username = parts[0];
          Severity: Minor
          Found in lib/csvToXAPI.js - About 5 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 145 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function (app, esClient, mongo) {
          
              /**-------------------------------------------------------------**/
              /**-------------------------------------------------------------**/
              /**              Test Elastic Controller                        **/
          Severity: Major
          Found in test/upgraderTests/elastic/elasticController.js - About 5 hrs to fix

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

                    return classes.findById(classId).then(function (classObj) {
                        if (!classObj) {
                            throw {
                                message: 'Class does not exist',
                                status: 404
            Severity: Major
            Found in lib/groupings.js and 1 other location - About 5 hrs to fix
            lib/groups.js on lines 113..131

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

            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

                    return classes.findById(classId).then(function (classObj) {
                        if (!classObj) {
                            throw {
                                message: 'Class does not exist',
                                status: 404
            Severity: Major
            Found in lib/groups.js and 1 other location - About 5 hrs to fix
            lib/groupings.js on lines 88..106

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

            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

                    it('should detect version 1 without classes collection', function (done) {
                        var inData = require('./upgradeInputs/exampleControllerV1');
                        insert(inData, function() {
            
                            mongoController.refresh(function (err, status) {
            Severity: Major
            Found in test/upgraderTests/mongo/mongoController.js and 1 other location - About 5 hrs to fix
            test/upgraderTests/mongo/mongoController.js on lines 127..147

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

            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

                    it('should detect version 2 with a correct classes collection', function (done) {
                        var inData = require('./upgradeInputs/exampleControllerV2');
                        insert(inData, function() {
            
                            mongoController.refresh(function (err, status) {
            Severity: Major
            Found in test/upgraderTests/mongo/mongoController.js and 1 other location - About 5 hrs to fix
            test/upgraderTests/mongo/mongoController.js on lines 104..124

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

            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 exports has 137 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/mongoTransformerTo4.js - About 5 hrs to fix

              Function exports has 137 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/mongoTransformerTo2.js - About 5 hrs to fix

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

                        it('should GET my classes', function (done) {
                            request.get('/api/classes/my')
                                .expect(200)
                                .set('X-Gleaner-User', 'Teacher1')
                                .end(function (err, res) {
                Severity: Major
                Found in test/tests/classesTest.js and 3 other locations - About 5 hrs to fix
                test/tests/activitiesTest.js on lines 188..199
                test/tests/classesTest.js on lines 201..212
                test/tests/coursesTest.js on lines 72..83

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

                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

                        it('should GET courses', function (done) {
                            request.get('/api/courses')
                                .expect(200)
                                .set('X-Gleaner-User', 'teacher')
                                .end(function (err, res) {
                Severity: Major
                Found in test/tests/coursesTest.js and 3 other locations - About 5 hrs to fix
                test/tests/activitiesTest.js on lines 188..199
                test/tests/classesTest.js on lines 201..212
                test/tests/classesTest.js on lines 214..225

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

                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