e-ucm/rage-analytics-backend

View on GitHub

Showing 590 of 590 total issues

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

    {
        id: 4000,
        type: 'traces',
        source: {
            name: 'name',
Severity: Major
Found in test/upgraderTests/elastic/upgradeInputs/tracesTo2IN.js and 3 other locations - About 40 mins to fix
test/upgraderTests/elastic/upgradeInputs/tracesTo2IN.js on lines 4..15
test/upgraderTests/elastic/upgradeInputs/tracesTo2IN.js on lines 32..43
test/upgraderTests/elastic/upgradeOutputs/tracesTo2OUTtest.js on lines 4..15

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

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

    activities.getClassActivities = function (classId) {
        classId = activities.toObjectID(classId);
        return activities.find({classId: classId});
    };
Severity: Minor
Found in lib/activities.js and 1 other location - About 40 mins to fix
lib/lti.js on lines 14..17

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

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 3 locations. Consider refactoring.
Open

        afterEach(function (done) {
            db.collection('games').drop(
                db.collection('activities').drop(
                    done
                )
Severity: Minor
Found in test/tests/gamesTest.js and 2 other locations - About 40 mins to fix
test/tests/coursesTest.js on lines 36..38
test/tests/groupsTest.js on lines 72..74

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

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 3 locations. Consider refactoring.
Open

                    request.get('/api/activities/' + idActivity + '/attempts')
                        .expect(200)
                        .set('X-Gleaner-User', 'Teacher1')
                        .expect('Content-Type', /json/)
                        .end(function (err, res) {
Severity: Minor
Found in test/tests/attemptsTest.js and 2 other locations - About 40 mins to fix
test/tests/versionsTest.js on lines 66..74
test/tests/versionsTest.js on lines 79..88

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

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

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

        if (!error && response.hits.hits[0]) {
            fieldsObj = response.hits.hits[0]._source;
        }
Severity: Minor
Found in routes/kibana.js and 1 other location - About 40 mins to fix
lib/games.js on lines 250..252

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

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

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

                if (!error && response.hits.hits[0]) {
                    fieldsObj = response.hits.hits[0]._source;
                }
Severity: Minor
Found in lib/games.js and 1 other location - About 40 mins to fix
routes/kibana.js on lines 365..367

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

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 3 locations. Consider refactoring.
Open

            request.get('/api/games/' + idGame + '/versions')
                .expect(200)
                .set('Accept', 'application/json')
                .expect('Content-Type', /json/)
                .end(function (err, res) {
Severity: Minor
Found in test/tests/versionsTest.js and 2 other locations - About 40 mins to fix
test/tests/attemptsTest.js on lines 217..227
test/tests/versionsTest.js on lines 66..74

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

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

            }).then(function () {
                return activities.removeById(activityId).then(function (result, err) {
                    if (!err) {
                        return {
                            message: 'Success.'
Severity: Minor
Found in lib/activities.js and 1 other location - About 40 mins to fix
lib/lti.js on lines 41..49

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

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

    {
        id: 1000,
        type: 'traces',
        source: {
            name: 'name',
Severity: Major
Found in test/upgraderTests/elastic/upgradeOutputs/tracesTo2OUTtest.js and 3 other locations - About 40 mins to fix
test/upgraderTests/elastic/upgradeInputs/tracesTo2IN.js on lines 4..15
test/upgraderTests/elastic/upgradeInputs/tracesTo2IN.js on lines 32..43
test/upgraderTests/elastic/upgradeInputs/tracesTo2IN.js on lines 44..55

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

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

    {
        id: 1000,
        type: 'traces',
        source: {
            name: 'name',
Severity: Major
Found in test/upgraderTests/elastic/upgradeInputs/tracesTo2IN.js and 3 other locations - About 40 mins to fix
test/upgraderTests/elastic/upgradeInputs/tracesTo2IN.js on lines 32..43
test/upgraderTests/elastic/upgradeInputs/tracesTo2IN.js on lines 44..55
test/upgraderTests/elastic/upgradeOutputs/tracesTo2OUTtest.js on lines 4..15

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

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

    {
        id: 3000,
        type: 'traces',
        source: {
            name: 'name',
Severity: Major
Found in test/upgraderTests/elastic/upgradeInputs/tracesTo2IN.js and 3 other locations - About 40 mins to fix
test/upgraderTests/elastic/upgradeInputs/tracesTo2IN.js on lines 4..15
test/upgraderTests/elastic/upgradeInputs/tracesTo2IN.js on lines 44..55
test/upgraderTests/elastic/upgradeOutputs/tracesTo2OUTtest.js on lines 4..15

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

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 3 locations. Consider refactoring.
Open

        after(function (done) {
            db.collection('classes').drop(db.collection('groups').drop(done));
        });
Severity: Minor
Found in test/tests/groupsTest.js and 2 other locations - About 40 mins to fix
test/tests/coursesTest.js on lines 36..38
test/tests/gamesTest.js on lines 67..73

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

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 bulkFunction has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    function bulkFunction(fileIn, fileOut, index, searchObj, callback) {
Severity: Minor
Found in test/upgraderTests/elastic/elasticTransformerTo2.js - About 35 mins to fix

    Function collectionComparer has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        collectionComparer: function (db, name, data, callback, ignoredFields) {
    Severity: Minor
    Found in test/upgraderTests/upgraderTestUtils.js - About 35 mins to fix

      Function checkEmptyDB has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          function checkEmptyDB(fileIn, fileOut, idSession, searchObj, callback) {
      Severity: Minor
      Found in test/upgraderTests/elastic/elasticTransformerTo2.js - About 35 mins to fix

        Function transformFunction has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            function transformFunction(fileIn, fileOut, idSession, searchObj, callback) {
        Severity: Minor
        Found in test/upgraderTests/elastic/elasticTransformerTo2.js - About 35 mins to fix

          Function generateTracesAndBulk has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              function generateTracesAndBulk(num, nTraces, index, sameIndex, callback) {
          Severity: Minor
          Found in test/upgraderTests/elastic/elasticTransformerTo2.js - About 35 mins to fix

            Function updateSessionClassId has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function updateSessionClassId(sessionsColection, sessionItem, classes, config, callback) {
            Severity: Minor
            Found in bin/upgrade/transformers/mongo/transformToVersion2.js - About 35 mins to fix

              Function getUserTypeForArray has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  groups.getUserTypeForArray = function (groupIds, username, ignoreStudents, ignoreAssistants, ignoreTeachers) {
              Severity: Minor
              Found in lib/groups.js - About 35 mins to fix

                Function compareFunction has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    function compareFunction(fileIn, fileOut, idSession, searchObj, callback) {
                Severity: Minor
                Found in test/upgraderTests/elastic/elasticTransformerTo2.js - About 35 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language