Showing 67 of 92 total issues
Avoid deeply nested control flow statements. Open
if (!track[inherits].wild[cnt]) {
track[inherits].wild[cnt] = [];
}
Avoid deeply nested control flow statements. Open
if (!track[inherits].atomic[cnt]) {
track[inherits].atomic[cnt] = [];
}
Avoid deeply nested control flow statements. Open
if (!track[inherits].option[cnt]) {
track[inherits].option[cnt] = [];
}
Function receiveData
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const receiveData = function receiveData(slack, bot, data) {
// Fetch the user who sent the message;
const user = data._client.users[data.user];
let channel;
const messageData = data.toJSON();
- 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 createUserModel
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const createUserModel = function createUserModel(db, factSystem, logger) {
const userSchema = mongoose.Schema({
id: String,
currentTopic: { type: String, default: 'random' },
pendingTopic: String,
- 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
Avoid deeply nested control flow statements. Open
if (num > 0 && num <= 26) {
reply = `It is ${alpha[num - 1].toUpperCase()}`;
} else {
reply = 'seriously...';
}
Function topicRedirect
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const topicRedirect = async function topicRedirect(topicName, topicTrigger, options) {
debug.verbose(`Topic redirection to topic: ${topicName}, trigger: ${topicTrigger}`);
// Here we are looking for gambits in the NEW topic.
// TODO: Deprecate this behaviour: a failed topic lookup should fail the whole reply
- 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 importData
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const importData = function importData(chatSystem, data, callback) {
if (!data.version || data.version < MIN_SUPPORTED_SCRIPT_VERSION) {
return callback(`Error: Your script has version ${data.version} but the minimum supported version is ${MIN_SUPPORTED_SCRIPT_VERSION}.\nPlease either re-parse your file with a supported parser version, or update SuperScript.`);
}
- 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
Avoid too many return
statements within this function. Open
return processCustomFunction(tag, replyObj, options);
Avoid too many return
statements within this function. Open
return processNewTopic(tag, replyObj, options);
Avoid too many return
statements within this function. Open
return processEndSearching(tag, replyObj, options);
Avoid too many return
statements within this function. Open
return callback(null, bot);
Avoid too many return
statements within this function. Open
return processContinueSearching(tag, replyObj, options);
Avoid too many return
statements within this function. Open
return processAlternates(tag, replyObj, options);
Avoid too many return
statements within this function. Open
return processStars(match, gambit, topic);
Avoid too many return
statements within this function. Open
return pendingTopics;
Avoid too many return
statements within this function. Open
return processWordnetLookup(tag, replyObj, options);
Avoid too many return
statements within this function. Open
return processSetState(tag, replyObj, options);
Avoid too many return
statements within this function. Open
return processClearConversation(tag, replyObj, options);
Avoid too many return
statements within this function. Open
return processDelay(tag, replyObj, options);