Showing 590 of 590 total issues
Function compareFunction
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function compareFunction(fileIn, fileOut, idSession, searchObj, callback) {
var bodyOut = require(fileOut);
setTimeout(function () {
app.esClient.search(searchObj, function (err, response) {
Function exports
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (function () {
var Collection = require('easy-collections');
var lti = new Collection(require('./db'), 'lti');
lti.sort = {
Function openLRSConsumer
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
var openLRSConsumer = function (lrs) {
var Q = require('q');
var request = require('request');
var options = {
uri: lrs.uri + 'statements',
Function buildKibanaResources
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
kibana.buildKibanaResources = function (indexNames, config, esClient) {
var deferred = Q.defer();
console.log('kibana.buildKibanaResources -> Started!');
Function createActivity
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
activities.createActivity = function (gameId, versionId, classId, username, name, rootId, offline, allowAnonymous) {
return getGameVersionAndClass(gameId, versionId, classId).then(function (result) {
if (!name) {
name = 'new Activity';
}
Function getVisualizations
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
kibana.getVisualizations = function (user, gameId, esClient) {
var deferred = Q.defer();
esClient.search({
index: '.games' + gameId,
Function startTopology
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
startTopology: function (topologyName, analysisFolder, kafkaTopicName) {
var config = {
topologyName: topologyName,
kafkaTopicName: kafkaTopicName,
zookeeperURL: zookeeperUrl,
Function track
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
authTokens.track = function (authorization) {
var deferred = Q.defer();
var set = {
lastAccessed: new Date()
};
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (!group.participants.teachers || group.participants.teachers.indexOf(username) === -1) {
throw {
message: 'You don\'t have permission to modify this group.',
status: 401
};
- Read upRead up
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 57.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (!groupRes.participants.teachers || groupRes.participants.teachers.indexOf(username) === -1) {
throw {
message: 'You don\'t have permission to delete this groups.',
status: 401
};
- Read upRead up
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 57.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function setUpKibanaIndex
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function* setUpKibanaIndex(esClient) {
if (!indices.configs.kibana) {
return;
}
- Read upRead up
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 parseExtensions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
var parseExtensions = function (result, container) {
var extensions = result.extensions;
if (extensions) {
container.ext = {};
for (var key in extensions) {
- Read upRead up
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 createGroup
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
groups.createGroup = function (username, classId, group) {
if (group.participants) {
if (!group.participants.teachers) {
group.participants.teachers = [];
Function parseCSV
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
var parseCSV = function (trace) {
trace = trace.replace('\r', '');
var list = [];
var escape = false;
Function checkDiffs
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function* checkDiffs(hits) {
if (hits.length === 1) {
return;
}
while (hits.length > 0) {
Function resolveParticipants
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
var resolveParticipants = function (groupsObj, groupingsObj, classId, callback) {
var deferred = Q.defer();
var participants = {students: [], teachers: [], assistants: []};
if (groupingsObj.length > 0) {
Function startActivity
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
activities.startActivity = function (activityId) {
return activities.findById(activityId).then(function (activity) {
if (!activity) {
throw {
message: 'Activity does not exist',
Function deleteUserData
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
activities.deleteUserData = function (defaultConfig, activityId, userData, esClient) {
return activities.findById(activityId, true).then(function(result) {
if (!result) {
throw {
message: 'Activity not found',
Similar blocks of code found in 2 locations. Consider refactoring. Open
return activities.createActivity(req.body.gameId, req.body.versionId, req.body.classId,
username, req.body.name, undefined, req.body.offline, allowAnonymous);
- Read upRead up
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 56.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
for (let i = 0; i < indices.games.length; i++) {
let gameIndex = indices.games[i];
yield upgradeGameIndex(esClient, gameIndex);
}
- Read upRead up
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 56.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76