Showing 16 of 21 total issues
Function run
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
run: (bot, message, cmdArgs) => {
if (!cmdArgs) {
const langList = availableLanguages.reduce((prev, x) => {
let langEntry = `${prev}${prev ? '\n' : ''}- ${x}`;
const aliases = Object.keys(langAliases)
Function getWeatherData
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getWeatherData(location) {
const requestURL = darkskyEndpoint
.replace('key', tokens.darksky)
.replace('lat', location.coordinate.lat)
.replace('lng', location.coordinate.lng);
Function run
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
run: (bot, message, cmdArgs) => {
if (!cmdArgs) {
const langList = availableLanguages.reduce((prev, x) => {
let langEntry = `${prev}${prev ? '\n' : ''}- ${x}`;
const aliases = Object.keys(langAliases)
- 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 run
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
run(bot, message, cmdArgs) {
if (!cmdArgs) {
return true;
}
Function run
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
run: (bot, message, cmdArgs) => {
let pbfLink = false;
if (cmdArgs === 'random') {
pbfLink = 'http://pbfcomics.com/random';
Function onMessage
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
onMessage() {
return (message) => {
// don't respond to own messages
if (this.client.user.username === message.author.username) {
return;
Function processVote
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function processVote(type, bot, message, guild, member) {
let voting = currentVotes[type][member.user.username];
if (!voting) {
// sets a timeout for this voting
Function handleCreateStream
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
create: function handleCreateStream(bot, message, args) {
let [, topic, link, user] = args.split(' '); // eslint-disable-line prefer-const
if (!topic || !link) {
return message.channel.sendMessage('err, please provide topic and link!');
Function run
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
run(bot, message, cmdArgs) {
if (!cmdArgs) {
return true;
}
- 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 setTopicToLink
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function setTopicToLink(channel, link, bot, topic, user) {
Function processVote
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function processVote(type, bot, message, guild, member) {
Function createChannel
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function createChannel(title, bot, message, topic, user) {
Function handleCreateStream
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
create: function handleCreateStream(bot, message, args) {
let [, topic, link, user] = args.split(' '); // eslint-disable-line prefer-const
if (!topic || !link) {
return message.channel.sendMessage('err, please provide topic and link!');
- 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 false;
Avoid too many return
statements within this function. Open
return false;
Function infoRun
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function infoRun(bot, message, cmdArgs) {
if (cmdArgs) {
if (cmdArgs === 'contributors') {
const contributorsEmbed = new discord.RichEmbed();
contributorsEmbed.setColor('#4286f4')
- 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"