SockDrawer/SockBot

View on GitHub

Showing 31 of 31 total issues

Function bindCommands has 362 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.bindCommands = function bindCommands(forum) {
/**
* Command Handlers
*
* @default
Severity: Major
Found in lib/commands.js - About 1 day to fix

Function bindChat has 177 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.bindChat = function bindChat(forum) {
 
/**
* Send a message to the chatroom
*
Severity: Major
Found in providers/nodebb/chat.js - About 7 hrs to fix

Function bindTopic has 173 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.bindTopic = function bindTopic(forum) {
/**
* Topic Class
*
* Represends a forum topic
Severity: Major
Found in providers/nodebb/topic.js - About 6 hrs to fix

Function bindNotification has 172 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.bindNotification = function bindNotification(forum) {
 
const mentionTester = new RegExp(`(^|\\s)@${forum.username}(\\s|$)`, 'i');
 
/**
Severity: Major
Found in providers/nodebb/notification.js - About 6 hrs to fix

Function bindCommands has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

exports.bindCommands = function bindCommands(forum) {
/**
* Command Handlers
*
* @default
Severity: Minor
Found in lib/commands.js - About 6 hrs to fix

File commands.js has 370 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';
/**
* NodeBB provider module User class
* @module sockbot.lib.commands
* @author Accalia
Severity: Minor
Found in lib/commands.js - About 4 hrs to fix

Function bindPost has 119 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.bindPost = function bindPost(forum) {
/**
* Post Class
*
* Represents a forum post
Severity: Major
Found in providers/nodebb/post.js - About 4 hrs to fix

Function bindCategory has 114 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.bindCategory = function bindCategory(forum) {
/**
* Topic Processor
*
* @typedef {TopicProcesspr}
Severity: Major
Found in providers/nodebb/category.js - About 4 hrs to fix

Function bindUser has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.bindUser = function bindUser(forum) {
/**
* User Class
*
* Represents a forum user
Severity: Major
Found in providers/nodebb/user.js - About 3 hrs to fix

File index.js has 273 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';
/**
* NodeBB provider module
* @module sockbot.providers.nodebb
* @author Accalia
Severity: Minor
Found in providers/nodebb/index.js - About 2 hrs to fix

Forum has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class Forum extends EventEmitter {
 
/**
* Get announced compatibilities string for the provider
*/
Severity: Minor
Found in providers/nodebb/index.js - About 2 hrs to fix

Function summoner has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function summoner(forum, config) {
let messages = utils.cloneData(defaultMessages);
config = config || {}; // prevent nulls
if (Array.isArray(config) && config.length > 0) {
messages = config;
Severity: Minor
Found in plugins/summoner.js - About 1 hr to fix

Function bindNotification has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

exports.bindNotification = function bindNotification(forum) {
 
const mentionTester = new RegExp(`(^|\\s)@${forum.username}(\\s|$)`, 'i');
 
/**
Severity: Minor
Found in providers/nodebb/notification.js - About 1 hr to fix

Function login has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

login() {
const errorify = (err) => {
if (!(err instanceof Error)) {
err = new Error(err);
}
Severity: Minor
Found in providers/nodebb/index.js - About 1 hr to fix

Function mergeHelper has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function mergeHelper(base, mixin, name, mergeArrays) {
if (Array.isArray(mixin[name])) {
if (!mergeArrays && base[name] && Array.isArray(base[name])) {
base[name] = base[name].concat(mixin[name]);
} else {
Severity: Minor
Found in lib/utils.js - About 1 hr to fix

Function bindChat has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

exports.bindChat = function bindChat(forum) {
 
/**
* Send a message to the chatroom
*
Severity: Minor
Found in providers/nodebb/chat.js - About 1 hr to fix

Function getCommandHelps has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getCommandHelps() {
const cmds = {},
topics = {},
result = ['Registered commands:'];
let keys = {};
Severity: Minor
Found in lib/commands.js - About 1 hr to fix

Function notifyHandler has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function notifyHandler(data) {
const notification = Notification.parse(data);
return evalBlacklist(notification)
.then(() => {
forum.emit('log', `Notification ${notification.id}: ${notification.label} received`);
Severity: Minor
Found in providers/nodebb/notification.js - About 1 hr to fix

Function constructor has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

constructor(payload) {
payload = utils.parseJSON(payload);
const body = string(payload.bodyLong || '').unescapeHTML().s;
let type = 'notification';
if (/^\[\[\w+:user_posted_to/i.test(payload.bodyShort)) {
Severity: Minor
Found in providers/nodebb/notification.js - About 1 hr to fix

Function _getConfig has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

_getConfig() {
this._verifyCookies();
this._config = {};
return new Promise((resolve, reject) => {
debug('begin configuration fetch for CSRF token');
Severity: Minor
Found in providers/nodebb/index.js - About 1 hr to fix
Severity
Category
Status
Source
Language