SockDrawer/SockBot

View on GitHub

Showing 31 of 31 total issues

Function quoteText has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

exports.quoteText = function quoteText(text, quotedUser, contextUrl, contextTitle) {
const quote = stringify(text),
user = stringify(quotedUser),
url = stringify(contextUrl),
title = stringify(contextTitle);
Severity: Minor
Found in providers/nodebb/format.js - About 55 mins to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

lock() {
return forum._emit('topics.lock', {
tids: [this.id],
cid: this.categoryId
})
Severity: Minor
Found in providers/nodebb/topic.js and 1 other location - About 50 mins to fix
providers/nodebb/topic.js on lines 381..387

Similar blocks of code found in 2 locations. Consider refactoring.
Open

unlock() {
return forum._emit('topics.unlock', {
tids: [this.id],
cid: this.categoryId
})
Severity: Minor
Found in providers/nodebb/topic.js and 1 other location - About 50 mins to fix
providers/nodebb/topic.js on lines 362..368

Function threeParts has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

function threeParts(before, item1, defaultItem1, middle, item2, after) {
Severity: Minor
Found in providers/nodebb/format.js - About 45 mins to fix

Function validateConfig has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

exports.validateConfig = function validateConfig(config) {
const errors = [];
const checkSection = (key) => {
if (typeof config[key] !== 'object') {
errors.push(`Missing configuration section: ${key}`);
Severity: Minor
Found in lib/config.js - About 45 mins to fix

Function getVersion has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

exports.getVersion = function getVersion() {
if (packageInfo.version !== '0.0.0-semantic-release') {
return packageInfo.version;
}
const parser = /\$Id: (\S+) \$/;
Severity: Minor
Found in lib/app.js - About 35 mins to fix

Function relativeRequire has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

exports.relativeRequire = function relativeRequire(relativePath, module, requireIt) {
let resolved = `${__dirname}/../${relativePath}/${module}`;
if (module.startsWith('/') || module.startsWith('./') || module.startsWith('../')) {
resolved = path.posix.resolve(config.basePath, module);
}
Severity: Minor
Found in lib/app.js - About 25 mins to fix

Function bindPost has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

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

Function load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

exports.load = function load(filePath) {
return readYaml(filePath)
.then((data) => {
if (!data) {
throw new Error('Invalid Configuration File.');
Severity: Minor
Found in lib/config.js - About 25 mins to fix

Function _emitWithRetry has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

_emitWithRetry(delay) {
let trials = 5;
const args = Array.prototype.slice.call(arguments);
args.shift(); // remove the delay parameter
const fn = () => new Promise((resolve, reject) => {
Severity: Minor
Found in providers/nodebb/index.js - About 25 mins to fix

Function parseJSON has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

exports.parseJSON = function parseJSON(json) {
if (!json) {
throw new Error('[[invalid-argument:required]]');
}
if (typeof json === 'string') {
Severity: Minor
Found in lib/utils.js - About 25 mins to fix
Severity
Category
Status
Source
Language