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

    groups.getGroups = function (classId) {
        return groups.find({classId: groups.toObjectID(classId)});
    };
Severity: Minor
Found in lib/groups.js and 1 other location - About 35 mins to fix
lib/groupings.js on lines 61..63

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

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

                    if (add && body.name) {
                        update.$set = {};
                        update.$set.name = body.name;
                    }
Severity: Minor
Found in lib/groupings.js and 2 other locations - About 35 mins to fix
lib/courses.js on lines 111..114
lib/groups.js on lines 178..181

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

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

    groupings.getGroupings = function (classId) {
        return groupings.find({classId: groupings.toObjectID(classId)});
    };
Severity: Minor
Found in lib/groupings.js and 1 other location - About 35 mins to fix
lib/groups.js on lines 81..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 46.

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

                                                {
                                                    _id: idClass,
                                                    groups: [],
                                                    groupings: [],
                                                    participants: {
Severity: Minor
Found in test/tests/offlinetracesTest.js and 1 other location - About 35 mins to fix
test/tests/activitiesTest.js on lines 66..75

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

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

    co(function* () {

            let esClient = config.elasticsearch.esClient;
            yield at(esClient.indices.refresh({index: '_all'}));

Severity: Major
Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 4 other locations - About 35 mins to fix
bin/upgrade/transformers/elastic/transformToVersion2.js on lines 326..384
bin/upgrade/transformers/elastic/transformToVersion2.js on lines 911..955
bin/upgrade/transformers/elastic/transformToVersion2.js on lines 1108..1159
bin/upgrade/transformers/elastic/transformToVersion2.js on lines 1178..1207

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

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

    co(function* () {

        let esClient = config.elasticsearch.esClient;
        yield at(esClient.indices.refresh({index: '_all'}));

Severity: Major
Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 4 other locations - About 35 mins to fix
bin/upgrade/transformers/elastic/transformToVersion2.js on lines 326..384
bin/upgrade/transformers/elastic/transformToVersion2.js on lines 911..955
bin/upgrade/transformers/elastic/transformToVersion2.js on lines 1031..1102
bin/upgrade/transformers/elastic/transformToVersion2.js on lines 1178..1207

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

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

    co(function* () {


        let esClient = config.elasticsearch.esClient;
        yield at(esClient.indices.refresh({index: '_all'}));
Severity: Major
Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 4 other locations - About 35 mins to fix
bin/upgrade/transformers/elastic/transformToVersion2.js on lines 326..384
bin/upgrade/transformers/elastic/transformToVersion2.js on lines 1031..1102
bin/upgrade/transformers/elastic/transformToVersion2.js on lines 1108..1159
bin/upgrade/transformers/elastic/transformToVersion2.js on lines 1178..1207

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

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

                                                {
                                                    _id: idClass,
                                                    groups: [],
                                                    groupings: [],
                                                    participants: {
Severity: Minor
Found in test/tests/activitiesTest.js and 1 other location - About 35 mins to fix
test/tests/offlinetracesTest.js on lines 70..79

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

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

Avoid too many return statements within this function.
Open

        return extensions.indexOf(i) !== -1;
Severity: Major
Found in bin/upgrade/transformers/elastic/transformToVersion2.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                            return;
    Severity: Major
    Found in test/upgraderTests/upgraderTestUtils.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return equal;
      Severity: Major
      Found in test/upgraderTests/upgraderTestUtils.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        return logError('Controllers are pending, but no transforms are possible (system locked)!',
                            status, callback);
        Severity: Major
        Found in bin/upgrade/upgrader.js - About 30 mins to fix

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

                  if (bulkUpgradedTraces.length > 0) {
                      yield at(esClient.bulk({body: bulkUpgradedTraces}));
                      upgraded = true;
                  }
          Severity: Major
          Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 3 other locations - About 30 mins to fix
          bin/upgrade/transformers/elastic/transformToVersion2.js on lines 581..584
          bin/upgrade/transformers/elastic/transformToVersion2.js on lines 729..732
          bin/upgrade/transformers/elastic/transformToVersion2.js on lines 867..870

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

          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

          Avoid too many return statements within this function.
          Open

                  return config.a2.a2ApiPath + 'proxy/' + config.a2.a2Prefix + '/games/' + version.gameId + '/' + version._id;
          Severity: Major
          Found in lib/collector.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                                    return {
                                        error: 'No response cell (D' + playerId + ') value found on sheet ' + question
                                    };
            Severity: Major
            Found in lib/offlinetraces.js - About 30 mins to fix

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

                      if (bulkUpgradedTraces.length > 0) {
                          yield at(esClient.bulk({body: bulkUpgradedTraces}));
                          upgraded = true;
                      }
              Severity: Major
              Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 3 other locations - About 30 mins to fix
              bin/upgrade/transformers/elastic/transformToVersion2.js on lines 581..584
              bin/upgrade/transformers/elastic/transformToVersion2.js on lines 729..732
              bin/upgrade/transformers/elastic/transformToVersion2.js on lines 836..839

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

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

                      if (bulkUpgradedTraces.length > 0) {
                          yield at(esClient.bulk({body: bulkUpgradedTraces}));
                          upgraded = true;
                      }
              Severity: Major
              Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 3 other locations - About 30 mins to fix
              bin/upgrade/transformers/elastic/transformToVersion2.js on lines 729..732
              bin/upgrade/transformers/elastic/transformToVersion2.js on lines 836..839
              bin/upgrade/transformers/elastic/transformToVersion2.js on lines 867..870

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

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

                      if (bulkUpgradedTraces.length > 0) {
                          yield at(esClient.bulk({body: bulkUpgradedTraces}));
                          upgraded = true;
                      }
              Severity: Major
              Found in bin/upgrade/transformers/elastic/transformToVersion2.js and 3 other locations - About 30 mins to fix
              bin/upgrade/transformers/elastic/transformToVersion2.js on lines 581..584
              bin/upgrade/transformers/elastic/transformToVersion2.js on lines 836..839
              bin/upgrade/transformers/elastic/transformToVersion2.js on lines 867..870

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

              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

              Avoid too many return statements within this function.
              Open

                          return csvtraces;
              Severity: Major
              Found in lib/offlinetraces.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                        return {
                                            error: 'No score cell (G' + playerId + ') value found on sheet ' + question
                                        };
                Severity: Major
                Found in lib/offlinetraces.js - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language